小程序常用两种方式,普通页面跳转和tab栏切换(跳转)
- 跳转方式一 通过组件navigator进行跳转,需要指定跳转类型open-type
<view class="btn-area">
<navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳转到新页面</navigator>
<navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator>
<navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在当前页打开</navigator>
<navigator target="miniProgram" open-type="navigate" app-id="" path="" extra-data="" version="release">打开绑定的小程序</navigator>
</view>
-
跳转方式二 通过js进行跳转
// 普通页面跳转 wx.navigateTo({ url: '/product/product' })
// tab栏切换 wx.switchTab({ url: '/index' })
网友评论