function getReader(response){
return new Promise(function(resolve,reject){
response.blob().then( blob => {
const reader = new FileReader();
reader.addEventListener("loadend", function() {
resolve(reader.result)
});
reader.readAsDataURL(blob);
})
})
}
async function getFileObjfun (response){
return await getReader(response);
}
在effects中设置一个转换函数 yield调用上边转换
*getFileObj({payload},{call,put}){
const data = yield call(getFileObjfun,payload);
// console.log(data,"xxxx")
yield put({
type: 'savePDf',
payload:data
})
},
原文地址:https://www.cnblogs.com/chengyunshen/p/11811179.html
时间: 2024-10-19 07:08:02