feat: 用户选择器性能优化,支持虚拟加载

This commit is contained in:
digua
2026-01-28 00:41:04 +08:00
committed by digua
parent 1af27bdbf1
commit e16a11556b
+5 -3
View File
@@ -23,7 +23,7 @@ const isLoading = ref(false)
// 特殊值表示全部成员
const ALL_MEMBERS_VALUE = '__ALL__'
// 内部选中值(字符串类型,USelect 要求
// 内部选中值(字符串类型,通过 value-key 指定
const internalValue = computed({
get: () => {
return props.modelValue === null ? ALL_MEMBERS_VALUE : String(props.modelValue)
@@ -35,7 +35,7 @@ const internalValue = computed({
// 成员选项
const memberOptions = computed(() => {
const options = [
const options: { value: string; label: string }[] = [
{ value: ALL_MEMBERS_VALUE, label: t('allMembers') },
]
members.value.forEach((m) => {
@@ -75,10 +75,12 @@ watch(
</script>
<template>
<USelect
<USelectMenu
v-model="internalValue"
:items="memberOptions"
:loading="isLoading"
:virtualize="{ estimateSize: 32, overscan: 10 }"
value-key="value"
class="w-48"
/>
</template>