Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(color-picker): recentColors delete #3384

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading