Skip to content

Commit

Permalink
fix(demo): resolve key not exist warnings
Browse files Browse the repository at this point in the history
修复角色编辑页面可能会出现tree组件报key not exist警告的问题
  • Loading branch information
mynetfan committed Jul 7, 2021
1 parent 5421211 commit 45a94e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/views/demo/system/role/RoleDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
resetFields();
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;
if (unref(isUpdate)) {
setFieldsValue({
...data.record,
});
}
treeData.value = (await getMenuList()) as any as TreeItem[];
});
const getTitle = computed(() => (!unref(isUpdate) ? '新增角色' : '编辑角色'));
Expand Down

0 comments on commit 45a94e4

Please sign in to comment.