子域离屏canvas画不到主域上
发布于 6 年前 作者 qinjuan 691 次浏览 来自 问答
// src/myOpenDataContext/index.js
let sharedCanvas = wx.getSharedCanvas();
let context = sharedCanvas.getContext("2d");
 
context.fillStyle = "#fff";
context.fillRect(0, 0, 100, 100);
 
context.fillText("获取的数据", 0, 0);
//game.js
 
let openDataContext = wx.getOpenDataContext();
let sharedCanvas = openDataContext.canvas;
 
 
let canvas = wx.createCanvas();
let context = canvas.getContext("2d");
context.drawImage(sharedCanvas, 0, 0);
 
// new Main();

我想让开放域上的离屏canvas在主域上显示,但是完全没效果,全部是黑色,这是为什么

1 回复

解决了吗,同问

回到顶部