Skip to content

Commit 59f84c6

Browse files
committed
Update autocomp lib.
1 parent bba7cd2 commit 59f84c6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

site/static/autocomp.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function autocomp(el, options = {}) {
1+
export function autocomp(el, options = {}) {
22
const opt = {
33
onQuery: null, onNavigate: null, onSelect: null, onRender: null, debounce: 100, autoSelect: true,...options
44
};
@@ -122,7 +122,7 @@ function autocomp(el, options = {}) {
122122
return;
123123
}
124124

125-
val = opt.onSelect(items[idx]);
125+
val = opt.onSelect(items[idx], items);
126126
el.value = val || items[idx];
127127
}
128128

@@ -135,3 +135,5 @@ function autocomp(el, options = {}) {
135135
}
136136
}
137137
}
138+
139+
export default autocomp;

0 commit comments

Comments
 (0)