
这个功能需要使用5+的API才能实现。
代码如下:
uni.downloadFile({
url: '网络图片地址',
success: (res) => {
if (res.statusCode === 200) {
plus.barcode.scan(res.tempFilePath, (type, res) => {
uni.hideLoading()
if (type == 0) {
plus.runtime.openURL(res)
}
}, (e) => {
uni.hideLoading()
if (e.code == 3) {
tools.showToast('未识别到二维码')
} else {
tools.showToast('无法识别此图片')
}
})
}
}
})