2024-01-18 11:13:05 +00:00
|
|
|
<template>
|
2024-04-04 22:20:42 +00:00
|
|
|
<img
|
|
|
|
:alt="`Avatar of ${user.name}`"
|
2024-08-30 11:39:24 +00:00
|
|
|
:src="avatar"
|
2024-04-04 22:20:42 +00:00
|
|
|
:title="user.name"
|
2024-08-30 11:39:24 +00:00
|
|
|
@error="avatar = defaultCover"
|
|
|
|
class="object-cover rounded-full aspect-square bg-k-bg-primary"
|
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>
|
2024-08-30 11:39:24 +00:00
|
|
|
import { toRefs, ref } 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)
|
2024-08-30 11:39:24 +00:00
|
|
|
const avatar = ref(user.value.avatar)
|
2024-01-18 11:13:05 +00:00
|
|
|
</script>
|