问题描述
我正在尝试在react.make一个进度栏,上传文件后出现此错误:
错误:调用:类型为{context,fn}的参数未定义或为空fn
saga.js:
const identity = a => a;
const createAsync = file => {
let emit;
const chan = eventChannel(emitter => {
emit = emitter;
return () => {};
});
const promise = uploadVideoApi(file,function(e) {
emit((e.loaded * 100) / e.total);
});
return [promise,chan];
};
function* watchOnProgress(chan) {
while (true) {
const data = yield take(chan);
yield put(uploadFileProgress(data));
}
}
function* uploadVideo({ file }) {
const [promise,chan] = createAsync(file);
yield fork(watchOnProgress,chan);
const result = yield call(identity(promise));
}
actions.js:
export function uploadFileProgress(percent) {
return {
type: UPLOAD_VIDEO_PROGRESS,percent,};
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)