mirror of
https://github.com/talktao/Vue3-Vite-Vant-TS-H5.git
synced 2025-04-27 20:29:02 +08:00
init:路由初始化
This commit is contained in:
parent
1d76ebe1a9
commit
47da340996
53
src/router/index.ts
Normal file
53
src/router/index.ts
Normal 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
|
Loading…
x
Reference in New Issue
Block a user