wx.createCanvasContext()停止维护,可以使用NodesRef.context替代
代码示例
<canvas id="ssd" canvas-id="ssd"></canvas>
let canvasBox = null;
// 写法一
canvasBox = wx.createCanvasContext("ssd");
// 写法二
wx.createSelectorQuery()
.select("#ssd")
.context(function (res) {
console.log("节点实例:", res); // 节点对应的 Canvas 实例。
canvasBox = res.context;
})
.exec();
相关文档链接
createCanvasContext:https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html
createSelectorQuery:https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.context.html
网友评论