// components/house-item/house-item.js Component({ /** * 组件的属性列表 */ properties: { store: Object, index: Number }, /** * 组件的初始数据 */ data: { storeItem: null }, attached() { this.setData({ storeItem: this.data.store }) if (this.data.storeItem.pvTotalNum >= 10000) { this.setData({ 'storeItem.pvTotalNum': (this.data.storeItem.pvTotalNum / 10000).toFixed(1) + 'w' }) } }, observers: { 'store': function (numberA, numberB) { console.log(numberA) this.setData({ storeItem: this.properties.store }) } }, /** * 组件的方法列表 */ methods: { gotoWV(e) { let { id, index } = e.currentTarget.dataset console.log(id) let data = { id: id, index: index, } this.triggerEvent('gotoWV', data) } } })