uniapp横向滚动

<template>
	<view>
		<scroll-view scroll-x="true" calss="scroll_view">
			<view class="scroll-view_H">
				<view v-for="(item,index) in imgs" :key="index">
					<image :src="item.url" mode="" style="width:150px;height:150px;"></image>
				</view>
			</view>
		</scroll-view>
	</view>
	</view>
</template>

<script>
	export default {
    
    
		data() {
    
    
			return {
    
    
				imgs: [{
    
    
						url: require("../../static/logo.png"),
					},
					{
    
    
						url: require("../../static/logo.png"),
					},
					{
    
    
						url: require("../../static/logo.png"),
					},
					{
    
    
						url: require("../../static/logo.png"),
					},
				]
			}
		}
	}
</script>

<style>
	.scroll_view{
    
    
		width: 100%;
		overflow:hidden;
		white-space:nowrap;
	}
	.scroll-view_H {
    
    
		display: flex;
		flex-wrap: nowrap;
	}
</style>

猜你喜欢

转载自blog.csdn.net/weixin_49295874/article/details/113183259