Commit 6cb64beb authored by Pan's avatar Pan Committed by 花裤衩

refine tab-views

parent e3198fd4
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
const app = { const app = {
state: { state: {
sidebar: { sidebar: {
......
<template> <template>
<div class='tabs-view-container'> <div class='tabs-view-container'>
<router-link class="tabs-view" v-for="tag in Array.from(visitedViews)" :to="tag.path" :key="tag.path"> <router-link class="tabs-view" v-for="tag in Array.from(visitedViews)" :to="tag.path" :key="tag.path">
<el-tag :closable="true" @close='closeViewTabs(tag,$event)'> <el-tag :closable="true" :type="isActive(tag.path)?'primary':''" @close='closeViewTabs(tag,$event)'>
{{tag.name}} {{tag.name}}
</el-tag> </el-tag>
</router-link> </router-link>
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
}, },
addViewTabs() { addViewTabs() {
this.$store.dispatch('addVisitedViews', this.generateRoute()) this.$store.dispatch('addVisitedViews', this.generateRoute())
},
isActive(path) {
return path === this.$route.path
} }
}, },
watch: { watch: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment