May 19, 2021 WeChat Mini Program Development Document
Drawing interfaces and methods
Parameters | Type | Required | Description | The lowest version |
---|---|---|---|---|
Ⅹ | Number | Whether | Canvas x-axis starting point (default 0) | 1.2.0 |
Y | Number | Whether | Canvas y-axis starting point (default 0) | 1.2.0 |
width | Number | Whether | Canvas width (canvas width-x by default) | 1.2.0 |
height | Number | Whether | Canvas height (canvas height-y by default) | 1.2.0 |
destWidth | Number | Whether | Output picture width (width by default) | 1.2.0 |
destHeight | Number | Whether | Output picture height (high by default) | 1.2.0 |
canvasId | String | Is |
Canvas logo, incoming
<canvas/>
cavas-id
|
|
fileType | String | Whether | The type of target file, only 'jpg' or 'png' is supported. Default is 'png' | 1.7.0 |
quality | Number | Whether | The quality of the picture, with a value range of (0, 1), is treated as 1.0 when it is not in range | 1.7.0 |
success | Function | Whether | The interface calls a successful callback function | |
fail | Function | Whether | The interface calls the failed callback function | |
complete | Function | Whether | Callback function at end of interface call (call succeeds, fails are executed) |
|
wx.canvasToTempFilePath({
x: 100,
y: 200,
width: 50,
height: 50,
destWidth: 100,
destHeight: 100,
canvasId: 'myCanvas',
success: function(res) {
console.log(res.tempFilePath)
}
})