| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <script lang="ts" setup> |
| | | import type { GroupLite } from '../../types' |
| | | |
| | | import { computed, ref } from 'vue' |
| | | |
| | | import { IconifyIcon as Icon } from '#/packages/icons/src' |
| | | |
| | | import { GroupItem } from '../../components/group' |
| | | |
| | | defineOptions({ name: 'ImContactGroupList' }) |
| | | |
| | | const props = defineProps<{ |
| | | activeId?: number |
| | | groups: GroupLite[] |
| | | keyword: string |
| | | }>() |
| | | |
| | | const emit = defineEmits<{ select: [group: GroupLite] }>() |
| | | |
| | | const expanded = ref(true) |
| | | |
| | | const filtered = computed(() => { |
| | | const keywordLower = props.keyword.trim().toLowerCase() |
| | | if (!keywordLower) { |
| | | return props.groups |
| | | } |
| | | return props.groups.filter((group) => |
| | | (group.showGroupName || group.name || '').toLowerCase().includes(keywordLower) |
| | | ) |
| | | }) |
| | | </script> |
| | | |
| | | <template> |
| | | <!-- |
| | | éè®¯å½ - 群èåç» |
| | | - èªæ²»ï¼æå ç¶æ + å
³é®åè¿æ»¤æ¬ç»ä»¶å
éç¯ |
| | | - é䏿ç±ç¶çº§ activeId éä¼ ï¼é¿å
åç»ä»¶ææ selection ç¥è¯ |
| | | --> |
| | | <div> |
| | | <!-- æå åç»å¤´ï¼åå·å¯¹é½å¾®ä¿¡ PCï¼15pxï¼ï¼hover æµ
åºè²åé¦ --> |
| | | <div |
| | | class="flex gap-2 items-center px-3.5 py-2.5 text-15px text-[var(--ant-color-text)] cursor-pointer select-none hover:bg-[var(--ant-color-fill-secondary)]" |
| | | @click="expanded = !expanded" |
| | | > |
| | | <Icon :icon="expanded ? 'ep:caret-bottom' : 'ep:caret-right'" :size="14" /> |
| | | <span class="flex-1">群è</span> |
| | | <span class="text-sm text-[var(--ant-color-text-secondary)]">{{ filtered.length }}</span> |
| | | </div> |
| | | <div v-show="expanded"> |
| | | <GroupItem |
| | | v-for="group in filtered" |
| | | :key="group.id" |
| | | :group="group" |
| | | :active="activeId === group.id" |
| | | @click="emit('select', group)" |
| | | /> |
| | | <div |
| | | v-if="filtered.length === 0" |
| | | class="py-3 text-12px text-center text-[var(--ant-color-text-disabled)]" |
| | | > |
| | | {{ keyword ? '没æå¹é
ç群è' : 'ææ ç¾¤è' }} |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |