Home  >  Q&A  >  body text

javascript - vue references elementUI and reports that indx.css cannot be found?

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

天蓬老师天蓬老师2638 days ago907

reply all(3)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-07-05 10:42:10

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

    reply
    0
  • 阿神

    阿神2017-07-05 10:42:10

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

    reply
    0
  • 黄舟

    黄舟2017-07-05 10:42:10

    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)
    

    reply
    0
  • Cancelreply