修改路由路径,以及不存在的页面跳转到主页面
This commit is contained in:
parent
48b5cdf5c8
commit
b0d7c6135d
@ -12,7 +12,7 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (to.path == "/") {
|
if (to.path == "/") {
|
||||||
next({ path: "/home" });
|
next({ path: "/home" });
|
||||||
} else if (to.matched.length === 0) {
|
} else if (to.matched.length === 0) {
|
||||||
from.name ? next({ name: from.name }) : next({ path: "/404" });
|
from.name ? next({ name: from.name }) : next({ path: "/" });
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ const routes = [
|
|||||||
|
|
||||||
const createRouter = () =>
|
const createRouter = () =>
|
||||||
new VueRouter({
|
new VueRouter({
|
||||||
base: "/official-website/",
|
base: "/",
|
||||||
mode: "history",
|
mode: "history",
|
||||||
routes
|
routes
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user