Created
March 13, 2017 16:25
-
-
Save mogocat/64764198085ac7e03989ca6bce97aa85 to your computer and use it in GitHub Desktop.
[vue-router]#tag:router,children
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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