mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-25 02:46:39 +08:00
vant搭建
This commit is contained in:
53
Yi.Vue3.x.Vant/src/router/index.ts
Normal file
53
Yi.Vue3.x.Vant/src/router/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { createWebHistory, createRouter } from 'vue-router';
|
||||
import Layout from '@/layout/index.vue';
|
||||
|
||||
export const constantRoutes = [
|
||||
{
|
||||
name:'Layout',
|
||||
path: '/',
|
||||
component: Layout,
|
||||
redirect:"/recommend",
|
||||
children: [
|
||||
{
|
||||
path: '/my',
|
||||
component: () => import('@/view/my.vue'),
|
||||
name: 'My',
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
path: '/main',
|
||||
component: () => import('@/layout/main/index.vue'),
|
||||
name: 'Main',
|
||||
children:[
|
||||
{
|
||||
path: '/recommend',
|
||||
component: () => import('@/view/main/recommend.vue'),
|
||||
name: 'Recommend',
|
||||
},
|
||||
{
|
||||
path: '/follow',
|
||||
component: () => import('@/view/main/follow.vue'),
|
||||
name: 'Follow',
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: constantRoutes,
|
||||
scrollBehavior(to, from, savedPosition) {
|
||||
if (savedPosition) {
|
||||
return savedPosition
|
||||
} else {
|
||||
return { top: 0 }
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user