Commit 063779ea by Jaxon

fix(remoteSearchSelect): 替换blur事件为visible-change以支持多选

在多选模式下,@blur事件无法正常响应。使用@visible-change事件替代,仅在弹窗关闭时(e为false)执行原有的失焦逻辑,包括清空搜索值并重新获取选项。
1 parent e1e3b319
......@@ -5,7 +5,7 @@
:value="value"
v-bind="selectProps"
v-on="selectEvent"
@blur="handleSelectBlur"
@visible-change="handleVisibleChange"
@change="handleSelectChange">
<el-option v-for="subItem in localOptions"
:key="subItem[fieldName.value]"
......@@ -206,23 +206,25 @@ export default {
this.$listeners.change(e);
}
},
async handleSelectBlur() {
// 失焦时, 检查 query.searchValue的内容. 如果有值
async handleVisibleChange(e) {
// 在多选的情况下 @blur响应不了 用这个替代
if (!e) {
// 失焦时, 检查 query.searchValue的内容. 如果有值
// 需要去掉searchValue 重新获取默认的options
if (this.pageQuery.searchValue) {
console.log("重新获取默认的options");
this.pageQuery.searchValue = "";
// 重置页数
this.resetPageQuery();
await this.getApi();
}
console.log("失焦?", this.pageQuery.searchValue);
if (this.pageQuery.searchValue) {
console.log("重新获取默认的options");
this.pageQuery.searchValue = "";
// 重置页数
this.resetPageQuery();
await this.getApi();
}
if (isFunction(this.$listeners?.blur)) {
this.$listeners.blur();
if (isFunction(this.$listeners?.blur)) {
this.$listeners.blur();
}
}
},
isFunction,
async loadMore() {
if (this.loading) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!