DataV-Vue3 icon indicating copy to clipboard operation
DataV-Vue3 copied to clipboard

引入包@dataview/datav-vue3并挂载报错

Open andrewgreat opened this issue 2 years ago • 3 comments

环境:webpack+vue3+ts

在main.ts文件中引入并挂载 import DataV from "@dataview/datav-vue3"; ... app.use(router).use(DataV, { classNamePrefix: "dv-" }); 有错误提示,运行时报错不能通过: import DataV 没有与此调用匹配的重载。 第 1 个重载(共 2 个),“(plugin: Plugin_2<[{ classNamePrefix: string; }]>, options_0: { classNamePrefix: string; }): App<Element>”,出现以下错误。 类型“typeof import("d:/workspace/study/dashboard/node_modules/@dataview/datav-vue3/es/index")”的参数不能赋给类型“Plugin_2<[{ classNamePrefix: string; }]>”的参数。 第 2 个重载(共 2 个),“(plugin: Plugin_2<{ classNamePrefix: string; }>, options: { classNamePrefix: string; }): App<Element>”,出现以下错误。 类型“typeof import("d:/workspace/study/dashboard/node_modules/@dataview/datav-vue3/es/index")”的参数不能赋给类型“Plugin_2<{ classNamePrefix: string; }>”的参数。ts(2769)

andrewgreat avatar Feb 17 '23 05:02 andrewgreat

可以看看这个:http://t.csdn.cn/EuX68

daidaihk avatar Feb 26 '23 12:02 daidaihk

可以看看这个:http://t.csdn.cn/EuX68

按这个方法修改后又报这个错:Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/@dataview_datav-vue3.js?v=745ff770' does not provide an export named 'default' (at main.ts:4:8)

andrewgreat avatar Mar 02 '23 00:03 andrewgreat

要改node_modules/@dataview/datav-vue3/package.json文件里的module项配置,从./es/index.js改为./es/index.mjs就好了。我的datav版本是0.0.0-test.1672506674342 vue版本是"vue": "^3.2.47",

locagdgz avatar Mar 22 '23 03:03 locagdgz