当前位置: 首页 > 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.rkmt.cn/news/22373.html

相关文章:

  • 最后防线 解题报告
  • AI时代我们需要更多开发者:Shalini Kurapati的技术洞察
  • 从此,不再开口就紧张
  • 基于Qt实现百度地图路径规划功能
  • 基于C#的湿度上位机实现方案
  • C盘满了怎么清理?10种安全释放Win10/Win11空间的方法(详细图文版)
  • 2025 护眼灯生产厂家最新推荐榜:精选资深与新锐品牌,深度解析生产实力与市场口碑
  • 【IEEE出版|快至3-4个月EI检索】第五届电力系统与能源互联网国际学术会议(PoSEI 2025)
  • 复盘:如何用Coze+Kimi,搭建一个能自动分析财报的“金融助理”?
  • 详细介绍:【算法竞赛学习笔记】基础算法篇:递归再探
  • 折腾笔记:免费用上 Claude Code 的两个方案
  • 2025 年最新金蝶云服务商代理机构权威推荐排行榜:聚焦铂金伙伴技术实力与万级客户口碑,上海金蝶云最新推荐优质公司
  • 可视化图解算法64:哈希表基础
  • SqlServer Arithmetic overflow error converting expression to data type int
  • 医疗公有云市场第一!
  • 2025手持光谱仪/光谱分析仪/便携式光谱仪、矿石/元素分析仪、合金/金属/不锈钢/铝合金、贵金属、三元催化、赛普斯、IF光谱仪推荐榜
  • 在 Android 11 上构建 WiFi 热点并发协助(同时开启 STA + AP 模式)
  • 25 LCA模拟赛3T1 ROI 2012马赛克 题解
  • uni-app x开发商城系统,Swiper 轮播图
  • 昂瑞微OM6651A:国产车规级蓝牙芯片的破局者
  • 打破应用跳转流失困局,提升推广链接转化率
  • 检查cpu是否支撑minio方法
  • Codeforces Round 1058 (Div. 2) A~E
  • 2025 年生料带厂家最新推荐排行榜:解析优质品牌优势,涵盖新型、彩色、液态等多类型生料带厂家企业推荐
  • openresty开发lua-resty-openssl之对称加密解密 - liuxm
  • 腾讯云 OpenCloudOS 8 docker安装
  • 哈希乱搞:CF1418G Three Occurrences
  • 悲伤 自卑 乖戾 独自哭泣 陪伴空虚 kill my memory 让我将痛苦全忘记
  • 工程师的 “指尖实验室”!正点原子 LT1 电桥镊子深度测评:同价位竞品谁能打?
  • 破解跨域监控难题:国标GB28181算法算力平台EasyGBS视频调阅技术在跨域安防监控中的核心应用