2023-03-18 17:52:56 +08:00
|
|
|
// pages/shop/components/good-list-card.js
|
|
|
|
Component({
|
|
|
|
// refer: https://developers.weixin.qq.com/miniprogram/dev/reference/api/Component.html
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的属性列表
|
|
|
|
*/
|
|
|
|
properties: {
|
|
|
|
goodinfo: {
|
|
|
|
type: Object,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
2023-03-18 23:00:58 +08:00
|
|
|
// displayGoodsInfo: "",
|
2023-03-18 17:52:56 +08:00
|
|
|
},
|
|
|
|
|
2023-03-18 23:00:58 +08:00
|
|
|
// observers: {
|
|
|
|
// 'goodinfo': function (goodinfo) {
|
|
|
|
// console.log("observers -> goodinfo", goodinfo)
|
|
|
|
// this.setData({
|
|
|
|
// displayGoodsInfo: JSON.stringify(this.properties.goodinfo)
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// },
|
2023-03-18 17:52:56 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 组件的方法列表
|
|
|
|
*/
|
|
|
|
methods: {
|
2023-03-18 23:00:58 +08:00
|
|
|
cardOntap(event) {
|
|
|
|
let dataset = event.currentTarget.dataset
|
|
|
|
console.log("cardOntap dataset", dataset)
|
|
|
|
let goodInfo = dataset.goodinfo
|
|
|
|
wx.navigateTo({
|
|
|
|
url: '/pages/shop/goodDetail?id=' + goodInfo.id,
|
|
|
|
})
|
|
|
|
}
|
2023-03-18 17:52:56 +08:00
|
|
|
}
|
|
|
|
})
|