async watchRouter(callback) {
let that = this;
//#ifdef APP-PLUS
let RouterTypes = ['navigateTo', 'redirectTo', 'switchTab', 'navigateBack', 'reLaunch'];
RouterTypes.forEach(item => {
uni.addInterceptor(item, {
invoke(e) {
callback();
},
returnValue(e) {}
});
})
// #endif
//#ifdef MP-WEIXIN
wx.onAppRoute(page => {
let that = this;
console.log(`%c 全局路由监听中==>${page.path}`, 'color:green;font-size:30px;');
callback()
});
//#endif
},
uniapp 小程序 安卓 ios 通用监听路由跳转方法
于 2024-12-20 09:14:40 首次发布