import { createRouter, createWebHistory } from 'vue-router' import Home from '../pages/Home.vue' import CourseDetail from '../pages/CourseDetail.vue' import MyLearning from '../pages/MyLearning.vue' import MyLearningHome from '../pages/MyLearningHome.vue' const routes = [ { path: '/', name: 'Home', component: Home, meta: { title: '首页' } }, { path: '/course/:id', name: 'CourseDetail', component: CourseDetail, meta: { title: 'route.courseDetail' } }, { path: '/my-learning', name: 'MyLearningHome', component: MyLearningHome, meta: { title: 'route.myLearning' }, children: [ { path: '', name: 'MyLearning', component: MyLearning, meta: { title: 'route.myLearning' } }, { path: '/my-learning/course/:id', name: 'MyLearningCourseDetail', component: CourseDetail, meta: { title: 'route.myLearningCourseDetail' } } ] } ] const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes }) export default router