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

View File

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

View File

@ -43,7 +43,7 @@
rel="nofollow"
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
href="https://gitee.com/layui-vue"