大家好,今天给大家带来的是如何在小程序中实现扫描二维码功能,话不多说,上代码
<template>
<view @click="handeleQrcode">
扫码
</view>
<script>
const handeleQrcode = async () => {
uni.scanCode({
onlyFromCamera: false,
success: (res) => {
console.log('扫码结果res', res)
},
fail:(error) => {
console.log(error)
}
});
};
</script>
uni.scanCode(OBJECT)
有疑惑的,请看官网详细介绍,也可以评论和私信。希望可以给大家带来帮助,有问题请及时指出。如果可以的话,请点赞收藏关注~~
地址:https://uniapp.dcloud.net.cn/api/system/barcode.html#scancode