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>;
|
model: Record<string, any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
defineProps<Props>();
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
interface Emits {
|
interface Emits {
|
||||||
(e: 'reset'): void;
|
(e: 'reset'): void;
|
||||||
@ -29,11 +29,13 @@ const { formRef, validate, restoreValidation } = useNaiveForm();
|
|||||||
|
|
||||||
async function reset() {
|
async function reset() {
|
||||||
await restoreValidation();
|
await restoreValidation();
|
||||||
|
Object.assign(props.model, { ...props.model, page: 1 });
|
||||||
emit('reset');
|
emit('reset');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function search() {
|
async function search() {
|
||||||
await validate();
|
await validate();
|
||||||
|
Object.assign(props.model, { ...props.model, page: 1 });
|
||||||
emit('search');
|
emit('search');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -32,7 +32,7 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
|
|||||||
getData,
|
getData,
|
||||||
searchParams,
|
searchParams,
|
||||||
updateSearchParams,
|
updateSearchParams,
|
||||||
resetSearchParams
|
resetSearchParams: resetSearchParams0
|
||||||
} = useHookTable<A, GetTableData<A>, TableColumn<NaiveUI.TableDataWithIndex<GetTableData<A>>>>({
|
} = useHookTable<A, GetTableData<A>, TableColumn<NaiveUI.TableDataWithIndex<GetTableData<A>>>>({
|
||||||
apiFn,
|
apiFn,
|
||||||
apiParams,
|
apiParams,
|
||||||
@ -172,6 +172,11 @@ export function useTable<A extends NaiveUI.TableApiFn>(config: NaiveUI.NaiveTabl
|
|||||||
scope.stop();
|
scope.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const resetSearchParams = () => {
|
||||||
|
resetSearchParams0();
|
||||||
|
getData();
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading,
|
loading,
|
||||||
empty,
|
empty,
|
||||||
|
Loading…
Reference in New Issue
Block a user