elementUI使用
程序员文章站
2022-03-04 11:35:29
...
1. 安装 cnpm i element-ui -S -S表示 --save
2. 引入element UI的css 和 插件,放入main.js文件中
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
3. webpack.config.js 配置file_loader
{
test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'
}
如果不添加以上代码,运行时会报如下错误:
ERROR in ./node_modules/_element-[email protected]2.3.9@element-ui/lib/theme-chalk/fonts/element-icons.woff
Module parse failed: Unexpected character ' ' (1:4)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
@ ./node_modules/_css-[email protected]0.28.11@css-loader!./node_modules/_element-[email protected]2.3.9@element-ui/lib/theme-chalk/index.css 7:335-372
@ ./node_modules/_element-[email protected]2.3.9@element-ui/lib/theme-chalk/index.css
@ ./src/main.js
@ multi ./node_modules/_webpack-dev-[email protected]2.11.2@webpack-dev-server/client?http://localhost:8082 webpack/hot/dev-server ./src/main.js
4. 需要什么组件看文档,按文档操作就可以了
上一篇: 关于ElementUi表单验证
下一篇: JDK8中Optional的用法