修改路由路径,以及不存在的页面跳转到主页面

This commit is contained in:
lVAL 2020-10-09 11:14:18 +08:00
parent 48b5cdf5c8
commit b0d7c6135d
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ router.beforeEach(async (to, from, next) => {
if (to.path == "/") {
next({ path: "/home" });
} else if (to.matched.length === 0) {
from.name ? next({ name: from.name }) : next({ path: "/404" });
from.name ? next({ name: from.name }) : next({ path: "/" });
} else {
next();
}

View File

@ -75,7 +75,7 @@ const routes = [
const createRouter = () =>
new VueRouter({
base: "/official-website/",
base: "/",
mode: "history",
routes
});