Home  >  Article  >  Web Front-end  >  How to import css library in vue.js

How to import css library in vue.js

php中世界最好的语言
php中世界最好的语言Original
2018-04-11 15:44:342463browse

这次给大家带来vue.js中怎么导入css库,vue.js中导入css库的注意事项有哪些,下面就是实战案例,一起来看一下。

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

cnpm install style-loader --save-dev
cnpm install css-loader --save-dev
cnpm install file-loader --save-dev

2.安装elementUi模块

cnpm 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 Element from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
Vue.use(Element)

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

vue.js底部导航栏的子路由不显示怎么处理

JS如何实现随机切换微信号

The above is the detailed content of How to import css library in vue.js. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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