[其他] 初始化项目结构
This commit is contained in:
20
docs/src/router/index.ts
Normal file
20
docs/src/router/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import {
|
||||
createMemoryHistory,
|
||||
createRouter as _createRouter,
|
||||
createWebHistory,
|
||||
Router,
|
||||
} from 'vue-router'
|
||||
import zhCN from './zh-CN'
|
||||
import type { IRouteRecordRaw } from '/@src/index'
|
||||
|
||||
const routes: IRouteRecordRaw[] = [...zhCN]
|
||||
|
||||
export function createRouter(): Router {
|
||||
const baseUrl = import.meta.env.BASE_URL
|
||||
return _createRouter({
|
||||
history: import.meta.env.SSR
|
||||
? createMemoryHistory(baseUrl)
|
||||
: createWebHistory(baseUrl),
|
||||
routes: routes
|
||||
})
|
||||
}
|
||||
32
docs/src/router/zh-CN.ts
Normal file
32
docs/src/router/zh-CN.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import BaseLayout from '../layouts/Layout.vue'
|
||||
|
||||
const zhCN = [
|
||||
{
|
||||
path: '/',
|
||||
redirect: '/zh-CN/guide/',
|
||||
component: BaseLayout,
|
||||
meta: { title: '指南', icon: 'el-icon-position' },
|
||||
children: [
|
||||
{
|
||||
path: '/zh-CN/guide/',
|
||||
component: () => import('../../docs/zh-CN/guide/home.md'),
|
||||
meta: { title: '介绍' },
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '/zh-CN/components/',
|
||||
redirect: '/zh-CN/components/button',
|
||||
component: BaseLayout,
|
||||
meta: { title: '组件', icon: 'el-icon-copy-document' },
|
||||
children: [
|
||||
{
|
||||
path: '/zh-CN/components/button',
|
||||
component: () => import('../../docs/zh-CN/components/button.md'),
|
||||
meta: { title: '按钮' },
|
||||
}
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
export default zhCN
|
||||
Reference in New Issue
Block a user