怎么解决的?
usingComponents 引入页面onLoad未执行- 当前 Bug 的表现(可附上截图) usingComponents 引入页面onLoad未执行 - 预期表现 onLoad: function(options) { console.log(111112); }, - 复现路径 /pages/landlord/myHouse/myHouse - 提供一个最简复现 Demo index.wxml [代码]<[代码][代码]myHouse[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{PageCur == 'myHouse'}}"[代码][代码]></[代码][代码]myHouse[代码][代码]>[代码][代码]<[代码][代码]contract[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{PageCur == 'contract'}}"[代码][代码]></[代码][代码]contract[代码][代码]>[代码][代码]<[代码][代码]houseControl[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{PageCur == 'houseControl'}}"[代码][代码]></[代码][代码]houseControl[代码][代码]>[代码][代码]<[代码][代码]rent[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{PageCur == 'rent'}}"[代码][代码]></[代码][代码]rent[代码][代码]>[代码][代码]<[代码][代码]personal[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{PageCur == 'personal'}}"[代码][代码]></[代码][代码]personal[代码][代码]>[代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"cu-bar tabbar shadow foot"[代码][代码]>[代码] [代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"action"[代码] [代码]bindtap[代码][代码]=[代码][代码]"NavChange"[代码] [代码]data-cur[代码][代码]=[代码][代码]"myHouse"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]'cuIcon-cu-image'[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]src[代码][代码]=[代码][代码]"/images/icon/myHouse{{PageCur=='myHouse'?'_cur':''}}.png"[代码][代码]></[代码][代码]image[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]" {{PageCur=='myHouse'?'text-green':'text-bar'}}"[代码][代码]>我的房屋</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码] [代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"action"[代码] [代码]bindtap[代码][代码]=[代码][代码]"NavChange"[代码] [代码]data-cur[代码][代码]=[代码][代码]"contract"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]'cuIcon-cu-image'[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]src[代码][代码]=[代码][代码]"/images/icon/contract{{PageCur=='contract'?'_cur':''}}.png"[代码][代码]></[代码][代码]image[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"{{PageCur=='contract'?'text-green':'text-bar'}}"[代码][代码]>合同管理</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码] [代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"action"[代码] [代码]bindtap[代码][代码]=[代码][代码]"NavChange"[代码] [代码]data-cur[代码][代码]=[代码][代码]"houseControl"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]'cuIcon-cu-image'[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]src[代码][代码]=[代码][代码]"/images/icon/houseControl{{PageCur=='houseControl'?'_cur':''}}.png"[代码][代码]></[代码][代码]image[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"{{PageCur=='houseControl'?'text-green':'text-bar'}}"[代码][代码]>房控</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码] [代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"action"[代码] [代码]bindtap[代码][代码]=[代码][代码]"NavChange"[代码] [代码]data-cur[代码][代码]=[代码][代码]"rent"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]'cuIcon-cu-image'[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]src[代码][代码]=[代码][代码]"/images/icon/rent{{PageCur=='rent'?'_cur':''}}.png"[代码][代码]></[代码][代码]image[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"{{PageCur=='rent'?'text-green':'text-bar'}}"[代码][代码]>收租</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码] [代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"action"[代码] [代码]bindtap[代码][代码]=[代码][代码]"NavChange"[代码] [代码]data-cur[代码][代码]=[代码][代码]"personal"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]'cuIcon-cu-image'[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]src[代码][代码]=[代码][代码]"/images/icon/personal{{PageCur=='personal'?'_cur':''}}.png"[代码][代码]></[代码][代码]image[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"{{PageCur=='personal'?'text-green':'text-bar'}}"[代码][代码]>个人中心</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码] [代码]</[代码][代码]view[代码][代码]>[代码]index.json引入相关页面 [代码]{[代码][代码] [代码][代码]"usingComponents"[代码][代码]: {[代码][代码] [代码][代码]"myHouse"[代码][代码]: [代码][代码]"/pages/landlord/myHouse/myHouse"[代码][代码],[代码][代码] [代码][代码]"contract"[代码][代码]: [代码][代码]"/pages/landlord/contract/contract"[代码][代码],[代码][代码] [代码][代码]"houseControl"[代码][代码]: [代码][代码]"/pages/landlord/houseControl/houseControl"[代码][代码],[代码][代码] [代码][代码]"rent"[代码][代码]: [代码][代码]"/pages/landlord/rent/rent"[代码][代码],[代码][代码] [代码][代码]"personal"[代码][代码]: [代码][代码]"/pages/landlord/personal/personal"[代码][代码] [代码][代码]}[代码][代码]}[代码]index.js [代码]const app = getApp();[代码] [代码]Page({[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面的初始数据[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]PageCur: [代码][代码]'myHouse'[代码][代码],[代码][代码] [代码][代码]// height: app.globalData.height * 2 + 24,[代码] [代码] [代码][代码]},[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 生命周期函数--监听页面加载[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码] [代码] [代码][代码]},[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面方法[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]NavChange(e) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]PageCur: e.currentTarget.dataset.cur[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]onShareAppMessage() {[代码][代码] [代码][代码]return[代码] [代码]{[代码][代码] [代码][代码]title: [代码][代码]'我的房屋'[代码][代码],[代码][代码] [代码][代码]// imageUrl: '/images/share.jpg',[代码][代码] [代码][代码]path: [代码][代码]'pages/landlord/myHouse/myHouse'[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码] [代码]})[代码] 页面如下 当加载页面 myHouse 在myHouse 页面 onLoad方法却未执行 这个是为什么了 如何调用onload呢
2020-09-27问题解决了吗?我也遇到了
微信自定义tabbar组件无法加载onload?使用官方的自定义组件示例, Component({ lifetimes: { attached: function () { if (typeof this.getTabBar === 'function' && this.getTabBar()) { this.getTabBar().setData({ selected: 3 })}}}}) 在页面js写入这个后,页面跳转就无法加载生命周期函数,无法获取服务器数据,这是怎么回事呢
2020-09-26