wxml
<!--pages/dingdan/dingdan.wxml-->
<view class="body">
<view class="swiper-tab">
<view class="{{selected?'active':'swiper-tab-item'}}" bindtap="selected">待收货</view>
<view class="{{selected1?'active':'swiper-tab-item'}}" bindtap="selected1">待取货</view>
<view class="{{selected2?'active':'swiper-tab-item'}}" bindtap="selected2">已完成</view>
<view class="{{selected3?'active':'swiper-tab-item'}}" bindtap="selected3">已关闭</view>
</view>
<view class="{{selected?'show':'hidden'}}">
<view class="content">
<image src="../../status/images/mine-bigding.png"></image>
<text>暂无订单</text>
</view>
</view>
<view class="{{selected1?'show':'hidden'}}">
<view class="content">
<image src="../../status/images/mine-bigding.png"></image>
<text>暂无订单</text>
</view>
</view>
<view class="{{selected2?'show':'hidden'}}">
<view class="content">
<image src="../../status/images/mine-bigding.png"></image>
<text>暂无订单</text>
</view>
</view>
<view class="{{selected3?'show':'hidden'}}">
<view class="content">
<image src="../../status/images/mine-bigding.png"></image>
<text>暂无订单</text>
</view>
</view>
</view>
js(注释部分是用swiper滑动实现使用的js)
Page({
data: {
selected: true,
selected1: false,
selected2: false,
selected3: false,
},
onLoad: function (options) {
},
onReady: function () {
},
onShow: function () {
},
onHide: function () {
},
onUnload: function () {
},
onPullDownRefresh: function () {
},
onReachBottom: function () {
},
onShareAppMessage: function () {
},
selected: function (e) {
this.setData({
selected: true,
selected1: false,
selected2: false,
selected3: false,
})
},
selected1: function (e) {
this.setData({
selected: false,
selected1: true,
selected2: false,
selected3: false,
})
},
selected2: function (e) {
this.setData({
selected: false,
selected1: false,
selected2: true,
selected3: false,
})
},
selected3: function (e) {
this.setData({
selected: false,
selected1: false,
selected2: false,
selected3: true,
})
}
})
wxss(样式部分,可以自己调试)
.swiper-tab {
width: 100%;
text-align: center;
display: flex;
flex-direction: row;
height: 80rpx;
background: white;
}
.swiper-tab-item {
display: inline-block;
width: 25%;
color: black;
}
.active {
display: inline-block;
width: 25%;
color: #ff6a22;
}
.all {
height: 1122rpx;
width: 100%;
background: #fcfcfc;
}
.content {
width: 200rpx;
height: 200rpx;
margin: 300rpx auto;
}
.content image {
width: 120rpx;
height: 140rpx;
margin: 0 40rpx;
}
.content text {
width: 100%;
height: 60rpx;
line-height: 60rpx;
display: inline-block;
text-align: center;
}
.show {
display: block;
text-align: center;
line-height: 200rpx;
}
.hidden {
display: none;
text-align: center;
line-height: 200px;
}
page {
background-color: #edf0f3;
}
.nav {
width: 100%;
height: 100rpx;
display: flex;
flex-direction: row;
}
.default {
line-height: 100rpx;
text-align: center;
flex: 1;
border-right: 1px solid gainsboro;
color: #000;
font-weight: bold;
font-size: 28rpx;
}
.red {
line-height: 100rpx;
text-align: center;
color: #fc5558;
flex: 1;
border-right: 1px solid gainsboro;
font-weight: bold;
font-size: 28rpx;
}
.show {
display: block;
text-align: center;
line-height: 200rpx;
}
.hidden {
display: none;
text-align: center;
line-height: 200px;
}