HJ29 / vue3-qr-reader

87 stars 26 forks source link

demo test #1

Closed swana1337 closed 3 years ago

swana1337 commented 3 years ago

hello, i was just trying to code along the demo. image

in the shim-vue.d.ts file i got an error: Parsing error: Imports within a declare module body must always be import type or import typeof

Can you think of why this is happening? Thanks

HJ29 commented 3 years ago

this file isnt necessary to use this package, just revert this file back what it is before, if u dont hv this file originally, remove this file.

swana1337 commented 3 years ago

if i remove it i got an error in main.ts image

swana1337 commented 3 years ago

if i got the other file it works

HJ29 commented 3 years ago

i initialize a vue project with vue cli shims-vue.d.ts orginally has these code. Try copy these to shims-vue.d.ts?

/* eslint-disable */
declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}
swana1337 commented 3 years ago

now it compiles at least, but it still doesn't work to run. Nevertheless, thank you for the help :)

HJ29 commented 3 years ago

I don't know why it doesn't work in your project. I just create a new vue project and try to install this package What i did,

  1. vue create testproject, cd ./testproject
  2. yarn add vue3-qr-reader
  3. modify App.vue
    
    <template>
    <qr-stream></qr-stream>
    </template>
4. modify shims-vue.d.ts file
``` ts
/* eslint-disable */
declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}

declare module 'vue3-qr-reader' {
  export {
    QrStream
  }
}
  1. yarn serve, and it works

Looks like you gave up using this package, I will close this issue. Open issue again if you have other question, thanks.