所有分类
  • 所有分类
  • Html5资源
  • React资源
  • Vue资源
  • Php资源
  • ‌小程序资源
  • Python资源

uni-app 插件,qr-code-parsing 二维码解析(识别)

介绍

QR Code 识别二维码,解析二维码信息。

示例

默认 (可传入图片、chooseImage 选择图片相册及照相机)

<qr-code-parsing @callback="deCodeCallback" :awm-file-path="awmFilePath"></qr-code-parsing>


<script>
    export default {
        data() {
            return {
                awmFilePath: '../../static/qrcode.png',
            }
        },
        methods: {
            deCodeCallback(code) {
                console.log(code)
            }
        }
    }
</script>

deCodeCallback 解码回调
awmFilePath 默认图片

自定义 (可传入图片、chooseImage 选择图片相册及照相机)

<qr-code-parsing ref="qrCodeParsing" :awm-file-path="awmFilePath" @callback="deCodeCallback" :isCustom="true">
    <view class="box">
        <view class="qrcode">
            <image :src="awmFilePath" mode="aspectFit" @click="camera" />
        </view>
        <button class="btn" @click="deCode">解码</button>
    </view>
</qr-code-parsing>

<script>
    export default {
        data() {
            return {
                awmFilePath: '../../static/qrcode.png',
            }
        },
        methods: {
            deCodeCallback(code) {
                console.log(code)
            },
            camera() {
                uni.chooseImage({
                    count: 1,
                    success: res => {
                        this.awmFilePath = res.tempFilePaths[0];
                    }
                })
            },
            deCode() {
                this.$refs.qrCodeParsing.deCode(this.awmFilePath)
            }
        }
    }
</script>

isCustom 是否自定义Boolean
deCodeCallback 解码回调
awmFilePath 默认图片

预览

资源下载
下载价格免费
注意:本网站资源属于虚拟产品,不支持退款。请谨慎购买! 购买后资源无法下载,请联系客服QQ:844475003
原文链接:https://code.ifrontend.net/archives/247,转载请注明出处。
0

评论0

显示验证码
没有账号?注册  忘记密码?