init:路由初始化

This commit is contained in:
talktao 2022-03-18 22:27:51 +08:00
parent 1d76ebe1a9
commit 47da340996

53
src/router/index.ts Normal file
View File

@ -0,0 +1,53 @@
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
const routes: Array<RouteRecordRaw> = [
{
path: '/',
name: 'Index',
component: () => import ('@/layout/index.vue'),
redirect: '/home',
meta: {
title: '首页',
keepAlive:false
},
children: [
{
path: '/home',
name: 'Home',
component: () => import('@/views/home/Home.vue')
},
{
path: '/category',
name: 'Category',
component: () => import('@/views/category/Category.vue')
},
{
path: '/welfare',
name: 'Welfare',
component: () => import('@/views/welfare/Welfare.vue')
},
{
path: '/orders',
name: 'Orders',
component: () => import('@/views/orders/Orders.vue')
},
{
path: '/about',
name: 'About',
component: () => import('@/views/about/About.vue')
},
{
path: '/detail/:id',
name: 'Detail',
component: () => import('@/views/Detail.vue')
}
]
},
]
const router = createRouter({
history: createWebHashHistory(),
routes,
});
export default router