Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andrewgreat opened this issue Feb 17, 2023 · 3 comments
Open

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

andrewgreat opened this issue Feb 17, 2023 · 3 comments

Comments

@andrewgreat
Copy link

环境: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”,出现以下错误。
类型“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”,出现以下错误。
类型“typeof import("d:/workspace/study/dashboard/node_modules/@dataview/datav-vue3/es/index")”的参数不能赋给类型“Plugin_2<{ classNamePrefix: string; }>”的参数。ts(2769)

@daidaihk
Copy link

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

@andrewgreat
Copy link
Author

可以看看这个: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)

@locagdgz
Copy link

要改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",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants