Binaryify / vue-qr

The Vue Component for Awesome-qr.js
MIT License
849 stars 123 forks source link

ts 引入报错 #61

Closed xiaohaiH closed 5 years ago

xiaohaiH commented 5 years ago

请问这个错误怎么解决啊? 试着声明了 declare module 'vue-qr', 提示无法扩大声明, 不知道怎么解决了

image

Could not find a declaration file for module 'vue-qr'. 'E:/systemDirectory/project/ts-jingtou/node_modules/_vue-qr@2.1.0@vue-qr/dist/vue-qr.js' implicitly has an 'any' type.
  Try `npm install @types/vue-qr` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-qr';`
shen-lan commented 4 years ago

怎么解决的 ?

PLQin commented 3 years ago

不要用ts , 或者自己手写个隐式声明

PLQin commented 3 years ago

不要在 main.js 里面使用

import VueQr from 'vue-qr'

new Vue({
    components: {VueQr}
})

而是在vue文件中使用 :

// https://github.com/Binaryify/vue-qr
// 基于Vue2.X 的二维码组件
import VueQr from 'vue-qr'

export default {
  components: { VueQr },
}