From ae1d070d79f6f70892db0a89e5f54b36867f60f4 Mon Sep 17 00:00:00 2001 From: Chong Guo Date: Fri, 3 Apr 2020 16:46:19 +0200 Subject: [PATCH] Fix(tagsview): fix tagsview close tags throw 404 page error. --- mock/role/routes.ts | 16 +++++----------- src/components/HeaderSearch/index.vue | 2 +- src/layout/components/TagsView/index.vue | 8 ++++---- src/router/index.ts | 16 +++++----------- src/views/i18n-demo/index.vue | 2 +- 5 files changed, 16 insertions(+), 28 deletions(-) diff --git a/mock/role/routes.ts b/mock/role/routes.ts index 68588d3ce..0daea2d2a 100644 --- a/mock/role/routes.ts +++ b/mock/role/routes.ts @@ -596,17 +596,11 @@ export const asyncRoutes = [ ] }, { - path: 'external-link', - component: 'Layout', - children: [ - { - path: 'https://github.com/Armour/vue-typescript-admin-template', - meta: { - title: 'externalLink', - icon: 'link' - } - } - ] + path: 'https://github.com/Armour/vue-typescript-admin-template', + meta: { + title: 'externalLink', + icon: 'link' + } }, { path: '*', diff --git a/src/components/HeaderSearch/index.vue b/src/components/HeaderSearch/index.vue index ca3d62c7e..6ba1f22fb 100644 --- a/src/components/HeaderSearch/index.vue +++ b/src/components/HeaderSearch/index.vue @@ -168,7 +168,7 @@ export default class extends Vue { private querySearch(query: string) { if (query !== '') { if (this.fuse) { - this.options = this.fuse.search(query) as any + this.options = this.fuse.search(query).map((result) => result.item) } } else { this.options = [] diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue index 0210087ab..8786ffd43 100644 --- a/src/layout/components/TagsView/index.vue +++ b/src/layout/components/TagsView/index.vue @@ -182,8 +182,8 @@ export default class extends Vue { } private closeOthersTags() { - if (this.selectedTag.title !== undefined) { - this.$router.push(this.selectedTag.title) + if (this.selectedTag.fullPath !== undefined) { + this.$router.push(this.selectedTag.fullPath) } TagsViewModule.delOthersViews(this.selectedTag) this.moveToCurrentTag() @@ -199,8 +199,8 @@ export default class extends Vue { private toLastView(visitedViews: ITagView[], view: ITagView) { const latestView = visitedViews.slice(-1)[0] - if (latestView !== undefined && latestView.title !== undefined) { - this.$router.push(latestView.title) + if (latestView !== undefined && latestView.fullPath !== undefined) { + this.$router.push(latestView.fullPath) } else { // Default redirect to the home page if there is no tags-view, adjust it if you want if (view.name === 'Dashboard') { diff --git a/src/router/index.ts b/src/router/index.ts index d8d7867b9..fead82424 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -426,17 +426,11 @@ export const asyncRoutes: RouteConfig[] = [ ] }, { - path: 'external-link', - component: Layout, - children: [ - { - path: 'https://github.com/Armour/vue-typescript-admin-template', - meta: { - title: 'externalLink', - icon: 'link' - } - } - ] + path: 'https://github.com/Armour/vue-typescript-admin-template', + meta: { + title: 'externalLink', + icon: 'link' + } }, { path: '*', diff --git a/src/views/i18n-demo/index.vue b/src/views/i18n-demo/index.vue index 352876603..4bf53f339 100644 --- a/src/views/i18n-demo/index.vue +++ b/src/views/i18n-demo/index.vue @@ -237,7 +237,7 @@ export default class extends Vue {