在获取cav文件解析时由于异步原因导致无法获取
使用async与Promise对象即可解决
async function revealParse(path, fileName) {
let stuAnswer = await parseFile(`Files/${path}/${fileName}`);
console.log(JSON.stringify(stuAnswer))
}
//解析CSV
function parseFile(path) {
return new Promise(function (resolve) {
Papa.parse(`${path}`, { //path为文件URL
download: true,
complete: function (results) {
resolve(results.data);
}
});
})
}