diff --git a/src/color-picker/panel/index.tsx b/src/color-picker/panel/index.tsx index d637a6a01..cb4032613 100644 --- a/src/color-picker/panel/index.tsx +++ b/src/color-picker/panel/index.tsx @@ -283,10 +283,10 @@ export default defineComponent({ }, render() { const { - baseClassName, statusClassNames, t, global, recentColors, swatchColors, previewColorStyle, isGradient, + baseClassName, statusClassNames, t, global, swatchColors, previewColorStyle, isGradient, } = this; - const showUsedColors = recentColors !== null && recentColors !== false; + const showUsedColors = this.recentlyUsedColors !== null && this.recentlyUsedColors !== false; let systemColors = swatchColors; if (systemColors === undefined) { diff --git a/src/color-picker/panel/swatches.tsx b/src/color-picker/panel/swatches.tsx index a5467d697..adfdc7cff 100644 --- a/src/color-picker/panel/swatches.tsx +++ b/src/color-picker/panel/swatches.tsx @@ -69,13 +69,10 @@ export default defineComponent({ * 移除颜色 */ const handleRemoveColor = () => { - const colors = [...props.colors]; + const { colors } = props; const selectedIndex = selectedColorIndex.value; - if (selectedIndex > -1) { - colors.splice(selectedIndex, 1); - } else { - colors.length = 0; - } + if (selectedIndex === -1) return; + colors.splice(selectedIndex, 1); props.handleChange?.(colors); setVisiblePopConfirm(false); };