赞
踩
uni.switchTab可以配合事件uni.$emit()传递数据
uni.$on()可以利用uni.switchTab()的回调来保证触发事件前完成事件的监听
templateClick(userId) {
uni.switchTab({
url: "/pages/user/chuanyue",
success: function (e) {
console.log("目标页面加载成功,携带参数并触发事件")
uni.$emit('templateClick', userId)
}
})
}
onLoad(){
console.log("个人中心页面加载完成!")
uni.$on('templateClick', (userId) => {
console.log('收到数据',userId)
});
},
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。