47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
Page({
|
|
data: {
|
|
category: [
|
|
{name:'果味',id:'guowei'},
|
|
{name:'蔬菜',id:'shucai'},
|
|
{name:'炒货',id:'chaohuo'},
|
|
{name:'点心',id:'dianxin'},
|
|
{name:'粗茶',id:'cucha'},
|
|
{name:'淡饭',id:'danfan'}
|
|
],
|
|
detail:[],
|
|
curIndex: 0,
|
|
isScroll: false,
|
|
toView: 'guowei'
|
|
},
|
|
onReady(){
|
|
var self = this;
|
|
wx.request({
|
|
url:'http://www.gdfengshuo.com/api/wx/cate-detail.txt',
|
|
success(res){
|
|
self.setData({
|
|
detail : res.data
|
|
})
|
|
}
|
|
});
|
|
|
|
},
|
|
switchTab(e){
|
|
const self = this;
|
|
this.setData({
|
|
isScroll: true
|
|
})
|
|
setTimeout(function(){
|
|
self.setData({
|
|
toView: e.target.dataset.id,
|
|
curIndex: e.target.dataset.index
|
|
})
|
|
},0)
|
|
setTimeout(function () {
|
|
self.setData({
|
|
isScroll: false
|
|
})
|
|
},1)
|
|
|
|
}
|
|
|
|
}) |