Skip to content

Commit

Permalink
fix(color-picker): recentColors delete (#3384)
Browse files Browse the repository at this point in the history
* fix(color-picker): recentColors delete

* fix(color-picker): format
  • Loading branch information
superNos authored Nov 8, 2024
1 parent 9714cbc commit a7cdc03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/color-picker/panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
9 changes: 3 additions & 6 deletions src/color-picker/panel/swatches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down

0 comments on commit a7cdc03

Please sign in to comment.