header v-permission

This commit is contained in:
Captain.B 2020-02-21 09:43:28 +08:00
parent c715ebd481
commit 6015af2029
1 changed files with 10 additions and 5 deletions

View File

@ -7,8 +7,13 @@
:default-active="activeIndex" :default-active="activeIndex"
@select="handleSelect" @select="handleSelect"
router> router>
<el-menu-item index="1">功能测试</el-menu-item> <el-menu-item index="1" v-permission="['test_manager','test_user','test_viewer']">
<el-menu-item index="/createTest" onselectstart="return false">性能测试</el-menu-item> 功能测试
</el-menu-item>
<el-menu-item index="/createTest" onselectstart="return false"
v-permission="['test_manager','test_user','test_viewer']">
性能测试
</el-menu-item>
<el-menu-item index="/setting" onselectstart="return false">系统设置</el-menu-item> <el-menu-item index="/setting" onselectstart="return false">系统设置</el-menu-item>
</el-menu> </el-menu>
</template> </template>
@ -22,15 +27,15 @@
} }
}, },
watch: { watch: {
'$route' () { '$route'() {
this.handleSelect(this.activeIndex); this.handleSelect(this.activeIndex);
} }
}, },
mounted () { mounted() {
this.activeIndex = this.$route.matched[0].path || '/' this.activeIndex = this.$route.matched[0].path || '/'
}, },
methods: { methods: {
handleSelect (index) { handleSelect(index) {
this.activeIndex = index this.activeIndex = index
} }
} }