Element UI 组件的安装及使用

Element UI 是一套基于 Vue.js 的桌面端 UI 组件库,提供了丰富的、高质量的 UI 组件,可以帮助开发者快速构建用户界面。
1、安装 Element UI
使用 npm 安装
npm install element-ui -S
2、使用 CDN 安装
在 HTML 页面中引入以下代码:
HTML
<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>
3、使用 Element UI 组件
全局注册
在 Vue.js 实例中注册 Element UI 组件:
JavaScript
import Vue from 'vue'
import ElementUI from 'element-ui'
Vue.use(ElementUI)
new Vue({
el: '#app',
components: {
// ...
}
})
局部注册
在需要使用 Element UI 组件的组件中注册该组件

最低0.47元/天 解锁文章
5498

被折叠的 条评论
为什么被折叠?



