| | |
| | | if (page) { |
| | | page.fullPath = newRoute.fullPath; |
| | | } else if (!page) { |
| | | // 如果新增的是文件结果或对比页面 则清除同类 |
| | | if (newRoute.name == "result" || newRoute.name == 'compare') { |
| | | // 清除缓存 |
| | | const clearPages = this.pageList.filter( |
| | | (item) => item.name == "result" || item.name == 'compare' |
| | | ); |
| | | this.$bus.$emit( |
| | | "clearCaches", |
| | | clearPages.map((item) => item.cachedKey) |
| | | ); |
| | | this.pageList = this.pageList.filter( |
| | | (item) => !clearPages.includes(item) |
| | | ); |
| | | } |
| | | ///////////////////// |
| | | // 添加新签 |
| | | this.pageList.push(this.createPage(newRoute)); |
| | | } |
| | | this.$nextTick(() => { |
| | | this.setCachedKey(newRoute); |
| | | }); |
| | | }, |
| | | pageList(n) { |
| | | let hasFile = n.some((v) => ["compare", "result"].includes(v.name)); |
| | | this.$bus.$emit("checkCloseAll", hasFile); |
| | | }, |
| | | }, |
| | | computed: { |
| | |
| | | remove.map((page) => page.cachedKey) |
| | | ); |
| | | if (path === this.activePage) { |
| | | index = |
| | | index >= this.pageList.length ? this.pageList.length - 1 : index; |
| | | this.activePage = this.pageList.length |
| | | ? this.pageList[index].path |
| | | : "/"; |
| | | const nextPage = this.pageList.length ? this.pageList[index] : {path: '/'}; |
| | | this.pageList.sort((a, b) => (b.path == "/empty" ? -1 : 0)); |
| | | this.activePage = this.pageList.length ? this.pageList[0].path : "/"; |
| | | const nextPage = this.pageList.length |
| | | ? this.pageList[0] |
| | | : { path: "/" }; |
| | | if ("result" == nextPage.name) { |
| | | this.$router.push({ |
| | | path: "/result/" + nextPage.title, |
| | |
| | | }); |
| | | this.$bus.$emit("chartResize"); |
| | | } else { |
| | | this.$router.push({path: nextPage.path, query: nextPage.query}); |
| | | this.$router.push({ path: nextPage.path, query: nextPage.query }); |
| | | // this.$router.push(this.activePage); |
| | | } |
| | | } |
| | |
| | | this.pageList = this.pageList.filter( |
| | | (item) => !clearPages.includes(item) |
| | | ); |
| | | this.pageList.sort((a, b) => (b.path == "/empty" ? -1 : 0)); |
| | | const nextPage = this.pageList.length ? this.pageList[0] : {}; |
| | | this.activePage = nextPage.path || "/"; |
| | | // 判断跳转 |
| | | this.$router.push({path: nextPage.path, query: nextPage.query}); |
| | | this.$router.push({ path: nextPage.path, query: nextPage.query }); |
| | | // this.$router.push(this.activePage); |
| | | }, |
| | | onTabClick(page) { |
| | |
| | | }); |
| | | this.$bus.$emit("chartResize"); |
| | | } else { |
| | | this.$router.push({path, query}); |
| | | this.$router.push({ path, query }); |
| | | // this.$router.push(this.activePage); |
| | | } |
| | | }, |