fix: 补齐分享页分页请求客户端

- 让 PageData 支持注入自定义 requestClient

- 修复知识库分享页列表请求仍走默认 api 的问题
This commit is contained in:
2026-04-13 14:55:11 +08:00
parent 31a755a8bc
commit ae10383f17

View File

@@ -13,12 +13,14 @@ interface PageDataProps {
pageSize?: number;
pageSizes?: number[];
extraQueryParams?: Record<string, any>;
requestClient?: any;
}
const props = withDefaults(defineProps<PageDataProps>(), {
pageSize: 10,
pageSizes: () => [10, 20, 50, 100],
extraQueryParams: () => ({}),
requestClient: () => api,
});
// 响应式数据
@@ -38,7 +40,7 @@ const doGet = async (params: Record<string, any>) => {
try {
// 这里替换为你的实际 API 调用
// 例如return await api.get(props.pageUrl, { params })
const response = await api.get(`${props.pageUrl}`, {
const response = await props.requestClient.get(`${props.pageUrl}`, {
params,
});
const data = await response.data;