Home > Web Front-end > JS Tutorial > body text

A brief discussion on how vue.js imports css library (elementUi)

亚连
Release: 2018-05-31 16:13:43
Original
1914 people have browsed it

下面我就为大家分享一篇浅谈vue.js导入css库(elementUi)的方法,具有很好的参考价值,希望对大家有所帮助。

1.安装以下模块,让webpack可以解析css文件

cnpm install style-loader --save-dev
cnpm install css-loader --save-dev
cnpm install file-loader --save-dev
Copy after login

2.安装elementUi模块

cnpm install element-ui@next -S
Copy after login

3.在webpack.base.conf.js中添加配置

 {
     test: /\\\\\\\\.css$/,
     loader: "style!css"
   },
   {
     test: /\\\\\\\\.(eot|woff|woff2|ttf)([\\\\\\\\?]?.*)$/,
     loader: "file"
   }
Copy after login

4.然后在 main.js 引入并注册

import Element from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
Vue.use(Element)
Copy after login

上面是我整理给大家的,希望今后会对大家有帮助。

相关文章:

vue 开发一个按钮组件的示例代码

vue-cli脚手架-bulid下的配置文件

vue2中使用less简易教程

The above is the detailed content of A brief discussion on how vue.js imports css library (elementUi). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template