获取所有数据并在发送获取站点后创建数组 我该怎么办
[
答案 0 :(得分:0)
async getAllData(){
try {
const keys = await AsyncStorage.getAllKeys();
const stores = await AsyncStorage.multiGet(keys);
return stores.map((store) => { return {[store[0]]: store[1]} })
}catch (error) {
console.log("ERROR", error);
return []
}
}
调用方法
getAllData().then((response)=> {
if(response.length){
console.log(response)
//Here you can call your API
}else{
console.log("NO RECORD FOUND")
}
})