Component({ properties: { datas: { type: null, }, cityData: { type: null, }, pointData: { type: null, }, }, data: {}, // 私有数据,可用于模板渲染 lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() { console.log(this.properties.datas); }, moved() {}, detached() {}, }, // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() {}, // 此处attached的声明会被lifetimes字段中的声明覆盖 ready() {}, pageLifetimes: { // 组件所在页面的生命周期函数 show() {}, hide() {}, resize() {}, }, methods: { taplink(e) { let url = e.currentTarget.dataset.url; console.log(url); try { wx.navigateTo({ url: url, }); } catch (error) { console.log(error); } }, goo2oCategory(e) { let id = e.currentTarget.dataset.id; wx.navigateTo({ url: "/packageC/o2o/o2oCategory/o2oCategory?id=" + id + "&city=" + this.data.cityData + "&point=" + JSON.stringify(this.data.pointData), }); }, }, });