add new keyboard events

This commit is contained in:
layyback
2024-07-18 18:58:34 +08:00
parent b9f4333c01
commit a2c5bcc90c
2 changed files with 13 additions and 18 deletions

View File

@@ -103,22 +103,12 @@ watch(
);
const changeIndex = (index) => {
if (!options.value.length) {
if (!pluginHistory.value.length) return;
if (
currentSelect.value + index > pluginHistory.value.length - 1 ||
currentSelect.value + index < 0
) {
currentSelect.value = 0;
return;
}
currentSelect.value = currentSelect.value + index;
return;
}
if (currentSelect.value + index > options.value.length - 1) {
const len = options.value.length || pluginHistory.value.length;
if (!len) return;
if (currentSelect.value + index > len - 1) {
currentSelect.value = 0;
} else if (currentSelect.value + index < 0) {
currentSelect.value = options.value.length - 1;
currentSelect.value = len - 1;
} else {
currentSelect.value = currentSelect.value + index;
}