From 9563c073cf9411de5f23922ba147c3622f667af0 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Thu, 5 Oct 2023 00:41:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E2=80=9C=E5=B2=97?= =?UTF-8?q?=E4=BD=8D=E7=AE=A1=E7=90=86=E2=80=9D-pagination=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E3=80=81=E5=8F=98=E6=8D=A2page=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E6=97=B6=E6=8E=92=E5=BA=8F=E7=9A=84=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/post/utils/hook.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/views/system/post/utils/hook.tsx b/src/views/system/post/utils/hook.tsx index 3c6d092..264c9fe 100644 --- a/src/views/system/post/utils/hook.tsx +++ b/src/views/system/post/utils/hook.tsx @@ -16,7 +16,7 @@ const statusMap = useUserStoreHook().dictionaryMap["common.status"]; export function usePostHook() { const defaultSort: Sort = { - prop: "post_sort", + prop: "postSort", order: "ascending" }; @@ -117,7 +117,7 @@ export function usePostHook() { sortState.value = sort; // 表格列的排序变化的时候,需要重置分页 pagination.currentPage = 1; - getPostList(sort); + getPostList(); } async function onSearch(tableRef) { @@ -126,7 +126,7 @@ export function usePostHook() { // 点击搜索的时候,需要清空表格上列的排序 tableRef.getTableRef().clearSort(); // 使用默认排序发起请求 - getPostList(defaultSort); + getPostList(); } function resetForm(formEl, tableRef) { @@ -144,11 +144,9 @@ export function usePostHook() { onSearch(tableRef); } - async function getPostList(sort: Sort = defaultSort) { + async function getPostList() { pageLoading.value = true; - if (sort != null) { - CommonUtils.fillSortParams(searchFormParams, sort); - } + CommonUtils.fillSortParams(searchFormParams, sortState.value); CommonUtils.fillPaginationParams(searchFormParams, pagination); const { data } = await getPostListApi(toRaw(searchFormParams)).finally(