cheers-mp-router
cheers-mp-router copied to clipboard
路由跳转方式经过beforeEach钩子后,跳转方式丢失
例:在pageA reLaunch 到 pageB,经beforeEach钩子逻辑处理后,实际返回next(pageC),实现pageA到pageC的跳转。实测发现,页面跳转方式变成了 pageA navigateTo 到了pageC
hook(toRoute, currentRoute, async (v) => {
if (v === false)
return;
else if (typeof v === 'object') {
try {
await this.switchRoute(v);
}
catch (error) {
reject(error);
}
}
else {
next();
}
});
原因:当钩子返回一个路由对象时,直接走了this.switchRoute 没有继承原始location的跳转方式
@wiexin 你的beforeEach怎么写的, 大概提供下测试用例