微信小程序頁面跳轉方法:
1.<navigator url="../test/test"><button>點我可以切換可以返回</button></navigator>
2.<button bindtap="chageToTest">切換頁面可以返回</button> chageToTest:function(){ wx.navigateTo({ url: '../time/time', }) },
3.<button bindtap="chageToTest2">切換頁面不能返回</button> chageToTest2:function(){ wx.redirectTo({ url: '../test/test', }) } ,
4.<button bindtap="chageToTest3">切換底部tabbar頁面</button> //可以跳轉tabbar欄的頁面 chageToTest3: function () { wx.switchTab ({ url: '../read/read', }) },
微信小程序提示框:
<button bindtap="tip">提示框</button> //提示框 tip:function(){ //成功 wx.showToast({ title: '成功', icon: 'success', duration: 2000 }) //加載中 wx.showToast({ title: '加載中', icon: 'loading', duration: 10000 }) setTimeout(function () { wx.hideToast() }, 2000) wx.showModal({ title: '提示', content: '這是一個模態彈窗', success: function (res) { if (res.confirm) { console.log('用戶點擊確定') } } }) wx.showActionSheet({ itemList: ['A', 'B', 'C'], success: function (res) { if (!res.cancel) { console.log(res.tapIndex) } } }) },