misskey/packages/frontend/src/components/MkAvatars.vue
2023-09-19 16:37:43 +09:00

34 lines
895 B
Vue

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div>
<div v-for="user in users.slice(0, limit)" :key="user.id" style="display:inline-block;width:32px;height:32px;margin-right:8px;">
<MkAvatar :user="user" style="width:32px; height:32px;" indicator link preview/>
</div>
<div v-if="users.length > limit" style="display: inline-block;">...</div>
</div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
const props = withDefaults(defineProps<{
userIds: string[];
limit?: number;
}>(), {
limit: Infinity,
});
const users = ref<Misskey.entities.UserLite[]>([]);
onMounted(async () => {
users.value = await os.api('users/show', {
userIds: props.userIds,
}) as unknown as Misskey.entities.UserLite[];
});
</script>