23 lines
499 B
Vue
23 lines
499 B
Vue
|
<template>
|
||
|
<div class="avatar">
|
||
|
<div class="rounded-full">
|
||
|
<img :src="getAvatarUrl(user)" />
|
||
|
</div>
|
||
|
</div>
|
||
|
</template>
|
||
|
|
||
|
<script setup lang="ts">
|
||
|
import type { User } from '~/types/user';
|
||
|
|
||
|
const props = defineProps<{
|
||
|
user: User,
|
||
|
}>();
|
||
|
|
||
|
const getAvatarUrl = (user: User) => {
|
||
|
if (user.avatar) {
|
||
|
return user.avatar;
|
||
|
}
|
||
|
return 'https://avatar.iran.liara.run/username?username=' + user.name;
|
||
|
};
|
||
|
</script>
|