diff options
| author | zhangyu <[email protected]> | 2023-10-26 16:50:12 +0800 |
|---|---|---|
| committer | zhangyu <[email protected]> | 2023-10-26 16:50:12 +0800 |
| commit | 7ba5ccd59523308a7a2efd30a44141a89cbe4499 (patch) | |
| tree | 0575180174d18d40a631c5da85360f658dcc6ebd | |
| parent | aa154a748c1e7dc5b03cdd938a1e1f30058b6ab8 (diff) | |
NEZ-3274 fix:Search history中应合并相同的搜索记录rel-23.10.04
| -rw-r--r-- | nezha-fronted/src/components/common/searchInput.vue | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/nezha-fronted/src/components/common/searchInput.vue b/nezha-fronted/src/components/common/searchInput.vue index c72ec0b0c..15f4fae10 100644 --- a/nezha-fronted/src/components/common/searchInput.vue +++ b/nezha-fronted/src/components/common/searchInput.vue @@ -1069,6 +1069,10 @@ export default { localStorage.setItem('nz-history-' + this.where, JSON.stringify(this.historyList)) } else { this.historyList = JSON.parse(localStorage.getItem('nz-history-' + this.where)) + const findIndex = this.historyList.findIndex(item=> JSON.stringify(item) == JSON.stringify(this.select_list)) + if (findIndex !== -1) { + this.historyList.splice(findIndex, 1) + } this.historyList.unshift(this.select_list) if (this.historyList.length > 10) { this.historyList.length = 10 |
