From 107e08c08ebb19cc6986602df6e168b5a5ad6069 Mon Sep 17 00:00:00 2001 From: iczer <1126263215@qq.com> Date: Fri, 10 Jul 2020 19:09:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20issue=20of=20contextmenu=20in=20TabsView?= =?UTF-8?q?=20component;=20:bug:=20=E4=BF=AE=E5=A4=8D=EF=BC=9ATabsView=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95=E7=9A=84?= =?UTF-8?q?bug;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/config.js | 5 +++-- src/layouts/TabsView.vue | 21 ++++++++++++--------- src/pages/dashboard/analysis/Analysis.vue | 4 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/config/config.js b/src/config/config.js index d985f96..39b6fab 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -4,8 +4,9 @@ module.exports = { color: '#13c2c2', mode: 'night' }, + multiPage: true, animate: { - name: 'zoom', - direction: 'left' + name: 'roll', + direction: 'default' } } diff --git a/src/layouts/TabsView.vue b/src/layouts/TabsView.vue index bb3334f..deef2ab 100644 --- a/src/layouts/TabsView.vue +++ b/src/layouts/TabsView.vue @@ -51,9 +51,10 @@ export default { ...mapState('setting', ['multiPage', 'animate', 'layout']) }, created () { - this.pageList.push(this.$route) - this.linkList.push(this.$route.fullPath) - this.activePage = this.$route.fullPath + const route = this.$route + this.pageList.push(route) + this.linkList.push(route.fullPath) + this.activePage = route.fullPath }, watch: { '$route': function (newRoute) { @@ -61,7 +62,7 @@ export default { if (!this.multiPage) { this.linkList = [newRoute.fullPath] this.pageList = [newRoute] - } else if (this.linkList.indexOf(newRoute.fullPath) < 0) { + } else if (this.linkList.indexOf(newRoute.fullPath) == -1) { this.linkList.push(newRoute.fullPath) this.pageList.push(newRoute) } @@ -89,8 +90,8 @@ export default { this.$message.warning('这是最后一页,不能再关闭了啦') return } - this.pageList = this.pageList.filter(item => item.fullPath !== key) let index = this.linkList.indexOf(key) + this.pageList = this.pageList.filter(item => item.fullPath !== key) this.linkList = this.linkList.filter(item => item !== key) if (key == this.activePage) { index = index >= this.linkList.length ? this.linkList.length - 1 : index @@ -99,8 +100,8 @@ export default { } }, onContextmenu (e) { - const pagekey = this.getPageKey(e.target) - if (pagekey !== null) { + const pageKey = this.getPageKey(e.target) + if (pageKey !== null) { e.preventDefault() this.menuVisible = true } @@ -148,16 +149,18 @@ export default { let index = this.linkList.indexOf(pageKey) this.linkList = this.linkList.slice(index) this.pageList = this.pageList.slice(index) - if (this.linkList.indexOf(this.activePage) < 0) { + if (this.linkList.indexOf(this.activePage) == -1) { this.activePage = this.linkList[0] + this.$router.push(this.activePage) } }, closeRight (pageKey) { let index = this.linkList.indexOf(pageKey) this.linkList = this.linkList.slice(0, index + 1) this.pageList = this.pageList.slice(0, index + 1) - if (this.linkList.indexOf(this.activePage < 0)) { + if (this.linkList.indexOf(this.activePage) == -1) { this.activePage = this.linkList[this.linkList.length - 1] + this.$router.push(this.activePage) } } } diff --git a/src/pages/dashboard/analysis/Analysis.vue b/src/pages/dashboard/analysis/Analysis.vue index 5da1302..18a125d 100644 --- a/src/pages/dashboard/analysis/Analysis.vue +++ b/src/pages/dashboard/analysis/Analysis.vue @@ -124,7 +124,7 @@ for (let i = 0; i < 8; i++) { } export default { - name: 'analysis', + name: 'Analysis', i18n: require('./i18n'), data () { return { @@ -133,7 +133,7 @@ export default { } }, created() { - setTimeout(() => this.loading = !this.loading, 500) + setTimeout(() => this.loading = !this.loading, 1000) }, components: {Trend, SalesData, HotSearch, RankingList, Bar, MiniProgress, MiniBar, MiniArea, ChartCard} }