Skip to content

Commit

Permalink
🐛 Docs: 修复表单标签状态更新 (#2558)
Browse files Browse the repository at this point in the history
  • Loading branch information
StarHeartHunt authored Feb 1, 2024
1 parent 30ceea4 commit c5e114d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions website/src/components/Form/Items/Tag/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ export default function TagFormItem({
}
if (validateTag()) {
const tag: TagType = { label, color };
setTags([...tags, tag]);
onTagUpdate(tags);
const newTags = [...tags, tag];
setTags(newTags);
onTagUpdate(newTags);
}
};
const delTag = (index: number) => {
setTags(tags.filter((_, i) => i !== index));
onTagUpdate(tags);
const newTags = tags.filter((_, i) => i !== index);
setTags(newTags);
onTagUpdate(newTags);
};
const onChangeColor = (color: ColorResult) => {
setColor(color.hex as TagType["color"]);
Expand Down

0 comments on commit c5e114d

Please sign in to comment.