fix(table): reload in useTable not support await

修复useTable返回的reload方法不支持使用await等待加载完毕的问题
This commit is contained in:
无木 2021-09-16 16:29:26 +08:00
parent e85649bde2
commit 7b6d5e44a9
3 changed files with 5 additions and 3 deletions

View File

@ -3,6 +3,7 @@
- **BasicTable**
- 修复可编辑单元格某些情况下无法提交的问题
- 修复`inset`属性不起作用的问题
- 修复`useTable`与`BasicTable`实例的`reload`方法`await`表现不一致的问题
- **BasicModal**
- 修复点击遮罩、按下`Esc`键都不能关闭`Modal`的问题
- 修复点击关闭按钮、最大化按钮旁边的空白区域也会导致`Modal`关闭的问题

View File

@ -275,7 +275,7 @@ export function useDataSource(
setPagination({
current: currentTotalPage,
});
fetch(opt);
return await fetch(opt);
}
}
@ -295,6 +295,7 @@ export function useDataSource(
items: unref(resultItems),
total: resultTotal,
});
return resultItems;
} catch (error) {
emit('fetch-error', error);
dataSourceRef.value = [];
@ -319,7 +320,7 @@ export function useDataSource(
}
async function reload(opt?: FetchParams) {
await fetch(opt);
return await fetch(opt);
}
onMounted(() => {

View File

@ -68,7 +68,7 @@ export function useTable(tableProps?: Props): [
getForm: () => FormActionType;
} = {
reload: async (opt?: FetchParams) => {
getTableInstance().reload(opt);
return await getTableInstance().reload(opt);
},
setProps: (props: Partial<BasicTableProps>) => {
getTableInstance().setProps(props);