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)了一點小問題
左下角的組件應用之后,控制臺報錯且連帶著右側兩個能正常運行的組件失效了。
查閱資料,發(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中@click.stop和@click.prevent實例詳解
當我們使用Vue.js開發(fā)前端應用時,經(jīng)常會在模版中使用@click指令來響應用戶的點擊事件,這篇文章主要給大家介紹了關于Vue中@click.stop和@click.prevent的相關資料,需要的朋友可以參考下2024-04-04vue3 ts組合式API異常onMounted is called when&
這篇文章主要為大家介紹了vue3 ts組合式API異常onMounted is called when there is no active component問題解決,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-05-05解決vue-element-admin安裝依賴npm install報錯問題
這篇文章主要介紹了解決vue-element-admin安裝依賴npm install報錯問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-06-06vue3 el-upload單張圖片回顯、編輯、刪除功能實現(xiàn)
這篇文章主要介紹了vue3 el-upload單張圖片回顯、編輯、刪除功能實現(xiàn),圖片回顯時隱藏上傳區(qū)域,鼠標懸浮顯示遮罩層進行編輯、刪除操作,刪除圖片后顯示上傳區(qū)域,本文通過實例代碼分享實現(xiàn)方法,感興趣的朋友一起看看吧2023-12-12