From 64b942280e326a3cad8f1ff4bc0cf03252a8ca60 Mon Sep 17 00:00:00 2001 From: sc Date: Fri, 30 Jul 2021 11:13:40 +0800 Subject: [PATCH] =?UTF-8?q?FIX=20=E8=B7=AF=E7=94=B1query=E4=BC=A0=E5=8F=82?= =?UTF-8?q?=E5=90=84=E7=B1=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/tags.vue | 20 ++++++++++++-------- src/store/modules/viewTags.js | 14 +++++++++++--- src/views/template/list/index.vue | 5 ++++- src/views/template/list/save.vue | 13 +++++-------- 4 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/layout/components/tags.vue b/src/layout/components/tags.vue index 38cc6b8b..f6755119 100644 --- a/src/layout/components/tags.vue +++ b/src/layout/components/tags.vue @@ -67,7 +67,9 @@ } }, created() { - this.addViewTags(this.$router.options.routes[0].children[0].children[0]); + const dashboardRoute = this.$router.options.routes[0].children[0].children[0] + dashboardRoute.fullPath = dashboardRoute.path + this.addViewTags(dashboardRoute); this.addViewTags(this.$route); }, mounted() { @@ -92,7 +94,7 @@ }, //高亮tag isActive(route) { - return route.path === this.$route.path + return route.fullPath === this.$route.fullPath }, //关闭tag closeSelectedTag(tag) { @@ -114,7 +116,7 @@ this.contextMenuVisible = true; this.left = e.clientX + 1; this.top = e.clientY + 1; - + //FIX 右键菜单边缘化位置处理 this.$nextTick(() => { let sp = document.getElementById("contextmenu"); @@ -134,9 +136,10 @@ var nowTag = this.contextMenuItem; this.contextMenuVisible = false //判断是否当前路由,否的话跳转 - if(this.$route.path != nowTag.path){ + if(this.$route.fullPath != nowTag.fullPath){ this.$router.push({ - path: nowTag.path + path: nowTag.fullPath, + query: nowTag.query }) } this.$store.commit("refreshIframe", nowTag) @@ -163,7 +166,7 @@ var nowTag = this.contextMenuItem; var tags = [...this.tagList]; tags.forEach(tag => { - if(tag.meta&&tag.meta.affix || nowTag.path==tag.path){ + if(tag.meta&&tag.meta.affix || nowTag.fullPath==tag.fullPath){ return true }else{ this.closeSelectedTag(tag) @@ -176,9 +179,10 @@ var nowTag = this.contextMenuItem; this.contextMenuVisible = false //判断是否当前路由,否的话跳转 - if(this.$route.path != nowTag.path){ + if(this.$route.fullPath != nowTag.fullPath){ this.$router.push({ - path: nowTag.path + path: nowTag.fullPath, + query: nowTag.query }) } var element = document.getElementById('adminui-main') diff --git a/src/store/modules/viewTags.js b/src/store/modules/viewTags.js index 56d70601..8dd7aef9 100644 --- a/src/store/modules/viewTags.js +++ b/src/store/modules/viewTags.js @@ -4,7 +4,7 @@ export default { }, mutations: { pushViewTags(state, route){ - let target = state.viewTags.find((item) => item.path === route.path) + let target = state.viewTags.find((item) => item.fullPath === route.fullPath) let isName = route.name if(!target && isName){ state.viewTags.push(route) @@ -12,18 +12,26 @@ export default { }, removeViewTags(state, route){ state.viewTags.forEach((item, index) => { - if (item.path === route.path){ + if (item.fullPath === route.fullPath){ state.viewTags.splice(index, 1) } }) }, updateViewTags(state, route){ state.viewTags.forEach((item) => { - if (item.path == route.path){ + if (item.fullPath == route.fullPath){ item = Object.assign(item, route) } }) }, + updateViewTagsTitle(state, title='', fullPath){ + const nowFullPath = fullPath || location.hash.substring(1) + state.viewTags.forEach((item) => { + if (item.fullPath == nowFullPath){ + item.meta.title = title + } + }) + }, clearViewTags(state){ state.viewTags = [] } diff --git a/src/views/template/list/index.vue b/src/views/template/list/index.vue index 7bf85045..6793955f 100644 --- a/src/views/template/list/index.vue +++ b/src/views/template/list/index.vue @@ -209,7 +209,10 @@ }, table_edit(row){ this.$router.push({ - path: `/template/list/save/${row.id}` + path: `/template/list/save`, + query: { + id: row.id + } }); }, filterHandler(value, row, column){ diff --git a/src/views/template/list/save.vue b/src/views/template/list/save.vue index c53fdfab..34c244b2 100644 --- a/src/views/template/list/save.vue +++ b/src/views/template/list/save.vue @@ -8,7 +8,7 @@ -->