diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index 33b70fa4..b2865d1a 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -52,26 +52,30 @@ const props = withDefaults(defineProps(), { }); const slots = useSlots(); -const emits = defineEmits(); const searchValue = ref(""); -const singleLabel = ref(""); +const singleValue = ref(""); +const multipleValue = ref([]); const openState: Ref = ref(false); const selectedItem: Ref = ref([]); const options = ref([]); +const emits = defineEmits(); onMounted(() => { if (slots.default) { getOption(slots.default()); } + Object.assign(options.value, props.items); watch( selectedValue, () => { if (multiple.value) { - // tag-input 格式化 + multipleValue.value = selectedValue.value.map((value: any) =>{ +   return options.value.find((item: any) => item.value === value) + }) } else { - singleLabel.value = options.value.find((item: any) => { + singleValue.value = options.value.find((item: any) => { return item.value === selectedValue.value; })?.label; } @@ -122,7 +126,7 @@ provide("multiple", multiple); > @@ -135,7 +139,7 @@ provide("multiple", multiple);