Skip to content

Commit

Permalink
feat(Avatar): add as prop to use NuxtImg underneath
Browse files Browse the repository at this point in the history
Resolves #1577
  • Loading branch information
benjamincanac committed Mar 28, 2024
1 parent bd8b737 commit 49b73aa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/runtime/components/elements/Avatar.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<template>
<span :class="wrapperClass">
<img
<component
:is="as"
v-if="url && !error"
:class="imgClass"
:alt="alt"
:src="url"
v-bind="attrs"
@error="onError"
>
/>
<span v-else-if="text" :class="ui.text">{{ text }}</span>
<UIcon v-else-if="icon" :name="icon" :class="iconClass" />
<span v-else-if="placeholder" :class="ui.placeholder">{{ placeholder }}</span>
Expand Down Expand Up @@ -39,6 +40,10 @@ export default defineComponent({
},
inheritAttrs: false,
props: {
as: {
type: [String, Object],
default: 'img'
},
src: {
type: [String, Boolean],
default: null
Expand Down

0 comments on commit 49b73aa

Please sign in to comment.