1.安装以下模块,让webpack可以解析css文件
-
npm install style-loader --save-dev
-
npm install css-loader --save-dev
-
npm install file-loader --save-dev
2.安装elementUi模块
npm install element-ui@next -S
3.在webpack.base.conf.js中添加配置
-
{
-
test: /.css$/,
-
loader: "style!css"
-
},
-
{
-
test: /.(eot|woff|woff2|ttf)([\\\\\\\\?]?.*)$/,
-
loader: "file"
-
}
4.然后在 main.js 引入并注册
-
import ElementUI from 'element-ui'
-
import 'element-ui/lib/theme-chalk/index.css'
-
Vue.use(ElementUI)