微信小程式的頁面跳轉和引數傳遞,頁面生命週期
頁面的生命週期函式如下:
Page({
data:{
},
onLoad:function(options){
// 生命週期函式--監聽頁面載入
console.log("---index page onLoad---")
},
onReady:function(){
// 生命週期函式--監聽頁面初次渲染完成
console.log("---index page oload---");
},
onShow:function(){
// 生命週期函式--監聽頁面顯示
console.log("---index onshow--")
},
onHide:function(){
// 生命週期函式--監聽頁面隱藏
console.log("--index onHide--")
},
onUnload:function(){
// 生命週期函式--監聽頁面解除安裝
console.log("--index onUnload--")
},
onPullDownRefresh: function() {
// 頁面相關事件處理函式--監聽使用者下拉動作
console.log("--index onPullDownRefresh--")
},
onReachBottom: function() {
// 頁面上拉觸底事件的處理函式
console.log("--index onReachBottom--")
},
})
微信小程式裡面的頁面的跳轉
這只是一種跳轉方式:傳值方式需要根據get請求
itemClick : function(){
wx.navigateTo({
url: '../logs/logs',
success: function(res){
console.log(111)
},
fail: function(res) {
// fail
},
complete: function(res) {
// complete
}
})
}
第二種
redirect是否顯示返回按鈕
<navigator url="../logs/logs?id=100" redirect>文章一</navigator>
切換欄:taps
"tabBar": {
"list": [{
"pagePath": "pagePath",
"text": "text",
"iconPath": "iconPath",
"selectedIconPath": "selectedIconPath"
}]
}
只要需要兩個