fix(Avatar): proxy $attrs to default slot (#3712)

This commit is contained in:
仿生狮子
2025-03-28 17:27:25 +08:00
committed by GitHub
parent e7e6745599
commit 88f349d0d7

View File

@@ -40,7 +40,7 @@ export interface AvatarSlots {
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { Primitive } from 'reka-ui'
import { Primitive, Slot } from 'reka-ui'
import ImageComponent from '#build/ui-image-component'
import { useAvatarGroup } from '../composables/useAvatarGroup'
import UIcon from './Icon.vue'
@@ -98,9 +98,11 @@ function onError() {
@error="onError"
/>
<slot v-else>
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || '&nbsp;' }}</span>
</slot>
<Slot v-else v-bind="$attrs">
<slot>
<UIcon v-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
<span v-else :class="ui.fallback({ class: props.ui?.fallback })">{{ fallback || '&nbsp;' }}</span>
</slot>
</Slot>
</Primitive>
</template>