Fixed #4929 - Add parent param to all pt method options

This commit is contained in:
mertsincan 2023-12-05 11:06:32 +00:00
parent 1a4bba8107
commit eb00b8ee23
104 changed files with 399 additions and 158 deletions

View file

@ -7,7 +7,6 @@
* @module avatar
*/
import { VNode } from 'vue';
import { AvatarGroupPassThroughOptions } from '../avatargroup';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
@ -27,9 +26,9 @@ export interface AvatarPassThroughMethodOptions {
*/
props: AvatarProps;
/**
* Defines parent instance.
* Defines parent options.
*/
parent: AvatarGroupPassThroughOptions;
parent: any;
/**
* Defines passthrough(pt) options in global config.
*/

View file

@ -1,10 +1,10 @@
<template>
<div :class="cx('root')" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" v-bind="getPTOptions('root')" data-pc-name="avatar">
<div :class="cx('root')" :aria-labelledby="ariaLabelledby" :aria-label="ariaLabel" v-bind="ptm('root')" data-pc-name="avatar">
<slot>
<span v-if="label" :class="cx('label')" v-bind="getPTOptions('label')">{{ label }}</span>
<span v-if="label" :class="cx('label')" v-bind="ptm('label')">{{ label }}</span>
<component v-else-if="$slots.icon" :is="$slots.icon" :class="cx('icon')" />
<span v-else-if="icon" :class="[cx('icon'), icon]" v-bind="getPTOptions('icon')" />
<img v-else-if="image" :src="image" :alt="ariaLabel" @error="onError" v-bind="getPTOptions('image')" />
<span v-else-if="icon" :class="[cx('icon'), icon]" v-bind="ptm('icon')" />
<img v-else-if="image" :src="image" :alt="ariaLabel" @error="onError" v-bind="ptm('image')" />
</slot>
</div>
</template>
@ -19,13 +19,6 @@ export default {
methods: {
onError(event) {
this.$emit('error', event);
},
getPTOptions(key) {
return this.ptm(key, {
parent: {
instance: this.$parent
}
});
}
}
};