fix(demo): resolve key not exist warnings

修复角色编辑页面可能会出现tree组件报key not exist警告的问题
This commit is contained in:
无木 2021-07-07 21:26:20 +08:00
parent 542121129e
commit 45a94e41c1

View File

@ -47,6 +47,10 @@
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
resetFields();
setDrawerProps({ confirmLoading: false });
// setFieldsValuetreeDataTreekey not exist
if (unref(treeData).length === 0) {
treeData.value = (await getMenuList()) as any as TreeItem[];
}
isUpdate.value = !!data?.isUpdate;
if (unref(isUpdate)) {
@ -54,7 +58,6 @@
...data.record,
});
}
treeData.value = (await getMenuList()) as any as TreeItem[];
});
const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));