Reorder
This commit is contained in:
parent
b0bfe3989e
commit
0fcab30629
|
@ -201,35 +201,6 @@ export default {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
select(parentIndex, index) {
|
|
||||||
|
|
||||||
if (index < 0 && parentIndex === 0) {
|
|
||||||
this.$refs.searchInput.focus()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index < 0) {
|
|
||||||
parentIndex--
|
|
||||||
index = this.results[parentIndex].items.length - 1
|
|
||||||
}
|
|
||||||
|
|
||||||
let elems = this.$refs[`result-${parentIndex}_${index}`]
|
|
||||||
|
|
||||||
if (this.results[parentIndex].items.length === index) {
|
|
||||||
elems = this.$refs[`result-${parentIndex + 1}_0`]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof elems === 'undefined' || elems.length === 0) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Array.isArray(elems)) {
|
|
||||||
elems[0].focus()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
elems.focus()
|
|
||||||
},
|
|
||||||
doCmd() {
|
doCmd() {
|
||||||
if (this.selectedCmd === null) {
|
if (this.selectedCmd === null) {
|
||||||
return
|
return
|
||||||
|
@ -284,6 +255,35 @@ export default {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
select(parentIndex, index) {
|
||||||
|
|
||||||
|
if (index < 0 && parentIndex === 0) {
|
||||||
|
this.$refs.searchInput.focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < 0) {
|
||||||
|
parentIndex--
|
||||||
|
index = this.results[parentIndex].items.length - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
let elems = this.$refs[`result-${parentIndex}_${index}`]
|
||||||
|
|
||||||
|
if (this.results[parentIndex].items.length === index) {
|
||||||
|
elems = this.$refs[`result-${parentIndex + 1}_0`]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof elems === 'undefined' || elems.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(elems)) {
|
||||||
|
elems[0].focus()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
elems.focus()
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Reference in New Issue