Vue3安裝dataV報(bào)錯(cuò)問(wèn)題解決方案
安裝
npm install @dataview/datav-vue3
引入
1. 完整引入
import { createApp } from 'vue'; import App from './App.vue'; import router from './router'; import store from './store'; import dataV from '@dataview/datav-vue3'; const app = createApp(App); app.use(dataV); app.use(store); app.use(router); app.mount('#app');
報(bào)錯(cuò)
Compiled with problems:X
ERROR in ./src/main.ts 12:0-41
Module not found: Error: Can't resolve '@dataview/datav-vue3' in 'E:\Work\VSCodeTest\training\test\vue-test\src'
ERROR in ./src/main.ts 12:0-41Module not found: Error: Can't resolve '@dataview/datav-vue3' in 'E:\Work\VSCodeTest\training\test\vue-test\src'
ERROR in src/main.ts:15:9TS2769: No overload matches this call.
Overload 1 of 2, '(plugin: Plugin_2<[{ classNamePrefix: string; }]>, options_0: { classNamePrefix: string; }): App<Element>', gave the following error.
Argument of type 'typeof import("E:/Work/VSCodeTest/training/test/vue-test/node_modules/@dataview/datav-vue3/es/index")' is not assignable to parameter of type 'Plugin_2<[{ classNamePrefix: string; }]>'.
Property 'install' is missing in type 'typeof import("E:/Work/VSCodeTest/training/test/vue-test/node_modules/@dataview/datav-vue3/es/index")' but required in type '{ install: (app: App<any>, options_0: { classNamePrefix: string; }) => any; }'.
Overload 2 of 2, '(plugin: Plugin_2<{ classNamePrefix: string; }>, options: { classNamePrefix: string; }): App<Element>', gave the following error.
Argument of type 'typeof import("E:/Work/VSCodeTest/training/test/vue-test/node_modules/@dataview/datav-vue3/es/index")' is not assignable to parameter of type 'Plugin_2<{ classNamePrefix: string; }>'.
Property 'install' is missing in type 'typeof import("E:/Work/VSCodeTest/training/test/vue-test/node_modules/@dataview/datav-vue3/es/index")' but required in type '{ install: (app: App<any>, options: { classNamePrefix: string; }) => any; }'.
13 |
14 | const app = createApp(App);
> 15 | app.use(DataV, { classNamePrefix: 'dv-' });
| ^^^^^
16 | app.use(store);
17 | app.use(router);
18 | app.mount('#app')
2. 按需引入
<template> <BorderBox1>BorderBox1</BorderBox1> </template> <script lang='ts'> import { BorderBox1 } from '@dataview/datav-vue3'; export default { components: {BorderBox1}, }; </script> <style lang='scss'></style>
報(bào)錯(cuò)
Compiled with problems:X
ERROR in ./src/views/LargeDataScreen.vue?vue&type=script&lang=ts (./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-41.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/views/LargeDataScreen.vue?vue&type=script&lang=ts) 1:0-50
Module not found: Error: Can't resolve '@dataview/datav-vue3' in 'E:\Work\VSCodeTest\training\test\vue-test\src\views'
解決方案
1.忽略聲明警告
文件:/src/shims-vue.d.ts
declare module '@dataview/datav-vue3';
2.dataV配置文件修改
文件:@dataview\datav-vue3/package.json
// "module": "./es/index.js", "module": "./es/index.mjs", // 修改后
3.如果使用完整引入,需要為datav配置文件添加相應(yīng)方法
文件:@dataview\datav-vue3/es/index.mjs
// 全局注冊(cè)方法 // 存在問(wèn)題,未對(duì)setClassPrefix方法處理 // D、E、G...符號(hào)代表BorderBox1、BorderBox10、BorderBox11...組件名稱(chēng) export default { install: (app, options) => { const components = [ D, E, G, I, K, g, C, P, h, k, u, w, z, N, Q, S, U, W, Y, _, oo, eo, ]; components.map((component) => { app.component(component.name, component); }); } }
總結(jié)
到此這篇關(guān)于Vue3安裝dataV報(bào)錯(cuò)問(wèn)題解決方案的文章就介紹到這了,更多相關(guān)Vue3安裝dataV報(bào)錯(cuò)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
vue2和elementUI?實(shí)現(xiàn)落日余暉登錄頁(yè)和滑塊校驗(yàn)功能
這篇文章主要介紹了vue2和elementUI打造落日余暉登錄頁(yè)和滑塊校驗(yàn),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下2023-06-06vue-cli 3.0 版本與3.0以下版本在搭建項(xiàng)目時(shí)的區(qū)別詳解
這篇文章主要介紹了vue-cli 3.0 版本與3.0以下版本在搭建項(xiàng)目時(shí)的區(qū)別詳解,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2018-12-12VUE項(xiàng)目初建和常見(jiàn)問(wèn)題總結(jié)
在本篇文章里小編給大家整理的是關(guān)于VUE 項(xiàng)目初建和常見(jiàn)問(wèn)題以及相關(guān)知識(shí)點(diǎn)內(nèi)容,有需要的朋友們學(xué)習(xí)下。2019-09-09Vue路由與a標(biāo)簽鏈接錨點(diǎn)發(fā)生沖突問(wèn)題及解決
這篇文章主要介紹了Vue路由與a標(biāo)簽鏈接錨點(diǎn)發(fā)生沖突問(wèn)題及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-03-03解決el-cascader在IE11瀏覽器中加載頁(yè)面自動(dòng)展開(kāi)下拉框問(wèn)題
這篇文章主要為大家介紹了解決el-cascader在IE11瀏覽器中加載頁(yè)面自動(dòng)展開(kāi)下拉框問(wèn)題,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-06-06vue實(shí)現(xiàn)輸入框自動(dòng)跳轉(zhuǎn)功能
這篇文章主要為大家詳細(xì)介紹了vue實(shí)現(xiàn)輸入框自動(dòng)跳轉(zhuǎn)功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-05-05Vue 父子組件的數(shù)據(jù)傳遞、修改和更新方法
下面小編就為大家分享一篇Vue 父子組件的數(shù)據(jù)傳遞、修改和更新方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2018-03-03