koel/resources/assets/js/components/user/UserAvatar.vue

19 lines
462 B
Vue
Raw Normal View History

2024-01-18 11:13:05 +00:00
<template>
2024-04-04 22:20:42 +00:00
<img
:alt="`Avatar of ${user.name}`"
:src="avatar"
2024-04-04 22:20:42 +00:00
:title="user.name"
class="object-cover rounded-full aspect-square bg-k-bg-primary"
@error="avatar = defaultCover"
2024-04-04 22:20:42 +00:00
>
2024-01-18 11:13:05 +00:00
</template>
2024-04-23 21:01:27 +00:00
<script lang="ts" setup>
import { ref, toRefs } from 'vue'
import { defaultCover } from '@/utils'
2024-01-18 11:13:05 +00:00
const props = defineProps<{ user: Pick<User, 'name' | 'avatar'> }>()
const { user } = toRefs(props)
const avatar = ref(user.value.avatar)
2024-01-18 11:13:05 +00:00
</script>