index.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. hidden: true
  56. },
  57. {
  58. path: 'productComment',
  59. name: 'productComment',
  60. component: () => import('@/views/pms/product/index'),
  61. meta: {title: '商品评价', icon: 'product-comment'},
  62. hidden: true
  63. },
  64. {
  65. path: 'productCate',
  66. name: 'productCate',
  67. component: () => import('@/views/pms/productCate/index'),
  68. meta: {title: '商品分类', icon: 'product-cate'}
  69. },
  70. {
  71. path: 'addProductCate',
  72. name: 'addProductCate',
  73. component: () => import('@/views/pms/productCate/add'),
  74. meta: {title: '添加商品分类'},
  75. hidden: true
  76. },
  77. {
  78. path: 'updateProductCate',
  79. name: 'updateProductCate',
  80. component: () => import('@/views/pms/productCate/update'),
  81. meta: {title: '修改商品分类'},
  82. hidden: true
  83. },
  84. {
  85. path: 'productAttr',
  86. name: 'productAttr',
  87. component: () => import('@/views/pms/productAttr/index'),
  88. meta: {title: '商品类型', icon: 'product-attr'}
  89. },
  90. {
  91. path: 'productAttrList',
  92. name: 'productAttrList',
  93. component: () => import('@/views/pms/productAttr/productAttrList'),
  94. meta: {title: '商品属性列表'},
  95. hidden: true
  96. },
  97. {
  98. path: 'addProductAttr',
  99. name: 'addProductAttr',
  100. component: () => import('@/views/pms/productAttr/addProductAttr'),
  101. meta: {title: '添加商品属性'},
  102. hidden: true
  103. },
  104. {
  105. path: 'updateProductAttr',
  106. name: 'updateProductAttr',
  107. component: () => import('@/views/pms/productAttr/updateProductAttr'),
  108. meta: {title: '修改商品属性'},
  109. hidden: true
  110. },
  111. {
  112. path: 'brand',
  113. name: 'brand',
  114. component: () => import('@/views/pms/brand/index'),
  115. meta: {title: '品牌管理', icon: 'product-brand'}
  116. },
  117. {
  118. path: 'addBrand',
  119. name: 'addBrand',
  120. component: () => import('@/views/pms/brand/add'),
  121. meta: {title: '添加品牌'},
  122. hidden: true
  123. },
  124. {
  125. path: 'updateBrand',
  126. name: 'updateBrand',
  127. component: () => import('@/views/pms/brand/update'),
  128. meta: {title: '编辑品牌'},
  129. hidden: true
  130. }
  131. ]
  132. },
  133. {path: '*', redirect: '/404', hidden: true}
  134. ]
  135. export default new Router({
  136. // mode: 'history', //后端支持可开
  137. scrollBehavior: () => ({y: 0}),
  138. routes: constantRouterMap
  139. })