Browse Source

fix: page redirect

Sendya 5 years ago
parent
commit
e1fd046654

+ 2 - 2
src/components/MultiTab/MultiTab.vue

@@ -20,10 +20,10 @@ export default {
       this.activeKey = val
     }).$on('close', val => {
       if (!val) {
-        this.remove(this.activeKey)
+        this.closeThat(this.activeKey)
         return
       }
-      this.remove(val)
+      this.closeThat(val)
     })
 
     this.pages.push(this.$route)

+ 12 - 1
src/mock/services/user.js

@@ -381,7 +381,8 @@ const userNav = (options) => {
         'title': '仪表盘',
         'show': true
       },
-      'component': 'RouteView'
+      'component': 'RouteView',
+      'redirect': '/dashboard/workplace'
     },
     {
       'name': 'analysis',
@@ -413,6 +414,16 @@ const userNav = (options) => {
       },
       'component': 'Workplace'
     },
+    {
+      'name': 'tests',
+      'parentId': 1,
+      'id': 8,
+      'meta': {
+        'title': '测试功能',
+        'show': true
+      },
+      'component': 'TestWork'
+    },
     {
       'name': 'permission',
       'parentId': 10,

+ 2 - 1
src/router/generator-routers.js

@@ -16,7 +16,8 @@ const constantRouterComponents = {
 
   // 你需要动态引入的页面组件
   'Analysis': () => import('@/views/dashboard/Analysis'),
-  'Workplace': () => import('@/views/dashboard/Workplace')
+  'Workplace': () => import('@/views/dashboard/Workplace'),
+  'TestWork': () => import('@/views/dashboard/TestWork')
 }
 
 // 前端未找到页面路由(固定不用改)

+ 30 - 0
src/views/dashboard/TestWork.vue

@@ -0,0 +1,30 @@
+<template>
+  <div>
+    <h2>本页面内容均为测试功能,暂不提供稳定性保证</h2>
+    <a-divider />
+    <div class="multi-tab-test">
+      <h4>多标签组件测试功能</h4>
+      <a-button @click="handleCloseCurrentTab" style="margin-right: 16px;">关闭当前页</a-button>
+      <a-button @click="handleOpenTab">打开 任务列表</a-button>
+    </div>
+    <a-divider />
+  </div>
+</template>
+
+<script>
+export default {
+  name: 'TestWork',
+  methods: {
+    handleCloseCurrentTab () {
+      this.$multiTab.close()
+    },
+    handleOpenTab () {
+      this.$multiTab.open('/features/task')
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>