微信小程序开发之组件导航用法
1,functional-page-navigator
<functional-page-navigator name="loginAndGetUserInfo" bind:success="loginSuccess">
<button>www.cnmibee.com</button>
</functional-page-navigator>
// redirect.js navigator.js
Component({
methods: {
loginSuccess: function(e) {
console.log(e.detail.code) // wx.login 的 code
console.log(e.detail.userInfo) // wx.getUserInfo 的 userInfo
}
}
})
2,navigator
<!-- sample.wxml -->
<view class="btn-area">
<navigator url="/page/navigate/navigate?title=navigate" hover-class="navigator-hover">跳转到新页面</navigator>
<navigator url="../../redirect/redirect/redirect?title=redirect" open-type="redirect" hover-class="other-navigator-hover">在当前页打开</navigator>
<navigator url="/page/index/index" open-type="switchTab" hover-class="other-navigator-hover">切换 Tab</navigator>
<navigator target="miniProgram" open-type="navigate" app-id="" path="" extra-data="" version="release">打开绑定的小程序</navigator>
</view>