feat:更改页面
This commit is contained in:
1 parent
b422df5b76
commit
44b2df144c
84 files changed
+11701
-2114
No files matched your search
+4
-4
@@ -132,13 +132,13 @@ export function useTable(options?: BasicTableProps) {
|
||||
ascs: state.ascs?.join(","),
|
||||
})
|
||||
|
||||
// 设置表格展示的数据数组
|
||||
state.dataList = state.isPage ? res.data[state.props.item] : res.data
|
||||
// 设置表格展示的数据数组;后端对无数据场景可能返回 data:null,统一兜底避免 TypeError
|
||||
state.dataList = state.isPage ? (res.data?.[state.props.item] ?? []) : (res.data ?? [])
|
||||
// 设置分页信息中的总数据条数
|
||||
state.pagination!.total = state.isPage ? res.data[state.props.totalCount] : 0
|
||||
state.pagination!.total = state.isPage ? (res.data?.[state.props.totalCount] ?? 0) : 0
|
||||
} catch (err: any) {
|
||||
// 捕获异常并显示错误提示
|
||||
ElMessage.error(err.msg || err.data.msg)
|
||||
ElMessage.error(err.msg || err.data?.msg || "查询失败")
|
||||
} finally {
|
||||
// 结束加载数据,设置state.loading为false
|
||||
state.loading = false
|
||||
|
||||
Reference in new issue
Block a user