有同学要仿美团分类菜单.写了一个.
跟 微信小程序开发之实现选项卡(窗口顶部TabBar)页面切换很类似
代码:
js就这么一点
复制代码
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//index.js //获取应用实例 var app = getApp() Page({ data: { currentTab: 0, grids: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], swiperList:[0, 1, 2, 3, 4] }, onLoad: function () { }, click: function (e) { console.log(e.currentTarget.dataset.id) console.log(e.currentTarget.dataset.index) wx.showToast({ title: '第' + e.currentTarget.dataset.id + '栏' + '第' + e.currentTarget.dataset.index + '个', icon: 'success', duration: 1500 }) }, /** * 滑动切换tab */ bindChange: function (e) { console.log(e.detail.current) this.setData({ currentTab: e.detail.current }); }, })
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!
最后
以上就是含蓄野狼最近收集整理的关于微信小程序 仿美团分类菜单 swiper分类菜单的全部内容,更多相关微信小程序内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复