小程序商品列表页优化;添加我的订单页面
This commit is contained in:
@@ -8,8 +8,11 @@ Page({
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
// 筛选条件
|
||||
sidebarActiveId: -1,
|
||||
searchText: '',
|
||||
|
||||
// 数据
|
||||
sidebarList: [
|
||||
{
|
||||
id: -1,
|
||||
@@ -128,15 +131,20 @@ Page({
|
||||
},
|
||||
|
||||
sidebarItemTap(event) {
|
||||
console.log("sidebarActiveId", this.data.sidebarActiveId)
|
||||
// 清除原来的选中项,并设置新的选中项
|
||||
// console.log("event.target", event.target)
|
||||
// console.log("event.currentTarget", event.currentTarget)
|
||||
let dataset = event.currentTarget.dataset
|
||||
console.log("dataset", dataset)
|
||||
if (this.data.sidebarActiveId === dataset.item.id) {
|
||||
console.log("点的分类已选中,跳过")
|
||||
return // 点的分类就是当前激活的分类,直接跳过
|
||||
}
|
||||
this.setData({
|
||||
sidebarActiveId: dataset.item.id,
|
||||
})
|
||||
this.loadPageData()
|
||||
this.updatePageData()
|
||||
return
|
||||
},
|
||||
|
||||
@@ -167,10 +175,10 @@ Page({
|
||||
},
|
||||
|
||||
updatePageData() {
|
||||
this.setData({
|
||||
tabbarList: [],
|
||||
});
|
||||
(async () => {
|
||||
this.setData({
|
||||
tabbarList: [],
|
||||
})
|
||||
let goodListPromise = goodService.getGoodList(this.data.sidebarActiveId, this.data.searchText)
|
||||
Promise.all([
|
||||
goodListPromise,
|
||||
@@ -180,7 +188,9 @@ Page({
|
||||
this.setData({
|
||||
tabbarList: goodList,
|
||||
})
|
||||
// wx.nextTick(() => {
|
||||
// })
|
||||
})
|
||||
})();
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user