微信小程式 仿美團分類選單 swiper分類選單
阿新 • • 發佈:2019-02-05
程式碼:
js就這麼一點
//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 });
},
})