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'; import Cookies from 'js-cookie';
const app = { const app = {
state: { state: {
sidebar: { sidebar: {

View File

@ -1,7 +1,7 @@
<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 @@
}, },
addViewTabs() { addViewTabs() {
this.$store.dispatch('addVisitedViews', this.generateRoute()) this.$store.dispatch('addVisitedViews', this.generateRoute())
},
isActive(path) {
return path === this.$route.path
} }
}, },
watch: { watch: {