vue+ts全局注册报错
freebsdly opened this issue · 2 comments
freebsdly commented
使用vue+ts+element在全局注册时,报错
package.json如下:
{
"name": "vuetest",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"element-ui": "^2.4.5",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-dynamic-form-component": "^2.8.0",
"vue-property-decorator": "^8.4.2",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-typescript": "^5.0.2",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"typescript": "~3.9.3",
"vue-cli-plugin-element": "~1.0.1",
"vue-template-compiler": "^2.6.11"
}
}
报错信息如下:
没有与此调用匹配的重载。
第 1 个重载(共 2 个),“(plugin: PluginObject<unknown> | PluginFunction<unknown>, options?: unknown): VueConstructor<Vue>”,出现以下错误。
类型“typeof DynamicForm”的参数不能赋给类型“PluginObject<unknown> | PluginFunction<unknown>”的参数。
类型 "typeof DynamicForm" 中缺少属性 "install",但类型 "PluginObject<unknown>" 中需要该属性。
第 2 个重载(共 2 个),“(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>”,出现以下错误。
类型“typeof DynamicForm”的参数不能赋给类型“PluginObject<any> | PluginFunction<any>”的参数。
类型 "typeof DynamicForm" 中缺少属性 "install",但类型 "PluginObject<any>" 中需要该属性。ts(2769)
plugin.d.ts(6, 3): 在此处声明了 "install"。
plugin.d.ts(6, 3): 在此处声明了 "install"。
请问这个怎么解决?
chenquincy commented
@freebsdly 试试
Vue.use(DynamicForm as any);
chenquincy commented
长时间无回复,issue 暂时关闭,有问题可以再提 issue