WXML
<text>我是PageA</text>
<view class="menu">
<button type="primary" bindtap="toPageB">toPageB</button>
</view>
渲染层给button组件定义bindtap事件绑定
JS
Page({
toPageB: function () {
wx.navigateTo({
url: ‘/pages/PageB/PageB‘
})
}
})
逻辑层接收到点击事件执行并跳转PageB
其他无关紧要
WXSS
button{
margin: 10rpx 0;
}
JSON
{
"navigationBarTitleText": "PageA",
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTextStyle": "black"
}
原文:https://www.cnblogs.com/weijun901/p/12113205.html