Javascript 导航卫士更换整个链接而不是部分链接Vuejs vue路由器
商店id来自firebase,并从该id加载购物商店页面,firestore中有许多类似的商店 所以主页url看起来像这样Javascript 导航卫士更换整个链接而不是部分链接Vuejs vue路由器,javascript,vue.js,vue-router,Javascript,Vue.js,Vue Router,商店id来自firebase,并从该id加载购物商店页面,firestore中有许多类似的商店 所以主页url看起来像这样http://localhost:8080/mystore/homemystore部分来自firenase,作为商店id 我有一个导航卫士设置,一旦用户登录firebase,他就无法登录,即http://localhost:8080/mystore/login并被推到主页,但导航卫士没有推http://localhost:8080/mystore/home不包括店铺id,ur
http://localhost:8080/mystore/home
mystore部分来自firenase,作为商店id
我有一个导航卫士设置,一旦用户登录firebase,他就无法登录,即http://localhost:8080/mystore/login
并被推到主页,但导航卫士没有推http://localhost:8080/mystore/home
不包括店铺id,url变为http://localhost:8080/home
这是我的路由器主页和登录设置:
{
path: "/:id/home/",
name: "home",
component: Home,
},
{
path: "/:id/login",
name: "login",
component: loginScreen,
meta: { disallowedAuth: true },
},
这是我的导航保护,防止登录后返回/登录:
router.beforeEach(async (to, from, next) => {
if (to.meta.disallowedAuth && (await firebase.getCurrentUser())) {
return router.push("/home");
}
return next();
});
是否有一种方法可以在url中包含商店id