From e23bafc75a9c48ede251affda9336ebf464f4196 Mon Sep 17 00:00:00 2001 From: "zhigang.li@tendcloud.com" Date: Thu, 1 Nov 2018 16:54:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A8=E6=80=81=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=92=8C=E5=B8=A6=E5=8F=82=E8=B7=AF=E7=94=B1=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=A4=9A=E4=B8=AA=E6=A0=87=E7=AD=BE=EF=BC=8C=E6=A0=87?= =?UTF-8?q?=E7=AD=BE=E6=BB=9A=E5=8A=A8=E6=80=BB=E6=98=AF=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=88=B0=E6=9C=80=E5=90=8E=E4=B8=80=E4=B8=AA=E5=90=8Cname?= =?UTF-8?q?=E6=A0=87=E7=AD=BE=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/main/components/tags-nav/tags-nav.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/main/components/tags-nav/tags-nav.vue b/src/components/main/components/tags-nav/tags-nav.vue index 53676a26f..2dbca44a9 100644 --- a/src/components/main/components/tags-nav/tags-nav.vue +++ b/src/components/main/components/tags-nav/tags-nav.vue @@ -33,6 +33,7 @@ ref="tagsPageOpened" :key="`tag-nav-${index}`" :name="item.name" + :data-route-item="item" @on-close="handleClose(item)" @click.native="handleClick(item)" :closable="item.name !== $config.homeName" @@ -159,11 +160,11 @@ export default { this.tagBodyLeft = -(tag.offsetLeft - (outerWidth - this.outerPadding - tag.offsetWidth)) } }, - getTagElementByName (name) { + getTagElementByName (route) { this.$nextTick(() => { this.refsTag = this.$refs.tagsPageOpened this.refsTag.forEach((item, index) => { - if (name === item.name) { + if (routeEqual(route, item.$attrs['data-route-item'])) { let tag = this.refsTag[index].$el this.moveToView(tag) } @@ -185,7 +186,7 @@ export default { }, watch: { '$route' (to) { - this.getTagElementByName(to.name) + this.getTagElementByName(to) }, visible (value) { if (value) { @@ -197,7 +198,7 @@ export default { }, mounted () { setTimeout(() => { - this.getTagElementByName(this.$route.name) + this.getTagElementByName(this.$route) }, 200) } }