(一)element框架(element-ui,emelemt-plus)安裝和引用


(一):vue2.6以下使用elemtnt-ui:

1:安裝命令

yarn add element-ui --save

2:刪除

yarn remove element-ui --save

安裝如果出現下面問題:

error Couldn't find package "fsevents@~2.3.2" required by "chokidar@^3.5.3" on the "npm" registry.

解決方法:

找到package.json,移除  "dependencies": {}  節點

然后:yarn install=>yarn add element-ui,然后會重新生成"dependencies": {} 節點=>然后剛剛移除的內容拷貝到"dependencies": {} 節點下面

=>然后yarn install去還原拷貝到dependencies": {} 下的呢些組件,最后yarn run serve就可以了

=>如果yarn add element-ui報下面的錯

error An unexpected error occurred: "https://registry.yarnpkg.com/element-ui: connect ETIMEDOUT 104.16.16.35:443".
info If you think this is a bug, please open a bug report with the information provided in "E:\\vscode\\vue\\vue\\vue\\vue\\webapiroots3diyipian\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

就重復上面的操作

3:在main.js引用element

import ElementUI from 'element-ui';

import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

 

(二):vue3.x使用entment-ui

1:安裝elemtnt-plus:

yarn add element-plus

2:引用element-plus

import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
const app=createApp(App);
app.use(ElementPlus)
 
注意:
element框架區別 Element-ui適用於Vue2框架 Element-plus適用於Vue3框架


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM