From 7845a8050d31ae18ec69a01e18dfcefb9c726e1f Mon Sep 17 00:00:00 2001 From: jmal Date: Wed, 22 May 2024 09:25:03 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=85=B3=E9=94=AE=E5=AD=97=E5=90=8E=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 4d97339..de4dd8c 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -2725,16 +2725,23 @@ export default { this.beforeLoadData(onLoad); // this.pathList = [{ folder: "" }] // 查找this.pathList中是否已经有搜索的路径 + + const item = {} + item["folder"] = `搜索: ${key}` + item["search"] = true + item["searchKey"] = key + + let folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' + const searchPathIndex = this.pathList.findIndex(item => item.search) if (searchPathIndex < 0) { - const item1 = {} - item1["folder"] = `搜索: ${key}` - item1["search"] = true - item1["searchKey"] = key - this.pathList.push(item1) + this.pathList.push(item) + } else { + this.pathList.splice(searchPathIndex, this.pathList.length - searchPathIndex) + this.pathList.push(item) + folder = '' } const queryTagId = this.$route.query.tagId ? `&tagId=${this.$route.query.tagId}` : '' - const folder = this.$route.query.folder ? `&folder=${this.$route.query.folder}` : '' const basePath = this.getBasePath() const keyword = key ? `&keyword=${key}` : '' const path = this.path ? encodeURI(this.path.replace(this.basePath, '/')) : "/"