@@ -43,7 +43,6 @@ export default {
43
43
},
44
44
methods: {
45
45
onEdit (targetKey , action ) {
46
- console .log (' onEdit' , targetKey, action)
47
46
this [action](targetKey)
48
47
},
49
48
remove (targetKey ) {
@@ -60,30 +59,33 @@ export default {
60
59
61
60
// content menu
62
61
closeThat (e ) {
63
- console .log (' close that' , e)
64
62
this .remove (e)
65
63
},
66
64
closeLeft (e ) {
67
- // TODO
68
- console .log (' close left' , e)
69
- const index = this .fullPathList .indexOf (e)
70
- if (index > 0 ) {
71
- this .remove (this .fullPathList [index - 1 ])
65
+ const currentIndex = this .fullPathList .indexOf (e)
66
+ if (currentIndex > 0 ) {
67
+ this .fullPathList .forEach ((item , index ) => {
68
+ if (index < currentIndex) {
69
+ this .remove (item)
70
+ }
71
+ })
72
72
} else {
73
73
this .$message .info (' 左侧没有标签' )
74
74
}
75
75
},
76
76
closeRight (e ) {
77
- console .log (' close right' , e)
78
- const index = this .fullPathList .indexOf (e)
79
- if (index < (this .fullPathList .length - 1 )) {
80
- this .remove (this .fullPathList [index + 1 ])
77
+ const currentIndex = this .fullPathList .indexOf (e)
78
+ if (currentIndex < (this .fullPathList .length - 1 )) {
79
+ this .fullPathList .forEach ((item , index ) => {
80
+ if (index > currentIndex) {
81
+ this .remove (item)
82
+ }
83
+ })
81
84
} else {
82
85
this .$message .info (' 右侧没有标签' )
83
86
}
84
87
},
85
88
closeAll (e ) {
86
- console .log (' close all' , e)
87
89
const currentIndex = this .fullPathList .indexOf (e)
88
90
this .fullPathList .forEach ((item , index ) => {
89
91
if (index !== currentIndex) {
@@ -92,8 +94,6 @@ export default {
92
94
})
93
95
},
94
96
closeMenuClick ({ key, item, domEvent }) {
95
- console .log (' key' , key)
96
- console .log (' item' , item .$attrs [' data-vkey' ])
97
97
const vkey = domEvent .target .getAttribute (' data-vkey' )
98
98
switch (key) {
99
99
case ' close-right' :
@@ -141,7 +141,6 @@ export default {
141
141
}
142
142
},
143
143
activeKey : function (newPathKey ) {
144
- console .log (' activeKey' , newPathKey)
145
144
this .$router .push ({ path: newPathKey })
146
145
}
147
146
},
0 commit comments