fix: fix invalid paging

This commit is contained in:
陈凯龙 2022-03-29 09:31:33 +08:00
parent 0c7276fead
commit ad184ee9c0
1 changed files with 9 additions and 11 deletions

View File

@ -2,7 +2,7 @@ import { Table, TableExpose } from '@/components/Table'
import { ElTable, ElMessageBox, ElMessage } from 'element-plus' import { ElTable, ElMessageBox, ElMessage } from 'element-plus'
import { ref, reactive, watch, computed, unref, nextTick } from 'vue' import { ref, reactive, watch, computed, unref, nextTick } from 'vue'
import { AxiosPromise } from 'axios' import { AxiosPromise } from 'axios'
import { get, assign } from 'lodash-es' import { get } from 'lodash-es'
import type { TableProps } from '@/components/Table/src/types' import type { TableProps } from '@/components/Table/src/types'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
@ -50,15 +50,13 @@ export const useTable = <T, K, L extends AxiosConfig = AxiosConfig>(
}) })
const parmasObj = computed(() => { const parmasObj = computed(() => {
return assign( return {
{ params: {
params: { ...tableObject.parmasObj.params,
pageSize: tableObject.pageSize, pageSize: tableObject.pageSize,
pageIndex: tableObject.currentPage pageIndex: tableObject.currentPage
} }
}, }
tableObject.parmasObj
)
}) })
watch( watch(
@ -125,7 +123,7 @@ export const useTable = <T, K, L extends AxiosConfig = AxiosConfig>(
getList: async () => { getList: async () => {
tableObject.loading = true tableObject.loading = true
const res = await config const res = await config
?.getListApi(unref(parmasObj) as L) ?.getListApi(unref(parmasObj) as unknown as L)
.catch(() => {}) .catch(() => {})
.finally(() => { .finally(() => {
tableObject.loading = false tableObject.loading = false