🐛(component): 修复 select 组件多选无法被删除的问题

This commit is contained in:
就眠儀式 2022-10-08 14:03:05 +08:00
parent 47bc300712
commit 8021404c34

View File

@ -26,6 +26,7 @@ import LayDropdown from "../dropdown/index.vue";
import LaySelectOption, {
LaySelectOptionProps,
} from "../selectOption/index.vue";
import { arrayExpression } from "@babel/types";
export interface LaySelectProps {
name?: string;
@ -93,6 +94,12 @@ const intOption = () => {
Object.assign(options.value, props.items);
};
const handleRemove = (value: any) => {
if(Array.isArray(selectedValue.value)) {
selectedValue.value = selectedValue.value.filter(item => item != value);
}
}
onMounted(() => {
intOption();
timer = setInterval(intOption, 500);
@ -178,6 +185,7 @@ provide("multiple", multiple);
:size="size"
:class="{ 'layui-unselect': true }"
@clear="handleClear"
@remove="handleRemove"
>
<template #suffix>
<lay-icon