组件得编写
一个组件需要请求远程得参数,暴露出对应得promise函数
export type ProductList = {
total: number;
list:Array<{
id:string;
name:string;
}>
}
export type RequestData = {
pageInfo:{currentPage:number,pageSize:number},
searchParams:{name:string,id:string}
}
export type AsyncProductList = ( pageInfo:{currentPage:number,pageSize:number},searchParams:{name:string,id:string})=>Promise<ProductList>
export type IComponentsProps = {
//the service to get product list
loadProduct: AsyncProductList
}
export function test111(data:RequestData){
return Axios<ProductList>({
url: `api/xxx`,
method: 'get',
...data,
})
}

浙公网安备 33010602011771号