Vue 之 Element UI 篇

一:前言

鉴于vue的组件不好看,引入Element的组件库来优化组件。

二:步骤

2.1 下载安装

2.1.1 npm安装

1
2
npm i element-ui -S  \\或者
vue add element \\如果使用这种方法,那么无须手动文件引入,直接用就可以了

2.1.2CDN安装

1
2
3
4
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>

2.2组件引入

在入口文件 main.js 中引入

1
2
3
4
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);
-------------本文结束 感谢您的阅读-------------
点击查看