From 9dcf6557cf8d437f12b927025a106918dfb991ac Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Sun, 28 Jun 2020 10:46:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20the=20problem=20of=20page=20not=20switch?= =?UTF-8?q?ing=20when=20closing=20the=20current=20tab;:bug:=20#82=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=85=B3=E9=97=AD=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E9=A1=B5=E7=AD=BE=E6=97=B6=E9=A1=B5=E9=9D=A2=E4=B8=8D=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/MenuView.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/layouts/MenuView.vue b/src/layouts/MenuView.vue index c2a2bef..9fa5f73 100644 --- a/src/layouts/MenuView.vue +++ b/src/layouts/MenuView.vue @@ -78,8 +78,8 @@ export default { }, methods: { changePage (key) { - this.$router.push(key) this.activePage = key + this.$router.push(key) }, editPage (key, action) { this[action](key) @@ -92,8 +92,11 @@ export default { this.pageList = this.pageList.filter(item => item.fullPath !== key) let index = this.linkList.indexOf(key) this.linkList = this.linkList.filter(item => item !== key) - index = index >= this.linkList.length ? this.linkList.length - 1 : index - this.activePage = this.linkList[index] + if (key == this.activePage) { + index = index >= this.linkList.length ? this.linkList.length - 1 : index + this.activePage = this.linkList[index] + this.$router.push(this.activePage) + } }, onContextmenu (e) { const pagekey = this.getPageKey(e.target)