修复搜索框在某些情况下输入内容后搜索时会自动清空的问题(#1472)

pull/1446/merge
lyswhut 2023-07-18 18:38:47 +08:00
parent 6c0e11eebc
commit e7f3f27104
3 changed files with 23 additions and 8 deletions

View File

@ -11,6 +11,7 @@
- 修复搜索提示功能失效的问题(#1452, @Folltoshe
- 修复我的列表名右键菜单-排序歌曲按专辑名排序无效的问题(#1440
- 修复若路径存在 # 字符时,软件无法启动的问题
- 修复搜索框在某些情况下输入内容后搜索时会自动清空的问题(#1472
### 其他

View File

@ -162,10 +162,18 @@ export default {
})
},
handleKeyDown() {
this.selectIndex = this.selectIndex + 1 < this.list.length ? this.selectIndex + 1 : 0
if (this.list.length) {
this.selectIndex = this.selectIndex + 1 < this.list.length ? this.selectIndex + 1 : 0
} else if (this.selectIndex > -1) {
this.selectIndex = -1
}
},
handleKeyUp() {
this.selectIndex = this.selectIndex - 1 < -1 ? this.list.length - 1 : this.selectIndex - 1
if (this.list.length) {
this.selectIndex = this.selectIndex - 1 < -1 ? this.list.length - 1 : this.selectIndex - 1
} else if (this.selectIndex > -1) {
this.selectIndex = -1
}
},
handleContextMenu() {
let str = clipboardReadText()

View File

@ -168,14 +168,20 @@ export default {
})
},
handleKeyDown() {
if (!this.resultList.length) return
this.selectIndex = this.selectIndex + 1 < this.resultList.length ? this.selectIndex + 1 : 0
this.handleScrollList()
if (this.resultList.length) {
this.selectIndex = this.selectIndex + 1 < this.resultList.length ? this.selectIndex + 1 : 0
this.handleScrollList()
} else if (this.selectIndex > -1) {
this.selectIndex = -1
}
},
handleKeyUp() {
if (!this.resultList.length) return
this.selectIndex = this.selectIndex - 1 < -1 ? this.resultList.length - 1 : this.selectIndex - 1
this.handleScrollList()
if (this.resultList.length) {
this.selectIndex = this.selectIndex - 1 < -1 ? this.resultList.length - 1 : this.selectIndex - 1
this.handleScrollList()
} else if (this.selectIndex > -1) {
this.selectIndex = -1
}
},
handleScrollList() {
if (this.selectIndex < 0) return