🐛(component): 修复 select 组件多选无法被删除的问题
This commit is contained in:
		
							parent
							
								
									47bc300712
								
							
						
					
					
						commit
						8021404c34
					
				@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user