Uni-appで画像の左滑りを実現する効果

4632 ワード

template:
1 <view class="my-reg">
2     <view class="my-regs">
3        <image class="reg-img" src="/static/ 1.png" alt="" />
4        <image class="reg-img" @tap="openDetail" src="/static/ 2.png" alt="" />
5        <image class="reg-img" src="/static/ 3.png" alt="" />
6         <image class="reg-img" src="/static/ 4.png" alt="" />
7      view>
8 view>

js:
css:
 1 .reg-img {
 2     width: 222rpx;
 3     height: 116rpx;
 4     margin-right:18rpx;
 5 }
 6 .my-reg {
 7     padding:20rpx 30rpx;
 8     border-bottom: 20rpx solid #F5F6F9;
 9     display: flex;
10     overflow-y: hidden;
11     overflow-x: scroll
12 }
13 .my-regs{
14     display: flex;
15     margin-right: 8px;
16 }

 
実装効果:画像を左右にスライド表示
転載先:https://www.cnblogs.com/renxiao1218/p/11613182.html