🐛 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()) { if (validateTag()) {
const tag: TagType = { label, color }; const tag: TagType = { label, color };
setTags([...tags, tag]); const newTags = [...tags, tag];
onTagUpdate(tags); setTags(newTags);
onTagUpdate(newTags);
} }
}; };
const delTag = (index: number) => { const delTag = (index: number) => {
setTags(tags.filter((_, i) => i !== index)); const newTags = tags.filter((_, i) => i !== index);
onTagUpdate(tags); setTags(newTags);
onTagUpdate(newTags);
}; };
const onChangeColor = (color: ColorResult) => { const onChangeColor = (color: ColorResult) => {
setColor(color.hex as TagType["color"]); setColor(color.hex as TagType["color"]);