mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Refactor #3879 - For Avatar & AvatarGroup
This commit is contained in:
parent
69d0f98f26
commit
43c3f82ae5
6 changed files with 131 additions and 9 deletions
|
@ -1,18 +1,21 @@
|
|||
<template>
|
||||
<div :class="containerClass" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel">
|
||||
<div :class="containerClass" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" v-bind="ptm('root')">
|
||||
<slot></slot>
|
||||
<template v-if="!$slots.default">
|
||||
<span v-if="label" class="p-avatar-text">{{ label }}</span>
|
||||
<component v-else-if="$slots.icon" :is="$slots.icon" class="p-avatar-icon" />
|
||||
<span v-else-if="icon" :class="['p-avatar-icon', icon]" />
|
||||
<img v-else-if="image" :src="image" :alt="ariaLabel" @error="onError" />
|
||||
<span v-if="label" class="p-avatar-text" v-bind="ptm('label')">{{ label }}</span>
|
||||
<component v-else-if="$slots.icon" :is="$slots.icon" class="p-avatar-icon" v-bind="ptm('icon')" />
|
||||
<span v-else-if="icon" :class="['p-avatar-icon', icon]" v-bind="ptm('icon')" />
|
||||
<img v-else-if="image" :src="image" :alt="ariaLabel" @error="onError" v-bind="ptm('image')" />
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BaseComponent from 'primevue/basecomponent';
|
||||
|
||||
export default {
|
||||
name: 'Avatar',
|
||||
extends: BaseComponent,
|
||||
emits: ['error'],
|
||||
props: {
|
||||
label: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue