所以我有一个画布,我想从中将导出的文件上传到firebase。现在,我将其导出为数据网址,如下所示:
handleClick = (e) => {
const makeDrawing = (canvas) => {
this.Draw(e.pageX - 305 - canvas.offsetLeft, e.pageY-100 - canvas.offsetTop);
};
const {textLength, tasks} = this.props;
const canvas = document.getElementById('canvas');
if (textLength === 'over200' || textLength === 'under200') {
if (tasks !== 0) {
return null;
}
}
makeDrawing(canvas);
this.props.setTasks(tasks + 1);
const img = new Image();
img.src = canvas.toDataURL();
this.props.setEditedImage(img);
};
我还在React和Redux上使用React。
那到底是怎么回事:
这就是现在的功能。我需要添加的按钮是将dataURL作为文件发送到Firebase存储的按钮。
我该如何实现?