思想:
标签需包含横向滑动所有的内容
所以建议:在 <scroll-view></scroll-view> 标签中放入一个div 保存所有数据
<scroll-view class="scroll-view_H" scroll-x="true" scroll-left="120">
<view style="display: flex;">
<view class="scroll-view-item_H" style="margin-left: 10px;" v-for="(item,index ) in superhero" :key="index">
<view style="width: 100px;">
<image :src="item.cover" mode="" style="width: 100px;height: 100px;"></image>
</view>
<view>{{item.name}}</view>
<view>{{item.score}}</view>
</view>
</view>
</scroll-view>
效果图

本文介绍了一种在前端开发中实现横向滑动效果的方法,通过使用<scroll-view>组件并设置scroll-x属性为true,使得内容可以水平滚动。示例中展示了如何加载一系列超级英雄卡片,包括其封面图片、名字及评分。
1175

被折叠的 条评论
为什么被折叠?



