From 9ad7879323551cf1f779e18dafdcc51d42c39a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Tue, 27 Sep 2022 18:01:16 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20=E5=AE=8C=E5=96=84=20se?= =?UTF-8?q?lect=20=E7=BB=84=E4=BB=B6=E7=9A=84=E6=B8=85=E7=A9=BA=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/select/index.vue | 18 +++++++-- .../src/component/selectOption/index.vue | 6 ++- .../src/document/zh-CN/components/select.md | 39 +++++++++++++++++++ 3 files changed, 57 insertions(+), 6 deletions(-) diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index d99ac0af..53ae953c 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -98,10 +98,6 @@ onMounted(() => { ); }); -const handleSearch = (value: string) => { - searchValue.value = value; -}; - const getOption = function (nodes: VNode[]) { nodes?.map((item: VNode) => { let component = item.type as Component; @@ -127,6 +123,18 @@ const multiple = computed(() => { return props.multiple; }); +const handleSearch = (value: string) => { + searchValue.value = value; +}; + +const handleClear = () => { + if(multiple.value) { + selectedValue.value = []; + } else { + selectedValue.value = ""; + } +} + provide("openState", openState); provide("selectedItem", selectedItem); provide("selectedValue", selectedValue); @@ -150,6 +158,7 @@ provide("multiple", multiple); :collapseTagsTooltip="collapseTagsTooltip" :minCollapsedNum="minCollapsedNum" :disabledInput="true" + @clear="handleClear" >