我正在使用 react-native-fetch-blob 实现下载PDF文件。但我有一个错误" 无法找到变量:已收到"
onPDFPressed(){
RNFetchBlob
.config({
notification: true,
path: 'downloads/pdf_test.pdf',
indicator: true,
overwrite: true,
addAndroidDownloads: {
path: RNFetchBlob.fs.dirs.SDCardDir +'/downloads/pdf_test.pdf',
useDownloadManager: true,
notification: true,
overwrite: true,
description: 'downloading content...',
mime: 'application/pdf',
mediaScannable: false
}
})
.fetch('GET', 'http://www.pdf995.com/samples/pdf.pdf')
.progress(received, total)
{
console.log('progress', received / total)
}
}
有任何想法或建议吗?提前谢谢。
答案 0 :(得分:0)
return
函数需要获取函数,而不是两个变量作为参数。这是您需要更改为:
function getStudents() {
var students = [];
students[0] = {name: "Anna", mark: 65, sex: "female"};
students[1] = {name: "James", mark:33, sex: "male"};
students[2] = {name: "William", mark: 87, sex: "male"};
students[3] = {name: "Jane", mark: 72, sex: "female"};
students[4] = {name: "Rikki", mark: 60, sex: "male"};
students[5] = {name: "Angela", mark: 58, sex: "female"};
return students;
}