mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix autocomplete
This commit is contained in:
1 parent
4c6aeeb914
commit
329d047699
3 files changed
+7
-1
No files matched your search
@@ -98,6 +98,7 @@ const AutoComplete = forwardRef(function AutoComplete(props, ref) {
|
|||||||
inputRef.current.value = '';
|
inputRef.current.value = '';
|
||||||
inputRef.current.focus();
|
inputRef.current.focus();
|
||||||
} else {
|
} else {
|
||||||
|
setSelected([item]);
|
||||||
inputRef.current.value = itemKey(item);
|
inputRef.current.value = itemKey(item);
|
||||||
dispatchChange();
|
dispatchChange();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,11 @@ export default class AutoComplete extends DOMAttachedObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
value() {
|
value() {
|
||||||
|
if (this.ref?.getSelectedItems) {
|
||||||
|
const selected = this.ref.getSelectedItems();
|
||||||
|
if (this.options.multi) return selected;
|
||||||
|
return selected[0];
|
||||||
|
}
|
||||||
return this.$dom.val();
|
return this.$dom.val();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.18.3",
|
"version": "4.18.4",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user