You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
871 B
37 lines
871 B
// pages/message/index.js
|
|
const event = require('../../../utils/event')
|
|
const app = getApp()
|
|
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
properties: {
|
|
item: { type: Object, value: null }
|
|
},
|
|
data: {
|
|
kg: app.globalData.kg
|
|
},
|
|
lifetimes: {
|
|
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
attached: function () {
|
|
this.setData({ kg: app.globalData.kg })
|
|
event.on('EventMessage', this, this.onEvent)
|
|
},
|
|
detached: function () {
|
|
event.remove('EventMessage', this)
|
|
}
|
|
},
|
|
methods: {
|
|
onEvent: function (message) {
|
|
if(message.what == 1001){
|
|
this.setData({ kg: app.globalData.kg })
|
|
}
|
|
},
|
|
lookItem: function (e) {
|
|
wx.navigateTo({ url: '/submodel/pages/purchase/detail/index?id=' + this.data.item.id })
|
|
}
|
|
}
|
|
|
|
})
|