File tree Expand file tree Collapse file tree 3 files changed +49
-23
lines changed Expand file tree Collapse file tree 3 files changed +49
-23
lines changed Original file line number Diff line number Diff line change 44 <router-link v-if =' item.redirect==="noredirect"||index==levelList.length-1' to =" " class =" no-redirect" >{{item.name}}</router-link >
55 <router-link v-else :to =" item.path" >{{item.name}}</router-link >
66 </el-breadcrumb-item >
7- <router-link class =" view-tabs" v-for =" tag in Array.from(visitedViews)" :to =" tag.path" :key =" tag.path" >
8- <el-tag :closable =" true" @close =' closeViewTabs(tag,$event)' >
9- {{tag.name}}
10- </el-tag >
11- </router-link >
127 </el-breadcrumb >
138</template >
149
1510<script >
16-
1711 export default {
1812 created () {
1913 this .getBreadcrumb ()
2014 },
21- computed: {
22- visitedViews () {
23- return this .$store .state .app .visitedViews .slice (- 6 )
24- }
25- },
2615 data () {
2716 return {
2817 levelList: null
3625 matched = [{ name: ' 首页' , path: ' /' }].concat (matched)
3726 }
3827 this .levelList = matched;
39- },
40- closeViewTabs (view , $event ) {
41- this .$store .dispatch (' delVisitedViews' , view)
42- $event .preventDefault ()
43- },
44- addViewTabs () {
45- this .$store .dispatch (' addVisitedViews' , this .$route .matched [this .$route .matched .length - 1 ])
4628 }
4729 },
4830 watch: {
4931 $route () {
50- this .addViewTabs ();
5132 this .getBreadcrumb ();
5233 }
5334 }
6546 cursor :text ;
6647 }
6748 }
68- .view-tabs {
69- margin-left : 10px ;
70- }
7149 </style >
Original file line number Diff line number Diff line change 22 <el-menu class =" navbar" mode =" horizontal" >
33 <hamburger class =" hamburger-container" :toggleClick =" toggleSideBar" :isActive =" sidebar.opened" ></hamburger >
44 <levelbar ></levelbar >
5+ <tabs-view ></tabs-view >
56 <error-log v-if =" log.length>0" class =" errLog-container" :logsList =" log" ></error-log >
67 <screenfull class =' screenfull' ></screenfull >
78 <el-dropdown class =" avatar-container" trigger =" click" >
89 <div class =" avatar-wrapper" >
910 <img class =" user-avatar" :src =" avatar+'?imageView2/1/w/80/h/80'" >
10- <i class =" el-icon-caret-bottom" / >
11+ <i class =" el-icon-caret-bottom" ></ i >
1112 </div >
1213 <el-dropdown-menu class =" user-dropdown" slot =" dropdown" >
1314 <router-link class =' inlineBlock' to =" /" >
2930<script >
3031 import { mapGetters } from ' vuex' ;
3132 import Levelbar from ' ./Levelbar' ;
33+ import TabsView from ' ./TabsView' ;
3234 import Hamburger from ' components/Hamburger' ;
3335 import Screenfull from ' components/Screenfull' ;
3436 import ErrorLog from ' components/ErrLog' ;
3739 export default {
3840 components: {
3941 Levelbar,
42+ TabsView,
4043 Hamburger,
4144 ErrorLog,
4245 Screenfull
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =' tabs-view-container' >
3+ <router-link class =" tabs-view" v-for =" tag in Array.from(visitedViews)" :to =" tag.path" :key =" tag.path" >
4+ <el-tag :closable =" true" @close =' closeViewTabs(tag,$event)' >
5+ {{tag.name}}
6+ </el-tag >
7+ </router-link >
8+ </div >
9+ </template >
10+
11+ <script >
12+ export default {
13+ computed: {
14+ visitedViews () {
15+ return this .$store .state .app .visitedViews .slice (- 6 )
16+ }
17+ },
18+ methods: {
19+ closeViewTabs (view , $event ) {
20+ this .$store .dispatch (' delVisitedViews' , view)
21+ $event .preventDefault ()
22+ },
23+ addViewTabs () {
24+ this .$store .dispatch (' addVisitedViews' , this .$route .matched [this .$route .matched .length - 1 ])
25+ }
26+ },
27+ watch: {
28+ $route () {
29+ this .addViewTabs ()
30+ }
31+ }
32+ }
33+ </script >
34+
35+ <style rel="stylesheet/scss" lang="scss" scoped>
36+ .tabs-view-container {
37+ display : inline-block ;
38+ vertical-align : top ;
39+ margin-left : 10px ;
40+ .tabs-view {
41+ margin-left : 10px ;
42+ }
43+ }
44+
45+ </style >
You can’t perform that action at this time.
0 commit comments