pulilab / vue-qr-reader

Vue component to scan QR codes
https://pulilab.github.io/vue-qr-reader/#/
MIT License
49 stars 13 forks source link

document is not defined in Nuxt, even if I use <client-only> #27

Open radislaw opened 4 years ago

radislaw commented 4 years ago

I use vue-qr-reader in Nuxt project

<template>
  <client-only>
     <vue-qr-reader @code-scanned="getQrContent" />
  </client-only>
</template>

<script>
import VueQrReader from 'vue-qr-reader/dist/lib/vue-qr-reader.umd.js'
...

I have an error: document is not defined

MartCube commented 4 years ago

I get the same error, did you solved this issue ?

kmbjz commented 4 years ago
export default {
    components: {
      'vue-qr-reader': () => process.browser ? import('vue-qr-reader/dist/lib/vue-qr-reader.umd.js') : null
    }
    ...
}
william-iq397 commented 1 year ago

<ClientOnly> <qrcode-stream @init="onInit()" @decode="onDecode()"></qrcode-stream> </ClientOnly> import qrcode from "vue3-qrcode-reader"

I get the same error how can I solve it