小程序实现点击tab切换左右滑动

网友投稿 578 2023-11-14 13:19:30

本文实例为大家分享了小程序实现点击tab切换左右滑动的具体代码,供大家参考,具体内容如下

小程序实现点击tab切换左右滑动

wxml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<scroll-view scroll-x="true" class="navbar-box">
<block wx:for="{{recordMain}}" wx:for-index="idx" wx:for-item="navItem" wx:key="idx">
<view class="nav-item " data-current="{{idx}}" bindtap="switchNav">
<text class="{{currentTab == idx ? active : }}">{{navItem.title}}</text>
</view>
</block>
</scroll-view>
<swiper style="margin-top:80rpx;height:{{winHeight - 40}}px;" class="tab-box" current="{{currentTab}}" duration="300" data-current="{{idx}}" bindchange="switchTab">
<swiper-item style="height:100%;overflow-y:scroll" wx:for="{{[0,1,2,3,4,5]}}" wx:for-item="tabItem" wx:for-index="idx" wx:key="idx" class="tab-cnetent">
<block wx:for="{{tabContent}}" wx:key=" " bindtap=myOrderDetails>
<!-- 列表 -->
<view class=listBox>
<view class=listTop>
<image src={{item.goodsImg}} class=goodsImg></image>
<view class=infor>
<view class=>
<text class=name>{{item.name}}</text>
<text class=price>¥{{item.price}}</text>
</view>
<view class=>
<text class=choose>{{item.choose}}</text>
<text class=number>×{{item.number}}</text>
</view>
</view>
</view>
<view class=listBottom>
<view>共{{item.number}}件商品,合计:¥{{item.allPrice}}</view>
<view class=status>
<button>查看物流</button>
<button>确认收货</button>
</view>
</view>
</view>
</block>
</swiper-item>
</swiper>

wxss

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
.navbar-box {
height: 70rpx;
line-height: 70rpx;
position: fixed;
top: 0rpx;
background: white
}
.nav-item {
display: inline-block;
width: 16.6%;
text-align: center;
}
.nav-item text {
padding-bottom: 10rpx;
}
page {
background: #f2f2f2;
font-size: 28rpx;
}
.active {
color: #a53533;
border-bottom: 4rpx solid #a53533;
box-sizing: border-box;
}
.menu {
font-size: 28rpx;
width: 100%;
/* overflow-x: scroll; */
border-bottom: 20rpx solid #f2f2f2;
padding: 30rpx 30rpx 0rpx 30rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
position: fixed;
top: 0rpx;
z-index: 999;
background: white;
}
.chooseNav {
padding-bottom: 10rpx;
}
.listBox {
padding: 30rpx;
width: calc(100% - 60rpx);
margin-left: 30rpx;
margin-top: 30rpx;
background: white;
box-sizing: border-box;
border-radius: 8rpx;
}
.listTop {
display: flex;
justify-content: space-between;
}
.goodsImg {
width: 200rpx;
height: 200rpx;
margin-right: 20rpx;
}
.infor {
flex: 1;
margin-top: 80rpx;
font-size: 26rpx;
color: #666;
}
.infor view {
width: 100%;
display: flex;
justify-content: space-between;
}
.infor view:nth-of-type(2) {
font-size: 24rpx;
}
.name, .choose {
font-weight: 600;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 320rpx;
}
.price, .number {
padding: 5rpx 10rpx;
box-sizing: border-box;
}
.listBottom {
text-align: right;
}
button::after {
border: none;
}
.status button {
display: inline-block;
background: white;
border: 1px solid #dedede;
border-radius: 66rpx;
font-size: 24rpx;
margin-left: 20rpx;
color: #666;
padding: 0rpx 30rpx;
box-sizing: border-box;
height: 50rpx;
line-height: 45rpx;
margin-top: 20rpx;
}

wxjs

为大家推荐现在关注度比较高的微信小程序教程一篇:《微信小程序开发教程》小编为大家精心整理的,希望喜欢。

以上就是本文的全部内容,希望对大家的学习有所帮助,也

您可能感兴趣的文章:微信小程序实现卡片左右滑动效果的示例代码微信小程序左右滑动的实现代码微信小程序滚动Tab实现左右可滑动切换微信小程序图片横向左右滑动案例微信小程序左右滑动切换页面详解及实例代码微信小程序侧边栏滑动特效(左右滑动)小程序实现日历左右滑动效果微信小程序页面滑动屏幕加载数据效果微信小程序之滑动页面隐藏和显示组件功能的实现代码微信小程序实现页面左右滑动

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:安卓APP开发困难吗?来app制作平台体验一下
下一篇:半成品菜配送app开发怎么做?
相关文章