简体   繁体   English

从react-konva中的舞台获取dataUrl

[英]Get dataUrl from stage in react-konva

I rendered konva stage with 2 images overlapping each other. 我用两个相互重叠的图像渲染了konva舞台。 Now, I am trying to export the overlapped image from the stage and canvas. 现在,我试图从舞台和画布中导出重叠的图像。 I tried to get const dataURL = this.stageNode.getStage().toDataURL(); 我试图获取const dataURL = this.stageNode.getStage().toDataURL(); and added stageNode like 并添加了stageNode像

 <Stage ref={node => {
      this.stageNode = node;
    }}>

But still I am not able to access base64 string from stage. 但是我仍然无法从阶段访问base64字符串。 A trail with react kova image sample 与kova图像样本反应的线索

PS:This is related to https://github.com/konvajs/react-konva/issues/305 to some extent PS:这在某种程度上与https://github.com/konvajs/react-konva/issues/305有关

Using images from same domain solves the issue which was faced, could not implement the fix in online demo. 使用来自相同域的图像解决了所面临的问题,无法在在线演示中实施此修复程序。 Thanks @lavrton for prompt reply 感谢@lavrton的迅速回复

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM