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