高敬炎 2 年 前
コミット
8b6beea1f6

+ 6 - 0
src/router/index.js

@@ -62,10 +62,16 @@ export const constantRoutes = [{
 
 let cofigRouter = []
 const modulesFiles = require.context('../views', true, /.js$/)
+console.log(1111111,modulesFiles)
 modulesFiles.keys().forEach((model_item, key) => {
         if (model_item === 'index.js' || modulesFiles(model_item).default === undefined || modulesFiles(model_item).default.path === undefined) return
         cofigRouter = cofigRouter.concat(modulesFiles(model_item).default)
     })
+    
+    cofigRouter=cofigRouter.sort(function(a,b){
+        return a.routesort - b.routesort
+    })
+    console.log(2222,cofigRouter)
     // 需要根据用户角色动态加载的路由
 export const asyncRoutes = cofigRouter
 const createRouter = () =>

+ 1 - 0
src/views/boundManagement/component/route.js

@@ -5,6 +5,7 @@ const outboundManagementRouter = {
     component: Layout,
     redirect: { name: 'outbound' },
     name: 'outbound',
+    routesort:1,
     alwaysShow: true, // will always show the root menu
     meta: {
         title: 'outbound',

+ 1 - 0
src/views/cost/component/route.js

@@ -5,6 +5,7 @@ const record = {
     component: Layout,
     redirect: { name: 'cost' },
     name: 'cost',
+    routesort:4,
     alwaysShow: true, // will always show the root menu
     meta: {
         title: '费用',

+ 1 - 0
src/views/customer/component/route.js

@@ -5,6 +5,7 @@ const record = {
     component: Layout,
     redirect: { name: 'customer' },
     name: '客户',
+    routesort:3,
     alwaysShow: true, // will always show the root menu
     meta: {
         title: '客户',

+ 1 - 0
src/views/record/component/route.js

@@ -5,6 +5,7 @@ const record = {
     component: Layout,
     redirect: { name: 'record' },
     name: 'record',
+    routesort:2,
     alwaysShow: true, // will always show the root menu
     meta: {
         title: '记录',

+ 1 - 0
src/views/setup/component/route.js

@@ -5,6 +5,7 @@ const setup = {
     component: Layout,
     redirect: { name: 'setup' },
     name: '设置',
+    routesort:6,
     alwaysShow: true, // will always show the root menu
     meta: {
       title: '设置',