Vue3框架使用報錯以及解決方案
Vue3框架使用報錯及解決
1、TypeError: Failed to fetch dynamically imported module:
引入組件時,沒有添加.vue后綴 或者引入的組建沒有被使用
2、SyntaxError: The requested module '/node_modules/_schart.js@3.0.4@schart.js/lib/sChart.min.js?v=0343bb8c' does not provide an export named 'default'
版本問題
3、cnpm安裝element-plus報錯

4、yarn add element-plus --save報錯

5、把項目停止運行之后重新安裝ok了
6、vite.config.ts Cannot find module 'path' or its corresponding type declarations
npm install @types/node --save-dev
7、vue.config.ts import path from 'path' 配置報錯
Module '"path"' can only be default-imported using the 'allowSyntheticDefaultImports' flag
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default defineConfig({
plugins: [vue()],
resolve: {
// 配置別名
alias: {
"@": resolve(__dirname, "src"),
"@c": resolve(__dirname, "src/components"),
}
}
})8、vue3+element-plus里面的el-submenu組件顯示問題
el-submenu,但是顯示出了問題,不能正常顯示。
感覺是這個組件的問題,查了一圈沒找到解決方法,最后看官方文檔發(fā)現(xiàn)el-submenu變成了el-sub-menu
VUE3+Echarts報錯Cannot read property ‘type‘ of undefined
最近在做Echarts項目的時候,在組件引用的時候出現(xiàn)了一點小問題

左下角的組件應用之后,控制臺報錯且連帶著右側(cè)兩個能正常運行的組件失效了。

查閱資料,發(fā)現(xiàn)可能是“商家銷售統(tǒng)計”的組件在數(shù)據(jù)讀取是響應式的原因,在響應代碼中加上
import { markRaw } from '@vue/reactivity';在圖表初始化的引用中加上markRaw()
initChart() {
this.chartInstance = markRaw(echarts.init(this.$refs.rank_ref, this.theme))
//對圖表初始化配置進行控制
const initOption = {
},問題解決
總結
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
vue v-for循環(huán)重復數(shù)據(jù)無法添加問題解決方法【加track-by=''索引''】
這篇文章主要介紹了vue v-for循環(huán)重復數(shù)據(jù)無法添加問題解決方法,結合實例形式分析了vue.js通過在v-for循環(huán)中添加track-by='索引'解決重復數(shù)據(jù)無法添加問題相關操作技巧,需要的朋友可以參考下2019-03-03
vue-router(this.$router)如何在新窗口打開路由跳轉(zhuǎn)頁面
這篇文章主要介紹了vue-router(this.$router)如何在新窗口打開路由跳轉(zhuǎn)頁面問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-12-12
elementUI select組件默認選中效果實現(xiàn)的方法
這篇文章主要介紹了elementUI select組件默認選中效果實現(xiàn)的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-03-03
如何解決this.$refs.form.validate()不執(zhí)行的問題
這篇文章主要介紹了如何解決this.$refs.form.validate()不執(zhí)行的問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-09-09

