fix(sj_1.0.0_beta4): 修复表单搜索分页问题
This commit is contained in:
parent
970cbfdf65
commit
8702f3f542
@ -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>
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user