Skip to content
Snippets Groups Projects
Commit 3cb1e321 authored by Pan's avatar Pan
Browse files

refactor:change tabs-view to tags-view

parent f2fcdee8
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<sidebar class="sidebar-container"></sidebar> <sidebar class="sidebar-container"></sidebar>
<div class="main-container"> <div class="main-container">
<navbar></navbar> <navbar></navbar>
<tabs-view></tabs-view> <tags-view></tags-view>
<app-main></app-main> <app-main></app-main>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { Navbar, Sidebar, AppMain, TabsView } from 'views/layout/components' import { Navbar, Sidebar, AppMain, TagsView } from 'views/layout/components'
export default { export default {
name: 'layout', name: 'layout',
...@@ -18,7 +18,7 @@ export default { ...@@ -18,7 +18,7 @@ export default {
Navbar, Navbar,
Sidebar, Sidebar,
AppMain, AppMain,
TabsView TagsView
}, },
computed: { computed: {
sidebar() { sidebar() {
......
<template> <template>
<scroll-pane class='tabs-view-container'> <scroll-pane class='tags-view-container'>
<router-link class="tabs-view-item" :class="isActive(tag)?'active':''" v-for="tag in Array.from(visitedViews)" :to="tag.path":key="tag.path"> <router-link class="tags-view-item" :class="isActive(tag)?'active':''" v-for="tag in Array.from(visitedViews)" :to="tag.path":key="tag.path">
{{$t('route.'+tag.title)}} {{$t('route.'+tag.title)}}
<span class='el-icon-close' @click='closeViewTabs(tag,$event)'></span> <span class='el-icon-close' @click='closeViewTags(tag,$event)'></span>
</router-link> </router-link>
</scroll-pane> </scroll-pane>
</template> </template>
...@@ -18,10 +18,10 @@ export default { ...@@ -18,10 +18,10 @@ export default {
} }
}, },
mounted() { mounted() {
this.addViewTabs() this.addViewTags()
}, },
methods: { methods: {
closeViewTabs(view, $event) { closeViewTags(view, $event) {
this.$store.dispatch('delVisitedViews', view).then((views) => { this.$store.dispatch('delVisitedViews', view).then((views) => {
if (this.isActive(view.path)) { if (this.isActive(view.path)) {
const latestView = views.slice(-1)[0] const latestView = views.slice(-1)[0]
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
} }
return false return false
}, },
addViewTabs() { addViewTags() {
const route = this.generateRoute() const route = this.generateRoute()
if (!route) { if (!route) {
return false return false
...@@ -54,19 +54,19 @@ export default { ...@@ -54,19 +54,19 @@ export default {
}, },
watch: { watch: {
$route() { $route() {
this.addViewTabs() this.addViewTags()
} }
} }
} }
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.tabs-view-container { .tags-view-container {
background: #fff; background: #fff;
height: 34px; height: 34px;
border-bottom: 1px solid #d8dce5; border-bottom: 1px solid #d8dce5;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04); box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
.tabs-view-item { .tags-view-item {
display: inline-block; display: inline-block;
position: relative; position: relative;
height: 26px; height: 26px;
...@@ -105,8 +105,8 @@ export default { ...@@ -105,8 +105,8 @@ export default {
</style> </style>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
.tabs-view-container { .tags-view-container {
.tabs-view-item { .tags-view-item {
.el-icon-close { .el-icon-close {
width: 16px; width: 16px;
height: 16px; height: 16px;
......
export { default as Navbar } from './Navbar' export { default as Navbar } from './Navbar'
export { default as Sidebar } from './Sidebar/index.vue' export { default as Sidebar } from './Sidebar/index.vue'
export { default as TabsView } from './TabsView' export { default as TagsView } from './TagsView'
export { default as AppMain } from './AppMain' export { default as AppMain } from './AppMain'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment