fix(sj_1.0.0_beta4): 修复表单搜索分页问题

This commit is contained in:
xlsea 2024-06-04 15:24:16 +08:00
parent 970cbfdf65
commit 8702f3f542
2 changed files with 9 additions and 2 deletions

View File

@ -12,7 +12,7 @@ interface Props {
model: Record<string, any>;
}
defineProps<Props>();
const props = defineProps<Props>();
interface Emits {
(e: 'reset'): void;
@ -29,11 +29,13 @@ const { formRef, validate, restoreValidation } = useNaiveForm();
async function reset() {
await restoreValidation();
Object.assign(props.model, { ...props.model, page: 1 });
emit('reset');
}
async function search() {
await validate();
Object.assign(props.model, { ...props.model, page: 1 });
emit('search');
}
</script>

View File

@ -32,7 +32,7 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
getData,
searchParams,
updateSearchParams,
resetSearchParams
resetSearchParams: resetSearchParams0
} = useHookTable<A, GetTableData<A>, TableColumn<NaiveUI.TableDataWithIndex<GetTableData<A>>>>({
apiFn,
apiParams,
@ -172,6 +172,11 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
scope.stop();
});
const resetSearchParams = () => {
resetSearchParams0();
getData();
};
return {
loading,
empty,