You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.2 KiB
62 lines
1.2 KiB
import * as VueRouter from "vue-router"
|
|
|
|
/**
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
redirect: '/home',
|
|
},
|
|
{
|
|
path: '/home',
|
|
component: () => import("@/pages/home"),
|
|
},
|
|
{
|
|
path: '/about',
|
|
component: () => import("@/pages/about"),
|
|
}
|
|
]
|
|
*
|
|
* */
|
|
|
|
const routes = [
|
|
// 不能缺少.vue,因为没有指定extensions字段
|
|
{
|
|
path: '/',
|
|
alias: '/home',
|
|
component: () => import("@/pages/Home/Home.vue"),
|
|
meta:{
|
|
alive: true,
|
|
title: '干货集中营'
|
|
}
|
|
},
|
|
{
|
|
path: '/detail',
|
|
component: () => import("@/pages/Detail/Detail.vue"),
|
|
meta:{
|
|
alive: true
|
|
}
|
|
},
|
|
{
|
|
path: '/about',
|
|
component: () => import("@/pages/About/About.vue"),
|
|
meta:{
|
|
alive: true ,
|
|
title: '关于我们'
|
|
}
|
|
}
|
|
]
|
|
|
|
|
|
const router = VueRouter.createRouter({
|
|
history: VueRouter.createWebHashHistory(),
|
|
routes,
|
|
scrollBehavior(to, from, savedPosition) {
|
|
if (savedPosition) {
|
|
return savedPosition
|
|
} else {
|
|
return { top: 0 }
|
|
}
|
|
},
|
|
});
|
|
|
|
export default router;
|
|
|