1. 问题复现
1.1 template
<!-- 证件照片 -->
<view class="content-item">
<u-scroll-list>
<view v-for="(item, index) in certPicList" :key="item" class="pic-item">
<view class="remove" @click="handleRemoveCertPic(index)">
<u-icon name="trash-fill" color="#fff" size="20"></u-icon>
</view>
<u--image :showLoading="false" radius="10rpx" :src="item" width="150rpx" height="150rpx">
</u--image>
</view>
</u-scroll-list>
</view>
1.2 style(scss)
.content-item {
margin-bottom: 30rpx;
.pic-item {
box-sizing: border-box;
width: 150rpx;
height: 150rpx;
margin: 20rpx 20rpx;
position: relative;
border-radius: 10rpx;
overflow: hidden;
.remove {
position: absolute;
top: 0;
right: 0;
z-index: 60;
background-color: $dating-theme-color;
color: #fff;
padding: 5rpx;
border-radius: 0 0 0 10rpx;
}
}
}
1.3 问题截图
2. 问题解决
2.1 解决办法
在<u-scroll-list>
内部只放一个盒子,盒子内部包裹横向滚动列表项,并且盒子设置display:flex;
文章来源:https://www.toymoban.com/news/detail-505809.html
2.2 template
<!-- 证件照片 -->
<view class="content-item">
<u-scroll-list>
<!-- 内部存放根容器 -->
<view class="pic-wrap">
<view v-for="(item, index) in certPicList" :key="item" class="pic-item">
<view class="remove" @click="handleRemoveCertPic(index)">
<u-icon name="trash-fill" color="#fff" size="20"></u-icon>
</view>
<u--image :showLoading="false" radius="10rpx" :src="item" width="150rpx" height="150rpx">
</u--image>
</view>
</view>
</u-scroll-list>
</view>
2.3 style(scss)
.content-item {
margin-bottom: 30rpx;
.pic-wrap {
display: flex;
.pic-item {
box-sizing: border-box;
width: 150rpx;
height: 150rpx;
margin: 20rpx 20rpx;
position: relative;
border-radius: 10rpx;
overflow: hidden;
.remove {
position: absolute;
top: 0;
right: 0;
z-index: 60;
background-color: $dating-theme-color;
color: #fff;
padding: 5rpx;
border-radius: 0 0 0 10rpx;
}
}
}
}
2.4 解决截图
文章来源地址https://www.toymoban.com/news/detail-505809.html
到了这里,关于uView2.0 ScrollList 横向滚动列表微信小程序不滚动问题的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!