const productListData = ref<recordsT[]>([])
const total = ref(0)
// 类型声明
type productListDataT = {
records?: recordsT[],
total?: number
}
type recordsT = {
companyName?: string,
cycle?: number,
maxLimit?: number;
productName?: string,
rateBegin?: number;
rateEnd?: number;
rateTime?: number;
}
const getProductListAPI = async () => {
try {
const res = await http.post<productListDataT>('/api/vi/category/load', listQueryParams.value)
for (let i = 0; i < res.records.length; i++) {
productListData.value.push(res.records[i])
}
total.value = res?.total;
listQueryParams.value.page++;
if (productListData.value!.length >= total.value) {
finished.value = true;
}
} catch (error) {
console.log(error)
} finally {
loading.value = false;
}
}