(select): 统一 select 组件 dropdown 关闭时统一清空查询内容

This commit is contained in:
就眠儀式 2022-11-16 10:27:58 +08:00
parent 48626d7a37
commit bdbfdd38f3
3 changed files with 18 additions and 11 deletions

View File

@ -178,6 +178,11 @@ const handleClear = () => {
} }
}; };
const handleHide = () => {
searchValue.value = "";
openState.value = false;
}
provide("selectRef", selectRef); provide("selectRef", selectRef);
provide("openState", openState); provide("openState", openState);
provide("selectedValue", selectedValue); provide("selectedValue", selectedValue);
@ -194,7 +199,7 @@ provide("multiple", multiple);
:contentStyle="contentStyle" :contentStyle="contentStyle"
:update-at-scroll="true" :update-at-scroll="true"
:autoFitWidth="true" :autoFitWidth="true"
@hide="openState = false" @hide="handleHide"
@show="openState = true" @show="openState = true"
> >
<lay-tag-input <lay-tag-input
@ -220,13 +225,13 @@ provide("multiple", multiple);
</lay-tag-input> </lay-tag-input>
<lay-input <lay-input
v-else v-else
:modelValue="singleValue"
:placeholder="placeholder"
:allow-clear="allowClear"
:readonly="!showSearch"
:disabled="disabled"
:class="{ 'layui-unselect': !showSearch }"
:size="size" :size="size"
:disabled="disabled"
:readonly="!showSearch"
:modelValue="singleValue"
:allow-clear="allowClear"
:placeholder="placeholder"
:class="{ 'layui-unselect': !showSearch }"
@compositionstart="onCompositionstart" @compositionstart="onCompositionstart"
@compositionend="onCompositionend" @compositionend="onCompositionend"
@Input="handleSearch" @Input="handleSearch"
@ -243,13 +248,13 @@ provide("multiple", multiple);
<dl class="layui-select-content"> <dl class="layui-select-content">
<div class="layui-select-search" v-if="multiple && showSearch"> <div class="layui-select-search" v-if="multiple && showSearch">
<lay-input <lay-input
size="sm"
prefix-icon="layui-icon-search"
:modelValue="searchValue" :modelValue="searchValue"
:placeholder="searchPlaceholder" :placeholder="searchPlaceholder"
@Input="handleSearch"
@compositionstart="onCompositionstart" @compositionstart="onCompositionstart"
@compositionend="onCompositionend" @compositionend="onCompositionend"
prefix-icon="layui-icon-search" @input="handleSearch"
size="sm"
></lay-input> ></lay-input>
</div> </div>
<template v-if="items"> <template v-if="items">

View File

@ -21,6 +21,8 @@
<li>[优化] tag-input 组件 maxWidth 属性默认为 100%。</li> <li>[优化] tag-input 组件 maxWidth 属性默认为 100%。</li>
<li>[优化] tag-input 组件 tagWidth 超出 input 宽度时自动省略文本。</li> <li>[优化] tag-input 组件 tagWidth 超出 input 宽度时自动省略文本。</li>
<li>[优化] table 组件 default-toolbar 属性支持 Array 类型, 举例:['print']。</li> <li>[优化] table 组件 default-toolbar 属性支持 Array 类型, 举例:['print']。</li>
<li>[优化] select 组件 dropdown 关闭时统一清空 search 内容。</li>
<li></li>
</ul> </ul>
</li> </li>
</ul> </ul>

View File

@ -43,7 +43,7 @@
rel="nofollow" rel="nofollow"
class="site-star" class="site-star"
> >
<i class="layui-icon"></i> Star <cite id="getStars">1633</cite> <i class="layui-icon"></i> Star <cite id="getStars">1700</cite>
</a> </a>
<a <a
href="https://gitee.com/layui-vue" href="https://gitee.com/layui-vue"