Skip to content

Instantly share code, notes, and snippets.

@mogocat
Created March 13, 2017 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mogocat/64764198085ac7e03989ca6bce97aa85 to your computer and use it in GitHub Desktop.
Save mogocat/64764198085ac7e03989ca6bce97aa85 to your computer and use it in GitHub Desktop.
[vue-router]#tag:router,children
import Vue from 'vue'
import Router from 'vue-router'
import CategoryForm from '@/pages/category/form'
import CategoryTree from '@/pages/category/tree'
import AccessoryIndex from '@/pages/accessory/index'
import BusinessIndex from '@/pages/business/index'
import BusinessForm from '@/pages/business/form'
import StockIndex from '@/pages/stock/index'
import ContactIndex from '@/pages/contact/index'
Vue.use(Router)
const Parent = {
template: `<router-view></router-view>`
}
export default new Router({
routes: [
{path: '/accessory', components: {left: { render: h => h(CategoryTree)}, right: { render: h => h(AccessoryIndex)}}},
// {path: '/buy/edit/:id', components: {main: {render: h => h(BusinessForm)}}},
{path: '/buy', name: 'buy', components: {main: {render: h => h(Parent)}},
children: [
{path: '', component: BusinessIndex},
{path: 'edit/:id', component: BusinessForm}
]},
{path: '/sell', name: 'sell', components: {main: {render: h => h(Parent)}},
children: [
{path: '', component: BusinessIndex},
{path: 'edit/:id', component: BusinessForm}
]},
{path: '/stock', components: {left: { render: h => h(CategoryTree)}, right: { render: h => h(StockIndex)}}},
{path: '/contact', components: {main: {render: h => h(ContactIndex)}}},
{ path: '/category/update', components: {left: { render: h => h(CategoryTree)}, right: { render: h => h(CategoryForm)}}}
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment