以下版本:
Element Plus组件库
首先基于Vue3的PC端开源UI组件库
安装依赖
yarn add element-plus@2.2.19 --save
main.js中导入并挂载模块
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
app.use(ElementPlus)
app.mount('#app')
注意注意 这里有个坑
使用要在挂载前 否则不生效
具体一些语法格式大致是类似于:
<template>
<div class="mb-4">
<el-button>Default</el-button>
<el-button type="primary">Primary</el-button>
<el-button type="success">Success</el-button>
<el-button type="info">Info</el-button>
<el-button type="warning">Warning</el-button>
<el-button type="danger">Danger</el-button>
</div>
<div class="mb-4">
<el-button plain>Plain</el-button>
<el-button type="primary" plain>Primary</el-button>
<el-button type="success" plain>Success</el-button>
<el-button type="info" plain>Info</el-button>
<el-button type="warning" plain>Warning</el-button>
<el-button type="danger" plain>Danger</el-button>
</div>
<div class="mb-4">
<el-button round>Round</el-button>
<el-button type="primary" round>Primary</el-button>
<el-button type="success" round>Success</el-button>
<el-button type="info" round>Info</el-button>
<el-button type="warning" round>Warning</el-button>
<el-button type="danger" round>Danger</el-button>
</div>
<div>
<el-button :icon="Search" circle />
<el-button type="primary" :icon="Edit" circle />
<el-button type="success" :icon="Check" circle />
<el-button type="info" :icon="Message" circle />
<el-button type="warning" :icon="Star" circle />
<el-button type="danger" :icon="Delete" circle />
</div>
</template>
<script lang="ts" setup>
import {
Check,
Delete,
Edit,
Message,
Search,
Star,
} from '@element-plus/icons-vue'
</script>
效果如上图
其他参考官网:
https://element-plus.org/zh-CN/component/button.html
Vant组件库
轻量级可靠的移动端组件库
安装依赖
yarn add vant@4.0.0 --save
main.js中导入并挂载模块
import Vant from 'vant'
import 'vant/lib/index.css'
app.use(Vant)
app.mount('#app')
移动端的UI展示效果 具体参考文档:
https://www.bookstack.cn/read/vant-4.0-zh/c3ea3a1bcc8cf39a.md
Ant Design Vue组件库
安装依赖
yarn add ant-design-vue@3.2.14 --save
main.js中导入并挂载模块
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
app.use(Antd)
app.mount('#app')
大多数的后台管理系统设计此UI
也有很多现成模板可以使用:
参考 https://www.antdv.com/components/button-cn