1.安装依赖
npm install element-ui --save
2.引入element-ui
在main.js中引入下面代码
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
报错问题:
问题1.
Errors:
25 http://eslint.org/docs/rules/no-tabs
7 http://eslint.org/docs/rules/indent
7 http://eslint.org/docs/rules/semi
2 http://eslint.org/docs/rules/no-undef
1 http://eslint.org/docs/rules/eol-last
1 http://eslint.org/docs/rules/no-new
1 http://eslint.org/docs/rules/no-multiple-empty-lines
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
解决办法:

问题2、 css的文件路径报错
解决方法:
因为原版的css文件是theme-default,改版后就变为theme-chalk,在安装目录下将文件名改为theme-chalk即可,文件路径:node_modules/element-ui/lib/theme-chalk/index.css
本文详细介绍了如何在项目中安装并使用Element UI组件库,包括必要的依赖安装步骤及在main.js中正确引入Element UI的方法。同时,针对常见的错误如ESLint警告、css文件路径错误等提供了具体的解决方案。
621

被折叠的 条评论
为什么被折叠?



