mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Fix focus lost (fix #4732)
This commit is contained in:
parent
fdec2d8dd6
commit
d76293ef0a
@ -30,7 +30,7 @@
|
||||
:action="a"
|
||||
@previous-item="previousItem()"
|
||||
@next-item="nextItem()"
|
||||
@delete-item="onDeleteItem()"
|
||||
@delete-item="onDeleteItem(index)"
|
||||
@action="
|
||||
index === actions.length - 1 && onClearHistory()
|
||||
onAction(a)
|
||||
@ -49,12 +49,12 @@
|
||||
class="suggest-item disabled"
|
||||
></VLoading>
|
||||
<ActionItem
|
||||
v-for="a of actions"
|
||||
v-for="(a, index) of actions"
|
||||
:key="a.key"
|
||||
:action="a"
|
||||
@previous-item="previousItem()"
|
||||
@next-item="nextItem()"
|
||||
@delete-item="onDeleteItem()"
|
||||
@delete-item="onDeleteItem(index)"
|
||||
@action="onAction(a)"
|
||||
/>
|
||||
</div>
|
||||
@ -234,7 +234,8 @@ export default Vue.extend({
|
||||
this.focusTarget.next()
|
||||
e.preventDefault()
|
||||
},
|
||||
handleIndexUpdate() {
|
||||
async handleIndexUpdate() {
|
||||
await this.$nextTick()
|
||||
if (!this.focusTarget.hasFocus) {
|
||||
this.focusInput()
|
||||
return
|
||||
@ -248,7 +249,8 @@ export default Vue.extend({
|
||||
this.focusTarget.next()
|
||||
},
|
||||
search,
|
||||
onDeleteItem() {
|
||||
onDeleteItem(index: number) {
|
||||
this.focusTarget.setFocus(index)
|
||||
this.focusTarget.previous()
|
||||
this.getActions()
|
||||
},
|
||||
|
||||
@ -26,6 +26,9 @@ export class FocusTarget extends EventTarget {
|
||||
return this.itemIndex > -1
|
||||
}
|
||||
|
||||
setFocus(index: number) {
|
||||
this.index = index
|
||||
}
|
||||
reset(length: number, index = this.index) {
|
||||
this.itemLength = length
|
||||
this.index = index
|
||||
|
||||
Loading…
Reference in New Issue
Block a user