Jelajahi Sumber

!177 修复useTable在total为0时的bug
Merge pull request !177 from nullcache/bug/add-fix-useTable

芋道源码 1 tahun lalu
induk
melakukan
c0bf357d7a
1 mengubah file dengan 1 tambahan dan 3 penghapusan
  1. 1 3
      src/hooks/web/useTable.ts

+ 1 - 3
src/hooks/web/useTable.ts

@@ -136,9 +136,7 @@ export const useTable = <T = any>(config?: UseTableConfig<T>) => {
       })
       })
       if (res) {
       if (res) {
         tableObject.tableList = (res as unknown as ResponseType).list
         tableObject.tableList = (res as unknown as ResponseType).list
-        if ((res as unknown as ResponseType).total) {
-          tableObject.total = (res as unknown as ResponseType).total as unknown as number
-        }
+        tableObject.total = (res as unknown as ResponseType).total ?? 0
       }
       }
     },
     },
     setProps: async (props: TableProps = {}) => {
     setProps: async (props: TableProps = {}) => {