(一):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