diff --git a/src/color-picker/panel/index.tsx b/src/color-picker/panel/index.tsx index 837f4b3925..bc45162fe1 100644 --- a/src/color-picker/panel/index.tsx +++ b/src/color-picker/panel/index.tsx @@ -272,21 +272,13 @@ export default defineComponent({ }; }, render() { - const { - t, - baseClassName, - statusClassNames, - globalConfig, - recentColors, - swatchColors, - showPrimaryColorPreview, - isGradient, - } = this; + const { t, baseClassName, statusClassNames, globalConfig, swatchColors, showPrimaryColorPreview, isGradient } = + this; const baseProps = { color: this.color, disabled: this.disabled, }; - 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 9654666593..cacdc5dc7d 100644 --- a/src/color-picker/panel/swatches.tsx +++ b/src/color-picker/panel/swatches.tsx @@ -60,13 +60,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.onChange(colors); setVisiblePopConfirm(false); };