Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
43 lines (31 sloc) 848 Bytes

Use multiple files in vue-router

// file -> /src/router.js

import Vue from 'vue'
import VueRouter from 'vue-router'
import Dashboard from '/modules/dashboard/routes.js'
import Users from '/modules/users/routes.js'
import Clients from '/modules/clients/routes.js'

const Router = new VueRouter()

const routes = Object.assign({}, Dashboard, Users, Clients)

//  --- alternative ---
const routes = [Dashboard, Users, Clients]{}, ...routes)

export default Router
// file -> /src/modules/clients/routes.js

import Main from './Main.vue'
import Detail from './Detail.vue'

export default {
  '/clients': {
    component: Main,
  '/clients/:id': {
    component: Detail,

Created by vinicius73 in 2016-08-12

You can’t perform that action at this time.