js代码
let that = this
const ctx = wx.createCanvasContext('shareCanvas');
ctx.setFillStyle('#42d7c8')
ctx.fillRect(0, 0, 350, 700)
ctx.setFillStyle('#333333')
ctx.setFontSize(20)
ctx.font = 'normal bold 15px sans-serif'
ctx.fillText('绿地新都会', 20, 20)
ctx.setFillStyle('white')
ctx.setShadow(0, 5, 16, 'rgba(185,185,185,0.5)');
ctx.fillRect(17, 140, 280, 200)
wx.downloadFile({
url: 'https://file-skg.skg.com/skg.com/20210113/e0abb00dae6f4e0782b002f0831662e6.jpg',
success: res =>{
console.log("Res",res.tempFilePath)
ctx.drawImage(res.tempFilePath,10,10,150,150)
}
})
ctx.draw();
<view class="container">
<canvas canvas-id="shareCanvas" class='canvas-style'>
</canvas>
<view class="linkcopy">
<text>分享链接</text>
<text bindtap="uploads">保存图片</text>
</view>
</view>
cardImg 可以是本地或网络路径
放在这,fail 还是要处理一下的还有就是获取图片 建议还是用getImageInfo吧