Component({ properties: { datas: { type: null, }, shopid: { type: null, }, }, data: {}, // 私有数据,可用于模板渲染 lifetimes: { // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() { // this.getseve(); }, moved() {}, detached() {}, }, // 生命周期函数,可以为函数,或一个在methods段中定义的方法名 attached() {}, // 此处attached的声明会被lifetimes字段中的声明覆盖 ready() { this.getseve(); }, pageLifetimes: { // 组件所在页面的生命周期函数 show() { // this.getseve(); }, hide() {}, resize() {}, }, methods: { gomicroShopShareCarelist(e) { let id = e.currentTarget.dataset.id; wx.navigateTo({ url: "/packageC/microshop/micro_shop_share_carelist/micro_shop_share_carelist?id=" + id + "&shop_id=" + this.data.shopid, }); //'micro_shop_share_carelist',{id:item.id} }, getseve() { var query = wx.createSelectorQuery().in(this); var that = this; query .select(".ul") .boundingClientRect(function (rect) { console.log(rect); that.setData({ heights: rect.height, }); }) .exec(); }, }, });