当前位置: 首页 > 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.jsqmd.com/news/14799/

相关文章:

  • 双核A53+开源生态,ZX7981P Wi-Fi6 5G插卡路由器开发板CPE内核新选择!
  • 2025 高效过滤器制造企业最新推荐榜:供货商定制方案深度解析及口碑评级
  • 最后防线 解题报告
  • 2025 年试验箱厂家 TOP 企业品牌推荐排行榜,氙灯老化 / 紫外老化 / 冷热冲击 / 恒温恒湿 / 高低温 / 快速温变 / 盐水喷雾 / 高温老化 / 砂尘 / 淋雨试验箱公司推荐!
  • 系统修复
  • 什么是vibe ?
  • 2025年10月试验箱厂家最新推荐排行榜:氙灯老化试验箱,紫外老化试验箱,冷热冲击试验箱,恒温恒湿试验箱公司推荐!
  • AI时代我们需要更多开发者:Shalini Kurapati的技术洞察
  • 新一代虚拟助手AI技术挑战赛启动
  • 经典视觉跟踪算法的MATLAB实现
  • CSS各种选择器
  • aardio 调用vb函数
  • adobe illustrator中鼠标拖动移动幅度大
  • python的字符串方法示例
  • 是多少
  • 2025年玻璃杯趋势:某某科技圆润咖啡杯引领健康饮水新潮流
  • 2025 年密封线优质厂家最新推荐榜:权威甄选螺纹、高强度等多类型密封线质量与技术双优企业液态/亚麻/防腐/耐高温密封线厂家推荐
  • MySQL 在金融高效的系统中的应用:强一致性与高可用架构实战
  • adobe illustrator中设置键盘增量
  • 焦虑
  • 从此,不再开口就紧张
  • 基于Qt实现百度地图路径规划功能
  • 求职,从大一开始
  • 基于C#的湿度上位机实现方案
  • 2025 年珠澳宠物托运公司联系方式推荐:爱宠国际,港澳内地宠物运输的安全专业之选
  • 男人要懂心理学
  • 2025 年铝单板厂家最新推荐榜:聚焦西南及全国头部企业,精选 实力品牌助力项目采购
  • proxmox 去除无订阅提示和企业付费仓库,解决apt 安装问题
  • 2025 最新隔音板源头厂家口碑排行榜:涵盖阻尼 / 吸音 / 聚酯纤维等全品类,权威推荐实力品牌
  • vulntarget-b-01