vue 引入element-ui

1、打开终端找到项目目录--安装Elemtnt-UI

npm i element-ui -S

2、打开项目:src/main.js,添加下面三条

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' (根据版本路径不同会有差异,按照自己版本路径)
Vue.use(ElementUI)

3 在webpack.config.js文件中

  module: {
    rules: [
    ......
{ test: /\.(eot|svg|ttf|woff|woff2)(\?\S*)?$/, loader: 'file-loader' },

    ...... ] },

这一步很重要,要不然会导致无法处理element-ui的字体,从而报错

猜你喜欢

转载自www.cnblogs.com/niningwei/p/9234292.html