mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
fix(demo): resolve key not exist
warnings
修复角色编辑页面可能会出现tree组件报key not exist警告的问题
This commit is contained in:
parent
542121129e
commit
45a94e41c1
@ -47,6 +47,10 @@
|
|||||||
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
|
||||||
resetFields();
|
resetFields();
|
||||||
setDrawerProps({ confirmLoading: false });
|
setDrawerProps({ confirmLoading: false });
|
||||||
|
// 需要在setFieldsValue之前先填充treeData,否则Tree组件可能会报key not exist警告
|
||||||
|
if (unref(treeData).length === 0) {
|
||||||
|
treeData.value = (await getMenuList()) as any as TreeItem[];
|
||||||
|
}
|
||||||
isUpdate.value = !!data?.isUpdate;
|
isUpdate.value = !!data?.isUpdate;
|
||||||
|
|
||||||
if (unref(isUpdate)) {
|
if (unref(isUpdate)) {
|
||||||
@ -54,7 +58,6 @@
|
|||||||
...data.record,
|
...data.record,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
treeData.value = (await getMenuList()) as any as TreeItem[];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));
|
const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));
|
||||||
|
Loading…
Reference in New Issue
Block a user