Skip to content

Commit 5a24f5e

Browse files
committed
refactor: 增加 menu 点击事件
1 parent 8519e4c commit 5a24f5e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export function init(id, invoke) {
3939
if (triggerBlur) {
4040
invoke.invokeMethodAsync('TriggerBlur');
4141
}
42+
}
43+
44+
EventHandler.on(menu, 'click', '.dropdown-item', e => {
45+
ac.triggerBlur();
4246
});
4347

4448
EventHandler.on(input, 'focus', e => {
@@ -153,7 +157,7 @@ export function dispose(id) {
153157
Data.remove(id)
154158

155159
if (ac) {
156-
const { popover, input } = ac;
160+
const { popover, input, menu } = ac;
157161
if (popover) {
158162
Popover.dispose(popover)
159163
if (input) {
@@ -162,6 +166,7 @@ export function dispose(id) {
162166
}
163167
EventHandler.off(input, 'change');
164168
EventHandler.off(input, 'keyup');
169+
EventHandler.off(menu, 'click');
165170
Input.dispose(input);
166171

167172
const { AutoComplete } = window.BootstrapBlazor;

0 commit comments

Comments
 (0)