| | |
| | | }, |
| | | //回调扫描结果 |
| | | onDecode(result) { |
| | | console.log(result); |
| | | if (result !== "") { |
| | | this.result=result |
| | | this.$emit("ok",result) |
| | | alert(result) |
| | | this.$emit("ok",this.result) |
| | | this.cancelCode() |
| | | } |
| | | }, |
| | | // 相机反转 |
| | |
| | | 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: 您需要授予相机访问权限"; |
| | |
| | | } |
| | | }, |
| | | watch: { |
| | | "result": { |
| | | handler(newVal) { |
| | | console.log('扫描值' + newVal); |
| | | }, |
| | | deep: true |
| | | } |
| | | |
| | | } |
| | | }; |
| | | </script> |