vant搭建

This commit is contained in:
橙子
2022-10-05 23:54:53 +08:00
parent db1f241c33
commit 70649653fb
26 changed files with 1497 additions and 1 deletions

View 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;