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 4
4
<router-link v-if =' item.redirect==="noredirect"||index==levelList.length-1' to =" " class =" no-redirect" >{{item.name}}</router-link >
5
5
<router-link v-else :to =" item.path" >{{item.name}}</router-link >
6
6
</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 >
12
7
</el-breadcrumb >
13
8
</template >
14
9
15
10
<script >
16
-
17
11
export default {
18
12
created () {
19
13
this .getBreadcrumb ()
20
14
},
21
- computed: {
22
- visitedViews () {
23
- return this .$store .state .app .visitedViews .slice (- 6 )
24
- }
25
- },
26
15
data () {
27
16
return {
28
17
levelList: null
36
25
matched = [{ name: ' 首页' , path: ' /' }].concat (matched)
37
26
}
38
27
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 ])
46
28
}
47
29
},
48
30
watch: {
49
31
$route () {
50
- this .addViewTabs ();
51
32
this .getBreadcrumb ();
52
33
}
53
34
}
65
46
cursor :text ;
66
47
}
67
48
}
68
- .view-tabs {
69
- margin-left : 10px ;
70
- }
71
49
</style >
Original file line number Diff line number Diff line change 2
2
<el-menu class =" navbar" mode =" horizontal" >
3
3
<hamburger class =" hamburger-container" :toggleClick =" toggleSideBar" :isActive =" sidebar.opened" ></hamburger >
4
4
<levelbar ></levelbar >
5
+ <tabs-view ></tabs-view >
5
6
<error-log v-if =" log.length>0" class =" errLog-container" :logsList =" log" ></error-log >
6
7
<screenfull class =' screenfull' ></screenfull >
7
8
<el-dropdown class =" avatar-container" trigger =" click" >
8
9
<div class =" avatar-wrapper" >
9
10
<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 >
11
12
</div >
12
13
<el-dropdown-menu class =" user-dropdown" slot =" dropdown" >
13
14
<router-link class =' inlineBlock' to =" /" >
29
30
<script >
30
31
import { mapGetters } from ' vuex' ;
31
32
import Levelbar from ' ./Levelbar' ;
33
+ import TabsView from ' ./TabsView' ;
32
34
import Hamburger from ' components/Hamburger' ;
33
35
import Screenfull from ' components/Screenfull' ;
34
36
import ErrorLog from ' components/ErrLog' ;
37
39
export default {
38
40
components: {
39
41
Levelbar,
42
+ TabsView,
40
43
Hamburger,
41
44
ErrorLog,
42
45
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