You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
809 B
32 lines
809 B
// 引入必要的router组件 |
|
import {createRouter, createWebHistory} from 'vue-router' |
|
// 引入视图 |
|
const OptionsAPI = () => import('../views/OptionsAPIView.vue') |
|
const CompositionAPI = () => import('../views/CompositionAPIView.vue') |
|
|
|
// 引入组件 |
|
|
|
|
|
// 创建路由 |
|
const routes = [ |
|
{ |
|
path: '/options', |
|
name: 'options', |
|
component: OptionsAPI |
|
}, |
|
{ |
|
path: '/composition', |
|
name: 'composition', |
|
component: CompositionAPI |
|
}, |
|
] |
|
|
|
// 创建路由器,使用createRouter方法,传入history(路由类型)和 创建好的路由routes |
|
// 路由类型分为hash型和html5型,分别为createWebHashHistory和createWebHistory |
|
const router = createRouter({ |
|
history: createWebHistory(), |
|
routes |
|
}) |
|
|
|
// 导出路由 |
|
export default router
|
|
|