-
vue2.x结合vue-cli3项目结构搭建
-
项目中关于路由的灵活使用
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from "@/views/Home"
const exam = () => import('../views/exam')
const group = () => import('../views/group')
const interview = () => import('../views/interview')
const resume = () => import('../views/resume')
Vue.use(VueRouter)
const routes = [
{
path:"",
redirect : '/home'
},
{
path : '/home',
name : 'home',
component : Home,
},
{
path : '/exam',
name : 'exam',
component: exam
},
{
path : '/group',
name : 'group',
component: group
},
{
path: '/interview',
name : 'interview',
component: interview
},
{
path: '/resume',
name: 'resume',
component: resume
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router