Arvin_韶华
Arvin_韶华
  • 发布:2020-10-10 15:15
  • 更新:2020-11-12 20:28
  • 阅读:1043

uni.switchTab跳转到首页后报错了

分类:uni-app

纯nvue项目,nvue编译模式为uni-app
描述:在App.vue中读取缓存中设置的参数来判断是否是第一次打开应用,然后跳转到引导页,引导页使用的swiper组件,点击最后一张引导图后跳转到首页,但是跳转到首页后报错:
15:09:31.520 [JS Framework] Failed to execute the callback function:
15:09:31.540 TypeError: Cannot read property '__call_hook' of undefined
15:09:31.560 reportJSException >>>> exception function:WEEX_CALL_JAVASCRIPT, exception:JavaScript execute error!Uncaught TypeError: Cannot read property '__call_hook' of undefined

App.vue中的代码:
onLaunch: function() {
console.log(uni.getStorageSync('isFirstEnter'))
if(uni.getStorageSync('isFirstEnter') === false){
uni.navigateTo({
url: 'pages/guide/guide'
});
}
console.log('App Launch')
}

引导页中的代码:
uni.switchTab({
url:'/pages/index/index',
success() {
uni.setStorageSync('isFirstEnter',false)
}
})

PS:引导页中使用uni.navigateBack也报这个错误

麻烦大神帮忙看看是什么情况

2020-10-10 15:15 负责人:无 分享
已邀请:
Arvin_韶华

Arvin_韶华 (作者)

顶一下

  • xzh

    楼主,有什么解决方法吗

    2020-11-12 20:19

xzh

xzh

解决了,这样就可以了

this.$nextTick(function(){
uni.navigateTo({
url: path,
success: (res) => {
console.log("成功", res);
},
fail: (error) => {
console.log("失败", error);
}
})
})

该问题目前已经被锁定, 无法添加新回复