From db21a23bdaff559368e0b4797ed2ab0f9e1fbc45 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: Sun, 29 May 2022 21:22:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(select):=20=E4=BF=AE=E5=A4=8D=20ty?= =?UTF-8?q?pescript=20=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/src/component/select/index.vue | 18 +++++++++--------- .../component/src/component/tree/TreeNode.vue | 2 +- package/component/src/component/tree/index.vue | 2 +- .../src/document/zh-CN/guide/changelog.md | 1 + package/document/src/view/index.vue | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index 6b67590d..2f72316c 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -17,21 +17,21 @@ import { toRefs, Ref, } from "vue"; -import LayScroll from "../scroll"; import LayBadge from "../badge/index.vue"; +import LayScroll from "../scroll/index.vue"; import { onClickOutside } from "@vueuse/core"; import { SelectItem } from "../../types"; export interface LaySelectProps { - modelValue?: string | number | [] | null; name?: string; placeholder?: string; disabled?: boolean; showEmpty?: boolean; emptyMessage?: string; + modelValue?: any; multiple?: boolean; create?: boolean; - items?: { label: string; value: string | number | [] | null; key: string }[]; + items?: { label: string; value: any; key: string, disabled: boolean; keyword: string }[]; } const selectRef = ref(); @@ -57,10 +57,10 @@ const open = function () { return; } openState.value = !openState.value; - console.log(props.create); }; const emit = defineEmits(["update:modelValue", "change", "search", "create"]); + const selectItem = ref({ value: !props.multiple ? props.modelValue @@ -77,9 +77,7 @@ watch( emit("update:modelValue", val); emit("change", val); }, - { - deep: true, - } + { deep: true } ); watch(props, () => { @@ -93,7 +91,7 @@ watch(props, () => { } } else { selectItem.value.value = value; - //@ts-ignore + // selectItem.value.label = ItemsMap.value[value] || ""; } }); @@ -111,12 +109,12 @@ const value = computed({ if (input.value) { return txt.value; } - // return txt.value; return !selectItem.value.multiple && selectItem.value.value !== null ? selectItem.value.label : null; }, }); + const selectItemHandle = async function ( _selectItem: SelectItem, isChecked?: boolean @@ -163,6 +161,7 @@ const selectItemPush = function (p: SelectItem) { ItemsMap.value[p.value] = p.label; } }; + provide("selectItemHandle", selectItemHandle); provide("selectItemPush", selectItemPush); provide("selectItem", selectItem); @@ -227,6 +226,7 @@ provide("keyword", txt); > + diff --git a/package/component/src/component/tree/TreeNode.vue b/package/component/src/component/tree/TreeNode.vue index 5dd22663..78718e33 100644 --- a/package/component/src/component/tree/TreeNode.vue +++ b/package/component/src/component/tree/TreeNode.vue @@ -133,7 +133,7 @@ function handleTitleClick(node: TreeData) { > + diff --git a/package/component/src/component/tree/index.vue b/package/component/src/component/tree/index.vue index d9b6f6d2..0272f839 100644 --- a/package/component/src/component/tree/index.vue +++ b/package/component/src/component/tree/index.vue @@ -89,7 +89,7 @@ function handleClick(node: TreeData) { @node-click="handleClick" > diff --git a/package/document/src/document/zh-CN/guide/changelog.md b/package/document/src/document/zh-CN/guide/changelog.md index ccce4000..02ae3362 100644 --- a/package/document/src/document/zh-CN/guide/changelog.md +++ b/package/document/src/document/zh-CN/guide/changelog.md @@ -18,6 +18,7 @@ diff --git a/package/document/src/view/index.vue b/package/document/src/view/index.vue index 1c61c058..a09d767a 100644 --- a/package/document/src/view/index.vue +++ b/package/document/src/view/index.vue @@ -32,7 +32,7 @@ > {{ t("home.download") }}:7,66811,504