feat: 优化
This commit is contained in:
@@ -40,12 +40,28 @@ export function useBenchmarkData() {
|
||||
console.log('抖音返回的原始数据:', awemeList[0])
|
||||
data.value = mapFromDouyin(awemeList)
|
||||
console.log('映射后的第一条数据:', data.value[0])
|
||||
|
||||
return {
|
||||
maxCursor: resp?.data?.max_cursor || 0,
|
||||
hasMore: resp?.data?.has_more || !(resp?.data?.aweme_list?.length < (resp?.data?.count || 20)),
|
||||
count: data.value.length,
|
||||
}
|
||||
} else {
|
||||
const notes = resp?.data?.notes || resp?.data?.data || []
|
||||
data.value = mapFromXhs(notes)
|
||||
|
||||
return {
|
||||
maxCursor: resp?.data?.max_cursor || 0,
|
||||
hasMore: resp?.data?.has_more || false,
|
||||
count: data.value.length,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function appendData(newItems) {
|
||||
data.value = [...data.value, ...newItems]
|
||||
}
|
||||
|
||||
async function clearData() {
|
||||
data.value = []
|
||||
selectedRowKeys.value = []
|
||||
@@ -60,6 +76,7 @@ export function useBenchmarkData() {
|
||||
saveTableDataToSession,
|
||||
loadTableDataFromSession,
|
||||
processApiResponse,
|
||||
appendData,
|
||||
clearData,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user