Explorar o código

修复了多选时,平台可以为空的BUG

fxs hai 8 meses
pai
achega
76cfe6836d
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  1. 6 0
      src/components/common/WithIconSelect.vue

+ 6 - 0
src/components/common/WithIconSelect.vue

@@ -59,6 +59,11 @@ const backupInfo = reactive<Array<IconDropdownItem>>([])
  */
 const confirmSelect = () => {
   isConfimClose.value = true // 通过确认事件关闭
+  // 如果没有选中任何平台,则直接返回,不进行任何操作
+  if (selectBaseInfo.filter((item) => item.isSelected).length === 0) {
+    dropDownRef.value?.handleClose()
+    return
+  }
   Object.assign(backupInfo, JSON.parse(JSON.stringify(selectBaseInfo)))
   dropDownRef.value?.handleClose()
 
@@ -96,6 +101,7 @@ const dropdownVis = (state: boolean) => {
     // 不是点击确认按钮关闭的多选框,且是多选按钮,也需要恢复
     if (!selectBaseInfo.find((item) => item.isSelected) || (!isConfimClose.value && !props.isRadio))
       Object.assign(selectBaseInfo, backupInfo)
+
     if (isConfimClose.value) isConfimClose.value = false // 把状态重置
   }
 }