@@ -43,7 +43,6 @@ export default {
4343 },
4444 methods: {
4545 onEdit (targetKey , action ) {
46- console .log (' onEdit' , targetKey, action)
4746 this [action](targetKey)
4847 },
4948 remove (targetKey ) {
@@ -60,30 +59,33 @@ export default {
6059
6160 // content menu
6261 closeThat (e ) {
63- console .log (' close that' , e)
6462 this .remove (e)
6563 },
6664 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+ })
7272 } else {
7373 this .$message .info (' 左侧没有标签' )
7474 }
7575 },
7676 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+ })
8184 } else {
8285 this .$message .info (' 右侧没有标签' )
8386 }
8487 },
8588 closeAll (e ) {
86- console .log (' close all' , e)
8789 const currentIndex = this .fullPathList .indexOf (e)
8890 this .fullPathList .forEach ((item , index ) => {
8991 if (index !== currentIndex) {
@@ -92,8 +94,6 @@ export default {
9294 })
9395 },
9496 closeMenuClick ({ key, item, domEvent }) {
95- console .log (' key' , key)
96- console .log (' item' , item .$attrs [' data-vkey' ])
9797 const vkey = domEvent .target .getAttribute (' data-vkey' )
9898 switch (key) {
9999 case ' close-right' :
@@ -141,7 +141,6 @@ export default {
141141 }
142142 },
143143 activeKey : function (newPathKey ) {
144- console .log (' activeKey' , newPathKey)
145144 this .$router .push ({ path: newPathKey })
146145 }
147146 },
0 commit comments