代码为:
import VueXxx from './src/VueXxx.vue'
import Vue from 'vue'
VueXxx.install = (vue: Vue) => {
vue.component(VueXxx.name, VueXxx)
}
export default VueXxx
报错:
Property 'install' does not exist on type 'VueConstructor<Vue>'.ts(2339)
Property 'component' does not exist on type 'Vue'.ts(2339)
我改成any
就不报错了:
(VueXxx as any).install = (vue: any) => {
vue.component(VueXxx.name, VueXxx)
}
请问,只能这么做吗?