Commit 16ecf71850675be0031f41c8cb91371cf07cbea0

Authored by Vben
1 parent ca717602

fix(table): submitButtonOptions not work,fix #531

src/components/Table/src/BasicTable.vue
... ... @@ -4,7 +4,6 @@
4 4 submitOnReset
5 5 v-bind="getFormProps"
6 6 v-if="getBindValues.useSearchForm"
7   - :submitButtonOptions="{ loading: getLoading }"
8 7 :tableAction="tableAction"
9 8 @register="registerForm"
10 9 @submit="handleSearchInfoChange"
... ... @@ -182,7 +181,7 @@
182 181 replaceFormSlotKey,
183 182 getFormSlotKeys,
184 183 handleSearchInfoChange,
185   - } = useTableForm(getProps, slots, fetch);
  184 + } = useTableForm(getProps, slots, fetch, getLoading);
186 185  
187 186 const getBindValues = computed(() => {
188 187 const dataSource = unref(getDataSourceRef);
... ...
src/components/Table/src/hooks/useTableForm.ts
... ... @@ -6,14 +6,17 @@ import { isFunction } from '/@/utils/is';
6 6 export function useTableForm(
7 7 propsRef: ComputedRef<BasicTableProps>,
8 8 slots: Slots,
9   - fetch: (opt?: FetchParams | undefined) => Promise<void>
  9 + fetch: (opt?: FetchParams | undefined) => Promise<void>,
  10 + getLoading: ComputedRef<boolean | undefined>
10 11 ) {
11 12 const getFormProps = computed(
12 13 (): Partial<FormProps> => {
13 14 const { formConfig } = unref(propsRef);
  15 + const { submitButtonOptions } = formConfig || {};
14 16 return {
15 17 showAdvancedButton: true,
16 18 ...formConfig,
  19 + submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions },
17 20 compact: true,
18 21 };
19 22 }
... ...