<a-select
showSearch
placeholder="Select a person"
optionFilterProp="children"
style="width: 200px"
:open="open"
@mouseenter="openSelect"
@mouseleave="closeSelect"
>
<a-select-option value="jack">Jack</a-select-option>
<a-select-option value="lucy">Lucy</a-select-option>
<a-select-option value="tom">Tom</a-select-option>
</a-select>
</template>
data() {
open: false,
}
methods: {
openSelect() {
this.open = true;
}
closeSelect() {
this.open = false;
}
}当用户不再使用ant-design-vue select选项时,如何关闭它?我尝试过使用onBlur和onMouseLeave。我也尝试过创建函数onFocus() {this.open = true}和函数onBlur(){ this.open=false },但仍然不起作用
当指针不在字段中但选项仍无法选择时,将触发mouseleaveevent
发布于 2020-01-14 16:36:59
http://vue.ant-design.cn/components/select/#events
根据select组件的文档,支持mouseleave事件。尝试使用@mouseleave="foo"将选项设置为不可见
https://stackoverflow.com/questions/59729123
复制相似问题