内容摘要小程序
小程序应用的生命周期api
globalData表明小程序应用的全局数据缓存
data 表明当前页面,当前小程序的数据服务器
路由方式 | 触发时机 |
---|---|
打开新页面 | 调用API wx.navigateTo或使用组件 <navigator open-type="navigateTo" /> |
页面重定向 | 调用API wx.redirectTo 或使用组件 <navigator open-type="redirectTo" /> |
页面返回 | 调用API wx.navigateBack 或使用组件 <navigator open-type="navigateBack" /> 或用户按左上角返回按钮 |
Tab切换 | 调用API wx.switchTab 或使用组件 <navigator open-type="switchTab"/> 或用户切换tab |
重启动 | 调用API wx.reLaunch 或使用组件 <navigator open-type="reLaunch" /> |
<view> <view class="btn" bindTap="clickMe"> 点击我 </view> </view>
<view class="A" style="border:1px solid red; width:500px;height: 500px;" bindTap="console.log('A')"> A <view class="A" style="border:1px solid red; width:300px;height: 300px;" bindTap="console.log('B')"> B <view class="A" style="border:1px solid red; width:100px;height: 100px;" bindTap="console.log('c')"> c </view> </view> </view> 点击C 打印 C B A
<view class="A" style="border:1px solid red; width:500px;height: 500px;" bindTap="console.log('A')" capture-bind:tap="console.log('captrue A')"> A <view class="A" style="border:1px solid red; width:300px;height: 300px;" bindTap="console.log('B')" capture-bind:tap="console.log('captrue B')"> B <view class="A" style="border:1px solid red; width:100px;height: 100px;" bindTap="console.log('c')" capture-catch:tap="console.log('captrue C')"> c </view> </view> </view> 点击B 打印 captrue A captrue B captrue B captrue A