mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-06-15 08:37:42 +00:00
🐛 Docs: 修复表单标签状态更新 (#2558)
This commit is contained in:
parent
30ceea4287
commit
c5e114dc7f
@ -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"]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user