my.scan
Call the scan QR code function.
Sample Code
copy
Page({
scan() {
my.scan({
type: 'qr',
success: (res) => {
my.alert({ title: res.code });
},
});
}
})
Parameters
Name | Type | Mandatory | Description |
type | String | No | Type for scanning (qr by default):  1. qr :  two-dimensional QR scanning frame  2. bar :  Linear barcode scanning frame |
hideAlbum | Boolean | No | Hide camera or not (does not allow  selecting from album); scan from camera only |
success | Function | No | Callback function upon call success |
fail | Function | No | Callback function upon call failure |
complete | Function | No | Callback function upon call  completion (to be executed upon either call success or failure) |
Success Callback Function
The incoming parameter is of the Object type with the following attributes:
Name | Type | Description |
code | String | Data resulting from scanning |
qrCode | String | QR code data returned from scanning |
barCode | String | Bar code data returned from scanning |
Error Code
error | Description |
10 | User cancellation |
11 | Operation failure |