修改菜单栏激活

This commit is contained in:
shiziyuan9527 2020-05-06 17:19:48 +08:00
parent 52ead84a20
commit 04cdf5ac06
1 changed files with 33 additions and 35 deletions

View File

@ -1,6 +1,5 @@
<template> <template>
<div id="menu-bar">
<div id="menu-bar" v-if="isRouterAlive">
<el-row type="flex"> <el-row type="flex">
<el-col :span="8"> <el-col :span="8">
<el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'> <el-menu class="header-menu" :unique-opened="true" mode="horizontal" router :default-active='$route.path'>
@ -24,8 +23,8 @@
<el-divider/> <el-divider/>
<ms-show-all :index="'/performance/test/all'"/> <ms-show-all :index="'/performance/test/all'"/>
<ms-create-button :index="'/performance/test/create'" :title="$t('load_test.create')"/> <ms-create-button :index="'/performance/test/create'" :title="$t('load_test.create')"/>
<el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item> <!-- <el-menu-item :index="testCaseProjectPath" class="blank_item"></el-menu-item>-->
<el-menu-item :index="testEditPath" class="blank_item"></el-menu-item> <!-- <el-menu-item :index="testEditPath" class="blank_item"></el-menu-item>-->
</el-submenu> </el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser" <el-submenu v-if="isCurrentWorkspaceUser"
@ -45,7 +44,6 @@
<el-col :span="8"/> <el-col :span="8"/>
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script>
@ -67,10 +65,10 @@
data() { data() {
return { return {
isCurrentWorkspaceUser: false, isCurrentWorkspaceUser: false,
testCaseProjectPath: '', // testCaseProjectPath: '',
testEditPath: '', // testEditPath: '',
reportViewPath: '', // reportViewPath: '',
isRouterAlive: true, // isRouterAlive: true,
projectRecent: { projectRecent: {
title: this.$t('project.recent'), title: this.$t('project.recent'),
url: "/project/recent/5", url: "/project/recent/5",
@ -104,32 +102,32 @@
mounted() { mounted() {
this.isCurrentWorkspaceUser = checkoutCurrentWorkspace(); this.isCurrentWorkspaceUser = checkoutCurrentWorkspace();
}, },
watch: { // watch: {
'$route'(to, from) { // '$route'(to, from) {
let path = to.path; // let path = to.path;
// // //
if (path.indexOf("/performance/test/") >= 0) { // if (path.indexOf("/performance/test/") >= 0) {
this.testCaseProjectPath = '/performance/test/' + this.$route.params.projectId; // this.testCaseProjectPath = '/performance/test/' + this.$route.params.projectId;
this.reload(); // this.reload();
} // }
if (path.indexOf("/performance/test/edit/") >= 0) { // if (path.indexOf("/performance/test/edit/") >= 0) {
this.testEditPath = '/performance/test/edit/' + this.$route.params.testId; // this.testEditPath = '/performance/test/edit/' + this.$route.params.testId;
this.reload(); // this.reload();
} // }
if (path.indexOf("/performance/report/view/") >= 0) { // if (path.indexOf("/performance/report/view/") >= 0) {
this.reportViewPath = '/performance/report/view/' + this.$route.params.reportId; // this.reportViewPath = '/performance/report/view/' + this.$route.params.reportId;
this.reload(); // this.reload();
} // }
} // }
}, // },
methods: { // methods: {
reload() { // reload() {
this.isRouterAlive = false; // this.isRouterAlive = false;
this.$nextTick(function () { // this.$nextTick(function () {
this.isRouterAlive = true; // this.isRouterAlive = true;
}) // })
} // }
} // }
} }
</script> </script>