From 851b5fff081df763bda18caa9bd293da06f42be1 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Wed, 14 Dec 2022 17:51:39 +0800 Subject: [PATCH] repos square --- web_src/vuepages/pages/repos/components/SearchBar.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web_src/vuepages/pages/repos/components/SearchBar.vue b/web_src/vuepages/pages/repos/components/SearchBar.vue index 6e90418ef..19b47a89b 100644 --- a/web_src/vuepages/pages/repos/components/SearchBar.vue +++ b/web_src/vuepages/pages/repos/components/SearchBar.vue @@ -88,9 +88,9 @@ export default { this.selectTopic && this.changeTopic({ k: this.selectTopic.toLocaleLowerCase(), v: this.selectTopic, - }, true) + }, true); }, - changeTopic(topicItem, noSearch) { + changeTopic(topicItem, noSearch) { const index_ori = this.topicOri.findIndex((item) => { return item.k == this.selectTopic.toLocaleLowerCase(); }); @@ -98,7 +98,9 @@ export default { const index = this.topics.findIndex((item) => { return item.k == this.selectTopic.toLocaleLowerCase(); }); - this.topics.splice(index, 1); + if (index > -1) { + this.topics.splice(index, 1); + } } this.selectTopic = topicItem.v; if (this.selectTopic && this.topics.indexOf(this.selectTopic) < 0) { @@ -120,7 +122,7 @@ export default { const topics = topicsData.map((item) => { return { k: item.toLocaleLowerCase(), - v: item, + v: item.trim(), } }); this.topicOri = JSON.parse(JSON.stringify(topics));