122 lines
2.0 KiB
JavaScript
122 lines
2.0 KiB
JavaScript
|
// pages/shop/shop.js
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
sidebarActiveId: -1,
|
||
|
sidebarList: [
|
||
|
{
|
||
|
id: -1,
|
||
|
title: "全部分类",
|
||
|
},
|
||
|
{
|
||
|
id: 1,
|
||
|
title: "1",
|
||
|
},
|
||
|
{
|
||
|
id: 2,
|
||
|
title: "防疫物资",
|
||
|
},
|
||
|
{
|
||
|
id: 3,
|
||
|
title: "111",
|
||
|
},
|
||
|
{
|
||
|
id: 4,
|
||
|
title: "111",
|
||
|
},
|
||
|
{
|
||
|
id: 5,
|
||
|
title: "111",
|
||
|
},
|
||
|
],
|
||
|
|
||
|
tabbarList: [
|
||
|
{
|
||
|
id: 1,
|
||
|
goodsName: "温度计",
|
||
|
counterPrice: "10.00",
|
||
|
retailPrice: "12.00",
|
||
|
picUrl: "https://cdn-we-retail.ym.tencent.com/tsr/goods/gh-2b.png?imageMogr2/thumbnail/320x320/quality/70/strip/format/webp",
|
||
|
},
|
||
|
{
|
||
|
id: 2,
|
||
|
goodsName: "医用口罩",
|
||
|
counterPrice: "100.00",
|
||
|
retailPrice: "12.50",
|
||
|
picUrl: "https://cdn-we-retail.ym.tencent.com/tsr/goods/muy-3a.png?imageMogr2/thumbnail/320x320/quality/70/strip/format/webp",
|
||
|
}
|
||
|
]
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad(options) {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage() {
|
||
|
|
||
|
},
|
||
|
|
||
|
|
||
|
sidebarItemTap(event) {
|
||
|
// 清除原来的选中项,并设置新的选中项
|
||
|
// console.log("event.target", event.target)
|
||
|
// console.log("event.currentTarget", event.currentTarget)
|
||
|
let dataset = event.currentTarget.dataset
|
||
|
console.log("dataset", dataset)
|
||
|
this.setData({
|
||
|
sidebarActiveId: dataset.item.id,
|
||
|
})
|
||
|
return
|
||
|
}
|
||
|
})
|