/**
* 注册全局Router生命钩子
*/
export const registerRouterHooks = function () {
registerHook(this.lifeCycle.routerbeforeHooks, function () {
return new Promise(async (resolve) => {
this.CONFIG.routerBeforeEach(); // 触发暴露给开发者的生命钩子
if (appPlatform(true) === 'H5') {
H5PATCH.on('toogle', 'startLodding');
}
return resolve(true);
});
});
registerHook(this.lifeCycle.routerAfterHooks, function (res = {}) {
if (res.H5Intercept !== true) {
this.CONFIG.routerAfterEach(); // 触发暴露给开发者的生命钩子
}
if (appPlatform(true) === 'H5') {
H5PATCH.on('toogle', 'stopLodding');
}
return true;
});
};
uniapp注册全局Router生命钩子
最新推荐文章于 2024-06-16 18:42:38 发布