uniapp 中使用 navigator 跳转页面失败的问题

uni.navigateTo 用于页面跳转

如:

<navigator url="/pages/index/index" hover-class="navigator-hover">
    <button type="default">跳转</button>
</navigator>

但是跳转页面失败,没有任何反应

问题原因:

  url指定的页面,在pages.json中配置的是TabBar里的页面

解决办法:

<navigator url="/pages/index/index" open-type="switchTab" hover-class="navigator-hover">
    <button type="default">跳转到首页</button>
</navigator>

 

posted @ 2023-06-19 15:15  慕尘  阅读(846)  评论(0编辑  收藏  举报