Просмотр исходного кода

fix(PopConfirmButton): avoid type lint error (#3600)

xachary 1 год назад
Родитель
Сommit
5ec4446443
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      src/components/Button/src/PopConfirmButton.vue

+ 3 - 5
src/components/Button/src/PopConfirmButton.vue

@@ -38,8 +38,9 @@
       });
 
       return () => {
-        const bindValues = omit(unref(getBindValues), 'icon');
-        const btnBind = omit(bindValues, 'title') as any;
+        // 用 omit 剔除一些已知可能导致异常的属性
+        const bindValues = omit(unref(getBindValues), 'icon', 'color');
+        const btnBind = omit(unref(getBindValues), 'title') as any;
         if (btnBind.disabled) btnBind.color = '';
         const Button = h(BasicButton, btnBind, extendSlots(slots));
 
@@ -47,9 +48,6 @@
         if (!props.enable) {
           return Button;
         }
-        if (bindValues.color) {
-          delete bindValues.color;
-        }
         return h(Popconfirm, bindValues, { default: () => Button });
       };
     },