index.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import Vue from 'vue'
  2. import Router from 'vue-router'
  3. Vue.use(Router)
  4. /* Layout */
  5. import Layout from '../views/layout/Layout'
  6. /**
  7. * hidden: true if `hidden:true` will not show in the sidebar(default is false)
  8. * alwaysShow: true if set true, will always show the root menu, whatever its child routes length
  9. * if not set alwaysShow, only more than one route under the children
  10. * it will becomes nested mode, otherwise not show the root menu
  11. * redirect: noredirect if `redirect:noredirect` will no redirct in the breadcrumb
  12. * name:'router-name' the name is used by <keep-alive> (must set!!!)
  13. * meta : {
  14. title: 'title' the name show in submenu and breadcrumb (recommend set)
  15. icon: 'svg-name' the icon show in the sidebar,
  16. }
  17. **/
  18. export const constantRouterMap = [
  19. {path: '/login', component: () => import('@/views/login/index'), hidden: true},
  20. {path: '/404', component: () => import('@/views/404'), hidden: true},
  21. {
  22. path: '',
  23. component: Layout,
  24. redirect: '/home',
  25. children: [{
  26. path: 'home',
  27. name: 'home',
  28. component: () => import('@/views/home/index'),
  29. meta: {title: '首页', icon: 'home'}
  30. }]
  31. },
  32. {
  33. path: '/pms',
  34. component: Layout,
  35. redirect: '/pms/product',
  36. name: 'pms',
  37. meta: {title: '商品', icon: 'product'},
  38. children: [{
  39. path: 'product',
  40. name: 'product',
  41. component: () => import('@/views/pms/product/index'),
  42. meta: {title: '商品列表', icon: 'product-list'}
  43. },
  44. {
  45. path: 'addProduct',
  46. name: 'addProduct',
  47. component: () => import('@/views/pms/product/add'),
  48. meta: {title: '添加商品', icon: 'product-add'}
  49. },
  50. {
  51. path: 'productRecycle',
  52. name: 'productRecycle',
  53. component: () => import('@/views/pms/product/index'),
  54. meta: {title: '商品回收站', icon: 'product-recycle'}
  55. },
  56. {
  57. path: 'productComment',
  58. name: 'productComment',
  59. component: () => import('@/views/pms/product/index'),
  60. meta: {title: '商品评价', icon: 'product-comment'}
  61. },
  62. {
  63. path: 'productCate',
  64. name: 'productCate',
  65. component: () => import('@/views/pms/productCate/index'),
  66. meta: {title: '商品分类', icon: 'product-cate'}
  67. },
  68. {
  69. path: 'addProductCate',
  70. name: 'addProductCate',
  71. component: () => import('@/views/pms/productCate/add'),
  72. meta: {title: '添加商品分类'},
  73. hidden:true
  74. },
  75. {
  76. path: 'updateProductCate',
  77. name: 'updateProductCate',
  78. component: () => import('@/views/pms/productCate/update'),
  79. meta: {title: '修改商品分类'},
  80. hidden:true
  81. },
  82. {
  83. path: 'productAttr',
  84. name: 'productAttr',
  85. component: () => import('@/views/pms/productAttr/index'),
  86. meta: {title: '商品类型', icon: 'product-attr'}
  87. },
  88. {
  89. path: 'productAttrList',
  90. name: 'productAttrList',
  91. component: () => import('@/views/pms/productAttr/productAttrList'),
  92. meta: {title: '商品属性列表'},
  93. hidden:true
  94. },
  95. {
  96. path: 'addProductAttr',
  97. name: 'addProductAttr',
  98. component: () => import('@/views/pms/productAttr/addProductAttr'),
  99. meta: {title: '添加商品属性'},
  100. hidden:true
  101. },
  102. {
  103. path: 'updateProductAttr',
  104. name: 'updateProductAttr',
  105. component: () => import('@/views/pms/productAttr/updateProductAttr'),
  106. meta: {title: '修改商品属性'},
  107. hidden:true
  108. },
  109. {
  110. path: 'brand',
  111. name: 'brand',
  112. component: () => import('@/views/pms/brand/index'),
  113. meta: {title: '品牌管理', icon: 'product-brand'}
  114. },
  115. {
  116. path: 'addBrand',
  117. name: 'addBrand',
  118. component: () => import('@/views/pms/brand/add'),
  119. meta: {title: '添加品牌'},
  120. hidden:true
  121. },
  122. {
  123. path: 'updateBrand',
  124. name: 'updateBrand',
  125. component: () => import('@/views/pms/brand/update'),
  126. meta: {title: '编辑品牌'},
  127. hidden:true
  128. }
  129. ]
  130. },
  131. {path: '*', redirect: '/404', hidden: true}
  132. ]
  133. export default new Router({
  134. // mode: 'history', //后端支持可开
  135. scrollBehavior: () => ({y: 0}),
  136. routes: constantRouterMap
  137. })