# VUE UI
一 移动端常用UI组件库
- Vant http://vant-contrib.gitee.io/vant/#/zh-CN/
- Cube UI https://didi.github.io/cube-ui/
- Mint UI http://mint-ui.github.io/#!/zh-cn (vue 2.0)
- NUT UI https://nutui.jd.com/#/
二 PC端常用UI组件库
- Element UI https://element.eleme.cn/#/zh-CN
- IView UI http://v1.iviewui.com/
三 ElementUI组件按需引入
- 首先安装element-ui:
- 然后安装 babel-plugin-component:
| npm install babel-plugin-component -D |
- 修改babel.config.js:
| module.exports = { |
| presets: [ |
| '@vue/cli-plugin-babel/preset', |
| ["@babel/preset-env", { "modules": false }], |
| ], |
| plugins: [ |
| [ |
| "component", |
| { |
| "libraryName": "element-ui", |
| "styleLibraryName": "theme-chalk" |
| } |
| ] |
| ] |
| } |
- 在main.js按需引入组件
| |
| import Vue from "vue"; |
| |
| import App from './App'; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| import { Button, Input, Row, DatePicker } from 'element-ui'; |
| Vue.use(Button); |
| Vue.use(Input); |
| Vue.use(Row); |
| Vue.use(DatePicker); |
| |
| |
| |
| |
| Vue.config.productionTip = false; |
| |
| new Vue({ |
| el: '#app', |
| render: h => h(App), |
| }); |
- 然后在App.vue使用
| <template> |
| <div> |
| <button>原生的button</button> |
| <input type="text"> |
| <el-row> |
| <el-button>默认按钮</el-button> |
| <el-button type="primary">主要按钮</el-button> |
| <el-button type="success">成功按钮</el-button> |
| <el-button type="info">信息按钮</el-button> |
| <el-button type="warning">警告按钮</el-button> |
| <el-button type="danger">危险按钮</el-button> |
| </el-row> |
| |
| <div class="block"> |
| <span class="demonstration">默认</span> |
| <el-date-picker |
| type="date" |
| placeholder="选择日期"> |
| </el-date-picker> |
| </div> |
| <el-row> |
| <el-button icon="el-icon-search" circle></el-button> |
| <el-button type="primary" icon="el-icon-edit" circle></el-button> |
| <el-button type="success" icon="el-icon-check" circle></el-button> |
| <el-button type="info" icon="el-icon-message" circle></el-button> |
| <el-button type="warning" icon="el-icon-star-off" circle></el-button> |
| <el-button type="danger" icon="el-icon-delete" circle></el-button> |
| </el-row> |
| </div> |
| </template> |
| |
| <script> |
| export default { |
| name: "App", |
| } |
| </script> |
| |
| <style lang="css" scoped> |
| |
| </style> |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!