import Vue from 'vue' ; import VueRouter from 'vue-router' ; import Dashboard from '../view/dashboard/index.vue' ; import ArticleList from '../view/list/index.vue' ; Vue . use ( VueRouter ) ; export default function createRouter ( ) { return new VueRouter ( { mode : 'history' , base : '/admin/' , routes : [ { path : '/' , component : Dashboard } , { path : '/article/list' , component : ArticleList } , { path : '/article/add' , component : ( ) => import ( '../view/write/index.vue' ) } , { path : '/article/edit/:id' , component : ( ) => import ( '../view/write/index.vue' ) } , { path : '/article/detail/:id' , component : ( ) => import ( '../view/detail/index.vue' ) } , { path : '*' , component : ( ) => import ( '../view/notfound/index.vue' ) } ] } ) ; }