<canvas type="2d" id="shareCanvas0" style="height: 1196rpx;width:578rpx;position: fixed;z-index: -100; left: -99999rpx"></canvas>
//绘图 getCanvas(index){ var self=this; console.log('绘图') const query = wx.createSelectorQuery(); query.select("#shareCanvas0") .fields({ node: true, size: false }).exec((res) => { const canvas = res[0].node; const ctx = canvas.getContext('2d'); canvas.width = 1144; canvas.height = 2392; self.setData({ drawing: true, }) new Promise(function (resolve) { // 绘制背景图片 wx.getImageInfo({ src: self.data.posterBg, //网络图片 success(res) { const img = canvas.createImage(); img.src = res.path; img.onload = () => { ctx.drawImage(img, 0, 0, 1144, 2392); resolve(true); } }