javascript - vue references elementUI and reports that indx.css cannot be found?
天蓬老师
天蓬老师 2017-07-05 10:40:10
0
3
951

vue refers to elementUI, and the elementui file can be found in node_modules
In webpack.base.conf.js
{

    test: /\.css$/,
    loader: 'style!css'
  },
  {
    test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
    loader: 'file',
    query: {
      limit: 10000,
      name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
    }
  }
  
  

Enter in main.js
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
Vue.use(ElementUI)

But it’s the output

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
我想大声告诉你

Try import '../node_modules/element-ui/lib/theme-default/index.css';

阿神

Use vue-cli and focus on business logic, environment configuration, etc. Oh~

黄舟

The problem has been solved with the following steps:
1.cnpm install style-loader -D
2.cnpm install css-loader -D
3.cnpm install file-loader –D
4. Install cnpm install element-ui -S
5 .Introduced in main.js:

import ElementUI from ‘element-ui‘
import ‘element-ui/lib/theme-default/index.css‘
Vue.use(ElementUI)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template