yugasun / qrcode-decoder

🤘Tool for decoding qrcode by image,video or camera.
https://yugasun.github.io/qrcode-decoder/
MIT License
97 stars 35 forks source link

在vue中使用报错 #9

Closed kevinzhou1990 closed 3 years ago

kevinzhou1990 commented 4 years ago

<script> import qrcodeDecoder from "qrcode-decoder"; export default { name: "UploadIdentity", components: { "my-header": header }, data() { return { imgSrc: "" }; }, methods: { // 获取选中的图片文件 getFile(e) { let file = e.target.files[0]; let fr = new FileReader(); fr.readAsDataURL(file); fr.onload = () => { this.$refs.qrcode.src = fr.result; // let qr = new QrcodeDecoder(); console.log(this.$refs.qrcode); // qr.decodeFromImage(this.$refs.qrcode).then(res => { // console.log(res); // }); }; } } };

只要引入这个插件,就报如下错误

app.js:957 Error: only one instance of babel-polyfill is allowed at Object.eval (VM532719 index.js:10) at eval (VM532719 index.js:29) at Object../node_modules/babel-polyfill/lib/index.js (vendors~settings.js:11) at webpack_require__ (app.js:833) at fn (app.js:130) at eval (index.esm.js?5c8e:1) at Module../node_modules/qrcode-decoder/dist/index.esm.js (vendors~settings.js:2983) at webpack_require__ (app.js:833) at fn (app.js:130) at eval (cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js?!./src/views/settings/account/upload.vue?vue&type=script&lang=js&:3)

yugasun commented 3 years ago

已解决