zouyu
2023-12-25 4636619883885100045bf8a91a70012c9b554294
src/views/common/qrCodeApp.vue
@@ -35,16 +35,14 @@
    created() { },
    methods: {
        openCamera(){
            this.camera="front"
            this.camera='rear'
        },
        //回调扫描结果
        onDecode(result) {
            console.log(result);
            if (result !== "") {
                this.result=result
                this.$emit("ok",this.result)
                this.cancelCode()
                // alert(result)
            }
        },
        // 相机反转
@@ -75,12 +73,7 @@
        async onInit(promise) {
            try {
                const { capabilities } = await promise;
                console.log(
                    "🚀 ~ file: cameracomponent.vue:47 ~ onInit ~ capabilities",
                    capabilities
                );
            } catch (error) {
                // console.log()
                this.$toast(error.name);
                if (error.name === "NotAllowedError") {
                    this.error = "ERROR: 您需要授予相机访问权限";
@@ -106,12 +99,7 @@
        }
    },
    watch: {
        "result": {
            handler(newVal) {
                console.log('扫描值' + newVal);
            },
            deep: true
        }
    }
};
</script>