mizzkey/packages/frontend/src/components/MkAvatars.vue

30 lines
762 B
Vue
Raw Normal View History

2019-05-21 01:44:36 +02:00
<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;">
2023-05-19 06:58:09 +02:00
<MkAvatar :user="user" style="width:32px; height:32px;" indicator link preview/>
2020-02-08 08:51:27 +01:00
</div>
<div v-if="users.length > limit" style="display: inline-block;">...</div>
2019-05-21 01:44:36 +02:00
</div>
</template>
2022-01-06 15:07:32 +01:00
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
2021-11-11 18:02:25 +01:00
import * as os from '@/os';
import { UserLite } from 'misskey-js/built/entities';
2019-05-21 01:44:36 +02:00
const props = withDefaults(defineProps<{
2022-01-06 15:07:32 +01:00
userIds: string[];
limit?: number;
}>(), {
limit: Infinity,
});
2022-01-06 15:07:32 +01:00
const users = ref<UserLite[]>([]);
2022-01-06 15:07:32 +01:00
onMounted(async () => {
users.value = await os.api('users/show', {
userIds: props.userIds,
}) as unknown as UserLite[];
2019-05-21 01:44:36 +02:00
});
</script>