refine tab-views

This commit is contained in:
Pan 2017-07-14 17:37:47 +08:00 committed by 花裤衩
parent e3198fd47d
commit 6cb64bebdc
2 changed files with 4 additions and 2 deletions

View File

@ -1,6 +1,5 @@
import Cookies from 'js-cookie';
const app = {
state: {
sidebar: {

View File

@ -1,7 +1,7 @@
<template>
<div class='tabs-view-container'>
<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}}
</el-tag>
</router-link>
@ -29,6 +29,9 @@
},
addViewTabs() {
this.$store.dispatch('addVisitedViews', this.generateRoute())
},
isActive(path) {
return path === this.$route.path
}
},
watch: {