42 行
860 B
JavaScript
42 行
860 B
JavaScript
import Vue from 'vue'
|
|
import VueRouter from 'vue-router'
|
|
import Home from '../views/Home.vue'
|
|
import Textbook from "@/views/Textbook"
|
|
import Section from "@/views/Section"
|
|
import Exercise from "@/views/Exercise"
|
|
|
|
Vue.use(VueRouter)
|
|
|
|
const routes = [
|
|
{
|
|
path: '/',
|
|
name: 'home',
|
|
component: Home
|
|
},
|
|
{
|
|
path: '/textbook/:textbook?',
|
|
name: 'textbook',
|
|
component: Textbook,
|
|
props: true
|
|
},
|
|
{
|
|
path: '/textbook/:textbook/section/:section',
|
|
name: 'section',
|
|
component: Section,
|
|
props: true
|
|
},
|
|
{
|
|
path: '/textbook/:textbook/section/:section/exercise/:exercise',
|
|
name: 'exercise',
|
|
component: Exercise,
|
|
props: true
|
|
}
|
|
]
|
|
|
|
const router = new VueRouter({
|
|
mode: "history",
|
|
routes: [...routes],
|
|
})
|
|
|
|
export default router
|