// 引入必要的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