Browse Source

提取router

develop
燕鹏 4 years ago
parent
commit
1541e215ba
  1. 2
      src/app/main.js
  2. 21
      src/app/router.js
  3. 2
      src/index/main.js
  4. 21
      src/index/router.js
  5. 4
      src/router/index.js

2
src/app/main.js

@ -1,6 +1,6 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import router from '@/router'
import store from '@/store'
Vue.config.productionTip = false

21
src/app/router.js

@ -1,21 +0,0 @@
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/Home.vue'
import About from '@/views/About.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/about',
name: 'about',
component: About
}
]
})

2
src/index/main.js

@ -1,6 +1,6 @@
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import router from '@/router/'
import store from '@/store'
Vue.config.productionTip = false

21
src/index/router.js

@ -1,21 +0,0 @@
import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/views/Home.vue'
import About from '@/views/About.vue'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/about',
name: 'about',
component: About
}
]
})

4
src/router/router.js → src/router/index.js

@ -17,10 +17,10 @@ const routes = [
}
]
const router = new VueRouter({
const index = new VueRouter({
// mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
export default index
Loading…
Cancel
Save