feat: 优化创建分组字段填充
This commit is contained in:
@@ -15,6 +15,7 @@ interface Props {
|
||||
interface Emits {
|
||||
(e: "group-select", group: Group): void;
|
||||
(e: "refresh"): void;
|
||||
(e: "refresh-and-select", groupId: number): void;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -67,15 +68,8 @@ function handleGroupCreated(_group: Group) {
|
||||
}
|
||||
|
||||
function handleSwitchToGroup(groupId: number) {
|
||||
// 创建成功后,等待列表刷新完成,然后切换到新创建的分组
|
||||
emit("refresh");
|
||||
// 延迟选择新分组,确保列表已更新
|
||||
setTimeout(() => {
|
||||
const newGroup = props.groups.find(g => g.id === groupId);
|
||||
if (newGroup) {
|
||||
emit("group-select", newGroup);
|
||||
}
|
||||
}, 100);
|
||||
// 创建成功后,通知父组件刷新并切换到新创建的分组
|
||||
emit("refresh-and-select", groupId);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Reference in New Issue
Block a user