微信小程序页面跳转

时间:2019-12-28 23:00:04   收藏:0   阅读:100

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"
}

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!