🐛 Docs: 修复表单标签状态更新 (#2558)

This commit is contained in:
StarHeart 2024-02-01 10:29:03 +08:00 committed by GitHub
parent 30ceea4287
commit c5e114dc7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"]);