🐛(component): 修复 select 组件多选无法被删除的问题
This commit is contained in:
parent
47bc300712
commit
8021404c34
@ -26,6 +26,7 @@ import LayDropdown from "../dropdown/index.vue";
|
|||||||
import LaySelectOption, {
|
import LaySelectOption, {
|
||||||
LaySelectOptionProps,
|
LaySelectOptionProps,
|
||||||
} from "../selectOption/index.vue";
|
} from "../selectOption/index.vue";
|
||||||
|
import { arrayExpression } from "@babel/types";
|
||||||
|
|
||||||
export interface LaySelectProps {
|
export interface LaySelectProps {
|
||||||
name?: string;
|
name?: string;
|
||||||
@ -93,6 +94,12 @@ const intOption = () => {
|
|||||||
Object.assign(options.value, props.items);
|
Object.assign(options.value, props.items);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleRemove = (value: any) => {
|
||||||
|
if(Array.isArray(selectedValue.value)) {
|
||||||
|
selectedValue.value = selectedValue.value.filter(item => item != value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
intOption();
|
intOption();
|
||||||
timer = setInterval(intOption, 500);
|
timer = setInterval(intOption, 500);
|
||||||
@ -178,6 +185,7 @@ provide("multiple", multiple);
|
|||||||
:size="size"
|
:size="size"
|
||||||
:class="{ 'layui-unselect': true }"
|
:class="{ 'layui-unselect': true }"
|
||||||
@clear="handleClear"
|
@clear="handleClear"
|
||||||
|
@remove="handleRemove"
|
||||||
>
|
>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<lay-icon
|
<lay-icon
|
||||||
|
Loading…
Reference in New Issue
Block a user