fix: 补齐分享页分页请求客户端
- 让 PageData 支持注入自定义 requestClient - 修复知识库分享页列表请求仍走默认 api 的问题
This commit is contained in:
@@ -13,12 +13,14 @@ interface PageDataProps {
|
|||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
pageSizes?: number[];
|
pageSizes?: number[];
|
||||||
extraQueryParams?: Record<string, any>;
|
extraQueryParams?: Record<string, any>;
|
||||||
|
requestClient?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = withDefaults(defineProps<PageDataProps>(), {
|
const props = withDefaults(defineProps<PageDataProps>(), {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
pageSizes: () => [10, 20, 50, 100],
|
pageSizes: () => [10, 20, 50, 100],
|
||||||
extraQueryParams: () => ({}),
|
extraQueryParams: () => ({}),
|
||||||
|
requestClient: () => api,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 响应式数据
|
// 响应式数据
|
||||||
@@ -38,7 +40,7 @@ const doGet = async (params: Record<string, any>) => {
|
|||||||
try {
|
try {
|
||||||
// 这里替换为你的实际 API 调用
|
// 这里替换为你的实际 API 调用
|
||||||
// 例如:return await api.get(props.pageUrl, { params })
|
// 例如:return await api.get(props.pageUrl, { params })
|
||||||
const response = await api.get(`${props.pageUrl}`, {
|
const response = await props.requestClient.get(`${props.pageUrl}`, {
|
||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
const data = await response.data;
|
const data = await response.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user