Files
Yi.Admin/Yi.BBS.Vue3/src/router/index.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-02-26 13:17:19 +08:00
import { createRouter, createWebHistory } from 'vue-router'
2023-03-03 21:58:58 +08:00
import Layout from '../layout/Index.vue'
import NotFound from '../views/NotFound.vue'
2023-02-26 13:17:19 +08:00
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
2023-03-12 01:50:11 +08:00
scrollBehavior(to, from, savedPosition) {
// 始终滚动到顶部
return { top: 0 }
},
2023-02-26 13:17:19 +08:00
routes: [
{
path: '/',
2023-03-03 21:58:58 +08:00
name: 'layout',
component: Layout,
redirect: '/index' ,
children :[
{
name:'index',
path: '/index',
component: () => import('../views/Index.vue')
},
2023-03-05 20:30:44 +08:00
{
name:'article',
2023-03-11 17:00:36 +08:00
path: '/article/:discussId',
2023-03-05 20:30:44 +08:00
component: () => import('../views/Article.vue')
},
{
name:'discuss',
2023-03-11 15:02:50 +08:00
path: '/discuss/:plateId',
2023-03-05 20:30:44 +08:00
component: () => import('../views/Discuss.vue')
},
2023-03-07 00:02:48 +08:00
{
2023-03-12 01:50:11 +08:00
//artTypediscuss主题、article文章
//operTypecreate创建、update更新
name:'editArt',
2023-03-12 19:49:08 +08:00
path:'/editArt',
2023-03-12 01:50:11 +08:00
component:()=>import('../views/EditArticle.vue')
2023-03-07 00:02:48 +08:00
}
2023-03-03 21:58:58 +08:00
]
2023-02-26 13:17:19 +08:00
},
2023-03-03 21:58:58 +08:00
{ path: '/:pathMatch(.*)*', name: 'NotFound', component: NotFound },
2023-02-26 13:17:19 +08:00
]
})
export default router