懒加载页面的路由配置

import Vue from 'vue'
import Router from 'vue-router'
import goodsDetailOwn from '@/pages/goodsDetailOwn'
import goodsDetailAgent from '@/pages/goodsDetailAgent'
import home from '@/pages/home'
import goodsListOwn from '@/pages/goodsListOwn'
import goodsListAgent from '@/pages/goodsListAgent'
import makeOrderOwn from '@/pages/makeOrderOwn'
import makeOrderAgent from '@/pages/makeOrderAgent'
import orderListOwn from '@/pages/orderListOwn'
import cart from '@/pages/cart'
import logistics from '@/pages/logistics'
import about from '@/pages/about'
import orderDetailOwn from '@/pages/orderDetailOwn'
import orderDetailAgent from '@/pages/orderDetailAgent'
// import transOrderList from '@/pages/transOrderList'
// import transOrderDetail from '@/pages/transOrderDetail'
import orderListAgent from '@/pages/orderListAgent'
import agent from '@/pages/agent'
import agreement from '@/pages/agreement'
import test from '@/pages/test'

Vue.use(Router)

// const goodsDetailOwn = (resolve) => {
// import('@/pages/goodsDetailOwn').then((module) => {
// resolve(module)
// })
// }
// const goodsDetailAgent = (resolve) => {
// import('@/pages/goodsDetailAgent').then((module) => {
// resolve(module)
// })
// }
// const home = (resolve) => {
// import('@/pages/home').then((module) => {
// resolve(module)
// })
// }
// const goodsListOwn = (resolve) => {
// import('@/pages/goodsListOwn').then((module) => {
// resolve(module)
// })
// }
// const goodsListAgent = (resolve) => {
// import('@/pages/goodsListAgent').then((module) => {
// resolve(module)
// })
// }
// const makeOrderOwn = (resolve) => {
// import('@/pages/makeOrderOwn').then((module) => {
// resolve(module)
// })
// }

// const orderListOwn = (resolve) => {
// import('@/pages/orderListOwn').then((module) => {
// resolve(module)
// })
// }
// const cart = (resolve) => {
// import('@/pages/cart').then((module) => {
// resolve(module)
// })
// }
// const logistics = (resolve) => {
// import('@/pages/logistics').then((module) => {
// resolve(module)
// })
// }
// const about = (resolve) => {
// import('@/pages/about').then((module) => {
// resolve(module)
// })
// }
// const orderDetailOwn = (resolve) => {
// import('@/pages/orderDetailOwn').then((module) => {
// resolve(module)
// })
// }
// const orderDetailAgent = (resolve) => {
// import('@/pages/orderDetailAgent').then((module) => {
// resolve(module)
// })
// }
// const orderListAgent = (resolve) => {
// import('@/pages/orderListAgent').then((module) => {
// resolve(module)
// })
// }
// const agent = (resolve) => {
// import('@/pages/agent').then((module) => {
// resolve(module)
// })
// }

// const agreement = (resolve) => {
// import('@/pages/agreement').then((module) => {
// resolve(module)
// })
// }

// const makeOrderAgent = (resolve) => {
// import('@/pages/makeOrderAgent').then((module) => {
// resolve(module)
// })
// }

// const test = (resolve) => {
// import('@/pages/test').then((module) => {
// resolve(module)
// })
// }

export default new Router({
routes: [
{
path: '/home',
name: 'home',
component: home,
meta: {
title: 'home'
}
},
{
path: '/goodsDetailOwn/:goodId',
name: 'goodsDetailOwn',
component: goodsDetailOwn,
meta: {
title: '商品详情页'
}
},
{
path: '/makeOrderOwn',
name: 'makeOrderOwn',
component: makeOrderOwn,
meta: {
title: '商品下单'
}
},
{
path: '/orderDetailOwn/:orderId',
name: 'orderDetailOwn',
component: orderDetailOwn,
meta: {
title: 'รายละเอียดการสั่งซื้อ'
}
},
{
path: '/orderDetailAgent/:orderId',
name: 'orderDetailAgent',
component: orderDetailAgent,
meta: {
title: 'รายละเอียดการสั่งซื้อ'
}
},
{
path: '/cart',
name: 'cart',
component: cart,
meta: {
title: '购物车'
}
},
{
path: '/logistics/:orderId',
name: 'logistics',
component: logistics,
meta: {
title: 'รายละเอียดการสั่งซื้อ'
}
},
{
path: '/about',
name: 'about',
component: about,
meta: {
title: 'รายละเอียดการสั่งซื้อ'
}
},
{
path: '/orderListOwn',
name: 'orderListOwn',
component: orderListOwn,
meta: {
title: 'เพิ่มที่อยู่จัดส่ง'
}
},
// {
// path: '/transOrderList',
// name: 'transOrderList',
// component: transOrderList,
// beforeRouteUpdate: () => {
// document.title = 'เพิ่มที่อยู่จัดส่ง'
// }
// },
// {
// path: '/transOrderDetail',
// name: 'transOrderDetail',
// component: transOrderDetail,
// beforeRouteUpdate: () => {
// document.title = 'เพิ่มที่อยู่จัดส่ง'
// }
// },
{
path: '/goodsListOwn',
name: 'goodsListOwn',
component: goodsListOwn,
meta: {
title: 'รายชื่อผลิตภัณฑ์'
}
},
{
path: '/orderListAgent',
name: 'orderListAgent',
component: orderListAgent,
meta: {
title: 'เพิ่มที่อยู่จัดส่ง'
}
},
{
path: '/agent',
name: 'agent',
component: agent,
meta: {
title: 'เพิ่มที่อยู่จัดส่ง'
}
},
{
path: '/agreement',
name: 'agreement',
component: agreement,
meta: {
title: 'T&C'
}
},
{
path: '/makeOrderAgent',
name: 'makeOrderAgent',
component: makeOrderAgent,
meta: {
title: '商品下单'
}
},
{
path: '/goodsListAgent',
name: 'goodsListAgent',
component: goodsListAgent
},
{
path: '/goodsDetailAgent/:goodId',
name: 'goodsDetailAgent',
component: goodsDetailAgent,
meta: {
title: '商品详情页'
}
},
{
path: '/test',
name: 'test',
component: test,
meta: {
title: '测试页面'
}
}
]
})

posted @ 2018-03-21 14:53  沙滩多啦图  阅读(412)  评论(0编辑  收藏  举报