当前位置: 首页 > news >正文

vue 下拉框 vxe-select 实现人员选择下拉列表

vue 下拉框 vxe-select 实现人员选择下拉列表
使用自定义选项插槽的方式,可以灵活的实现各种类型的下拉选择

官网:https://vxeui.com
github:https://github.com/x-extends/vxe-pc-ui
gitee:https://gitee.com/x-extends/vxe-pc-ui

在这里插入图片描述

需要注意当每一行高度超多默认高度时,必须要设置 option-config.height 来自定义选项高度

<template><div><vxe-select v-model="val1" placeholder="人员选择" :options="opts1" :option-config="{height: 40}" multiple filterable clearable><template #option="{ option }"><div class="user-select-item"><img :src="option.url" class="user-select-img" /><span class="user-select-name"><span>{{ option.label }}</span><span v-if="option.status" :class="['user-select-status', option.status]">{{ getUserStatus(option.status) }}</span></span></div></template></vxe-select></div>
</template><script setup>
import { ref } from 'vue'const val1 = ref()const opts1 = ref([{ label: '张三', value: '1', status: 'dimission', url: 'https://vxeui.com/resource/avatarImg/avatar1.jpeg' },{ label: '小明', value: '2', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar2.jpeg' },{ label: '老刘', value: '3', status: 'trial', url: 'https://vxeui.com/resource/avatarImg/avatar3.jpeg' },{ label: '李四', value: '4', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar4.jpeg' },{ label: '老六', value: '5', status: 'trial', url: 'https://vxeui.com/resource/avatarImg/avatar5.jpeg' },{ label: '王五', value: '6', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar6.jpeg' },{ label: '小陈', value: '7', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar7.jpeg' },{ label: '老徐', value: '8', status: 'dimission', url: 'https://vxeui.com/resource/avatarImg/avatar8.jpeg' },{ label: '小瑞', value: '9', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar9.jpeg' },{ label: '小马', value: '10', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar10.jpeg' },{ label: '小徐', value: '11', status: 'trial', url: 'https://vxeui.com/resource/avatarImg/avatar11.jpeg' },{ label: '小三', value: '12', status: 'dimission', url: 'https://vxeui.com/resource/avatarImg/avatar12.jpeg' },{ label: '老李', value: '13', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar13.jpeg' },{ label: '小四', value: '14', status: '', url: 'https://vxeui.com/resource/avatarImg/avatar14.jpeg' },{ label: '小李', value: '15', status: 'trial', url: 'https://vxeui.com/resource/avatarImg/avatar15.jpeg' }
])
const getUserStatus = (status) => {switch (status) {case 'dimission': return '离职'case 'trial': return '试用期'}return ''
}</script><style lang="scss" scoped>
.user-select-item {position: relative;height: 40px;display: flex;flex-direction: row;align-items: center;
}
.user-select-img {width: 30px;height: 30px;border-radius: 50%;
}
.user-select-name {padding-left: 5px;
}
.user-select-status {font-size: 12px;position: absolute;top: 0;padding-left: 5px;&.dimission {color: red;}&.trial {color: orange;}
}
</style>

https://gitee.com/x-extends/vxe-pc-ui

http://www.dtcms.com/a/492595.html

相关文章:

  • 网站名和域名大型网页游戏大全
  • Redis 主从模式同步原理机制
  • 在马来西亚做网站网站合法吗学习做网站的网站
  • html5网站开发教程专业做淘宝网站推广
  • 一般的网站需要多大的空间深圳市住房和建设局网站住房保障
  • 网站排名突然下降建设工程检测预约网站
  • 在网站后台可以修改网页的内容招聘平面设计
  • ECHARTS SVG地图示例
  • 小迪安全v2023学习笔记(一百三十三讲)—— Windows权限提升篇溢出漏洞土豆家族通杀全系补丁对比EXP筛选
  • 网站设计网站项目流程电子商务是什么职业
  • 江苏省交通建设厅门户网站删除wordpress主题底部
  • 做图文的网站wordpress 添加目录
  • 【工作日记】rapidocr解析工具内存溢出排查
  • 邢台网站网页设计产品朋友圈推广词
  • 建设一个电子文学网站资金多少苏州网站建设师
  • 苏州有名的设计公司徐州百度搜索优化
  • 网站开发有哪些架构现在流行做网站吗
  • 外贸网站制作费用单页应用网站
  • 合肥网站营销推广做家教去什么网站
  • 做网站利润wordpress widget logic
  • AI agent到底有多大创新?
  • 接口测试常见面试题
  • 西城专业网站建设公司哪家好wordpress网站布置视频
  • 网站开发 证书网站后台开发 必备技能
  • 江西城乡建设部网站首页简洁大气的企业网站
  • JavaScript 标准库完全指南:从基础到实战
  • 企业注册阿里账号网站建设网站开发到上线需要多久
  • 重庆住房城乡建设厅网站首页wordpress 不显示文章图片
  • 青海建设厅质检站网站社区团购最新模式
  • Vue3 Class 与 Style 绑定