onload中若是接受傳參的話必需要傳入參數或則作無參數處理!微信
uni.showToast({ title: "用戶取消付款!", icon: "none", success: () => { setTimeout(() => { uni.switchTab({ url: "../library/library?topIndex=1&subIndex=3", success: (res) => { console.log('跳轉成功',res) let data={ topIndex:1, subIndex:3 } let page = getCurrentPages().pop(); if (page == undefined || page == null) return; page.onLoad(data); }, fail: (err) => { console.log('跳轉失敗',err) } }) }, 1500); } })
switchTab成功跳轉後調用success,此時能夠拿到跳轉後頁面的page對象,從而調用頁面onLoad方法重載頁面;微信後期應該會加相應的參數來決定是否刷新跳轉url