• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

微信小程序组件分页菜单点击请求

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
//JS
data: {
navNum:0,
navList: [
{
id: 1,
name: '已预约'
},
{
id: 2,
name: '已消费'
},
{
id: 3,
name: '已取消'
},
],
shopList0: [
{
id: 1,
image: '/imgs/news/class_1.png',
coach: '张胜男',
time: '2017-10-10 09:00-10:00',
age: '11,12',
adress: '浙江省,杭州市,余杭区,乔司镇,保亿风景晨缘G1,128楼,208',
num: 10,
selected: true,
},
{
id: 1,
image: '/imgs/news/class_1.png',
coach: '张胜男',
time: 'er年',
age: '11,12',
adress: '杭州',
num: 20,
selected: false,
}
],
shopList1: [
{
id: 1,
image: '/imgs/news/class_1.png',
coach: '张胜男',
time: 'er年',
age: '11,12',
adress: '杭州',
num: 20,
selected: false,
}
],
shopList2: [
{
id: 1,
image: '/imgs/news/class_1.png',
coach: '张胜男',
time: '2017-10-10 09:00-10:00',
age: '11,12',
adress: '浙江省,杭州市,余杭区,乔司镇,保亿风景晨缘G1,128楼,208',
num: 10,
selected: true,
},
{
id: 1,
image: '/imgs/news/class_1.png',
coach: '张胜男',
time: 'er年',
age: '11,12',
adress: '杭州',
num: 20,
selected: false,
}
],
shopListN: [],
 

 

},
// 分页菜单函数
selectNav: function (e) {
var that=this;
// console.log(e.currentTarget.dataset.id)
let id = e.currentTarget.dataset.id;
let index = e.currentTarget.dataset.index;
this.setData({
navNum: index
})
switch (index) {
case 1:
(function(){
that.setData({
shopListN: that.data.shopList0
})
})()
break;
case 2:
(function () {
that.setData({
shopListN: that.data.shopList1
})
})()
break;
default:
(function () {
that.setData({
shopListN: that.data.shopList2
})
})()
}
 
},
 
 
//css
 
.aside{
border-bottom: 1px solid #f7f7f7;
}
.type-nav{
width: 33.33%;
/* text-align: center; */
height: 88rpx;
">#fff;
}
.type-nav>view text{
color: #333;
margin-bottom: 20rpx;
margin-top: 10rpx;
font-size: 34rpx;
}
.type-nav>view view{
width: 48rpx;
border-bottom: 4rpx solid transparent;
}
.aside .type-nav>view .selected{
color: #19ad17;
border-color: #19ad17;
}

.list{
width: 100%;
}
.news-box{
width: 100%;
">white;
padding: 20rpx 24rpx;
border-bottom: 1rpx solid #f7f7f7;
box-sizing: border-box;
}
.new-left{
float: left;
width: 136rpx;
height: 136rpx;
}
.news-img{
width: 136rpx;
height: 136rpx;
margin: 0 auto;
}
.news-img image{
width: 100%;
height: 100%;
border-radius:50%;
}
.news-title {
flex: 1;
padding-left: 20rpx;
box-sizing: border-box;
}
.news-title>view{
width: 100%;
overflow: hidden;
}
.new-titleright{
margin-left: 30rpx;
box-sizing: border-box;
}
.new-titleright button{
margin-top: 10px;
padding: 10rpx 20rpx;
box-sizing: border-box;
font-size: 30rpx;
">#19ad17;
}
.order-order{
margin-top: 20rpx;
text-align: center;

}
.order-order {
font-size: 26rpx;
color:#19ad17;
}
.order-order>text{
font-size: 32rpx;
}
.news-name{
font-size: 32rpx;
}
.news-name2{
width: 100%;
font-size: 24rpx;
line-height: 36rpx;
}
 
 
 
//wxml
<view class="appoint-container">
<!-- menue -->
<view class="aside flex">
<block wx:key="navList" wx:for="{{navList}}">
<view class="type-nav flexca" bindtap="selectNav" data-index="{{index}}">
<view class='flexda'>
<text class="{{navNum == index ? 'selected' : ''}}">{{item.name}}</text>
<view class="{{navNum == index ? 'selected' : ''}}"></view>
</view>
</view>
</block>
</view>
<!-- content -->
<view class="list">
<block wx:key="ishesList" wx:for="{{shopListN}}">
<view class="news-box flexa" data-goods="{{item.id}}">
<view class='new-left'>
<view class="news-img" bindtap='newsDetail' data->
<image src="{{item.image}}"></image>
</view>
</view>
<view class="news-title">
<view class="news-name">
教练:
<text>{{item.coach}}</text>
</view>
<view class="news-name2">
年龄限制:
<text>{{item.age}}</text>
</view>
<view class="news-name2">
时间:
<text>{{item.time}}</text>
</view>
<view class="news-name2">
地点:
<text>{{item.adress}}</text>
</view>
</view>
<view wx:if="{{navNum==0?true:''}}" class="new-titleright">
<button class='button' data- data-index='{{index}}' bindtap='orderDelete'>取消预约</button>
<view class="order-order">
已预约
<text>{{item.num}}</text>人
</view>
</view>
<view wx:if="{{navNum==1?true:''}}" class="new-titleright">
<view class="order-order">
<text>已消费</text>
</view>
</view>
<view wx:if="{{navNum==2?true:''}}" class="new-titleright">
<view class="order-order">
<text>已取消</text>
</view>
</view>
</view>
</block>
</view>
</view>

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
钉钉小程序中使用F2图表绘制条形图发布时间:2022-07-18
下一篇:
python(三)一个文件读写操作的小程序发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap