May 19, 2021 WeChat Mini Program Development Document
Drawing interfaces and methods
Draws the image so that it remains the original size.
Parameters | Type | Description |
---|---|---|
imageResource | String | The picture resource to draw |
Ⅹ | Number | The x coordinates in the upper left corner of the image |
Y | Number | The y coordinates in the upper left corner of the image |
width | Number | The width of the image |
height | Number | The height of the image |
const ctx = wx.createCanvasContext('myCanvas')
wx.chooseImage({
success: function(res){
ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
ctx.draw()
}
})