koel/resources/assets/js/components/user/UserAvatar.vue
2024-10-14 00:37:01 +07:00

18 lines
462 B
Vue

<template>
<img
:alt="`Avatar of ${user.name}`"
:src="avatar"
:title="user.name"
class="object-cover rounded-full aspect-square bg-k-bg-primary"
@error="avatar = defaultCover"
>
</template>
<script lang="ts" setup>
import { ref, toRefs } from 'vue'
import { defaultCover } from '@/utils'
const props = defineProps<{ user: Pick<User, 'name' | 'avatar'> }>()
const { user } = toRefs(props)
const avatar = ref(user.value.avatar)
</script>