mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-21 15:24:09 +00:00
26 lines
595 B
Vue
26 lines
595 B
Vue
<template>
|
|
<Avatar
|
|
:image="photoUrl ?? undefined"
|
|
:icon="hasAvatar ? undefined : 'pi pi-user'"
|
|
shape="circle"
|
|
:aria-label="ariaLabel ?? $t('auth.login.userAvatar')"
|
|
@error="handleImageError"
|
|
/>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Avatar from 'primevue/avatar'
|
|
import { computed, ref } from 'vue'
|
|
|
|
const { photoUrl, ariaLabel } = defineProps<{
|
|
photoUrl?: string | null
|
|
ariaLabel?: string
|
|
}>()
|
|
|
|
const imageError = ref(false)
|
|
const handleImageError = () => {
|
|
imageError.value = true
|
|
}
|
|
const hasAvatar = computed(() => photoUrl && !imageError.value)
|
|
</script>
|