写小程序的时候发现,写到一半,之前可以实现的navigation跳转失效了,翻阅文档后找到原因所在。

navigator 导航的问题 导航分三种a.open-type="navigate" 打开新界面b.open-type="redirect" 在本界面中打开新界面c.open-type="switchTab" 控制tab页之间的切换注意:1. 所有需要跳转链接的界面必须在app.json中注册2. a, b只能连接非tabBar中注册占用的页面,不能打开url="../index/index",因为pages/index/index界面是tab页

3. c只能打开app.json中注册过的tab页,也就是被tabBar注册的界面

所以,当你要跳转的页面设置了tab的话,需要切换城switchTab进行跳转

Page({    onTap: function (event) {     /*       wx.navigateTo({           url:"../posts/posts"         });         */               wx.switchTab({            url: "../posts/posts"        });            },  })

TAG标签: 微信小程序navigation

http://www.xiaochengxub.com/read-103668.html