标签:const res effect resolve sda new reader 预览 func
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
})
},
标签:const res effect resolve sda new reader 预览 func
原文地址:https://www.cnblogs.com/chengyunshen/p/11811179.html