mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +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.focus();
|
||||
} else {
|
||||
setSelected([item]);
|
||||
inputRef.current.value = itemKey(item);
|
||||
dispatchChange();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,11 @@ export default class AutoComplete extends DOMAttachedObject {
|
||||
}
|
||||
|
||||
value() {
|
||||
if (this.ref?.getSelectedItems) {
|
||||
const selected = this.ref.getSelectedItems();
|
||||
if (this.options.multi) return selected;
|
||||
return selected[0];
|
||||
}
|
||||
return this.$dom.val();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.18.3",
|
||||
"version": "4.18.4",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
|
||||
Reference in new issue
Block a user