ui: autocomplete: fix value is not a function

This commit is contained in:
无限UCW committed 2021-08-25 12:55:32 +08:00
1 parent fe36a3f17e
commit c78fc82d5b
2 files changed
+15 -2

No files matched your search

@@ -17,7 +17,14 @@ export default class AutoComplete extends DOMAttachedObject {
...options,
};
this.ref = null;
this.clear = this.clear.bind(this);
this.onChange = this.onChange.bind(this);
this.attach = this.attach.bind(this);
this.open = this.open.bind(this);
this.close = this.close.bind(this);
this.value = this.value.bind(this);
this.detach = this.detach.bind(this);
this.focus = this.focus.bind(this);
this.container = document.createElement('div');
this.$dom.addClass('autocomplete-dummy').after(this.container);
// Note: use `setTimeout(fn, 0)` to ensure that code is executed after browser autofill
@@ -63,6 +70,10 @@ export default class AutoComplete extends DOMAttachedObject {
this.ref.closeList();
}
value() {
return this.$dom.val();
}
detach() {
if (this.detached) return;
super.detach();