Refactor #4274 - For Chips

pull/3943/head^2
Tuğçe Küçükoğlu 2023-08-16 09:32:23 +03:00
parent b27321fdaa
commit c4b7221efb
2 changed files with 12 additions and 3 deletions

View File

@ -209,9 +209,18 @@ export interface ChipsSlots {
*/ */
removetokenicon(scope: { removetokenicon(scope: {
/** /**
* Remove icon click event * Style class of the icon.
*/ */
onClick(): void; class: string;
/**
* Index of the token.
*/
index: number;
/**
* Remove token icon function.
* @param {Event} event - Browser event
*/
onClick(event: Event, index: number): void;
}): VNode[]; }): VNode[];
} }
/** /**

View File

@ -31,7 +31,7 @@
<slot name="chip" :class="cx('label')" :value="val"> <slot name="chip" :class="cx('label')" :value="val">
<span :class="cx('label')" v-bind="ptm('label')">{{ val }}</span> <span :class="cx('label')" v-bind="ptm('label')">{{ val }}</span>
</slot> </slot>
<slot name="removetokenicon" :class="cx('removeTokenIcon')" :onClick="(event) => removeItem(event, i)"> <slot name="removetokenicon" :class="cx('removeTokenIcon')" :index="i" :onClick="(event) => removeItem(event, i)">
<component :is="removeTokenIcon ? 'span' : 'TimesCircleIcon'" :class="[cx('removeTokenIcon'), removeTokenIcon]" @click="removeItem($event, i)" aria-hidden="true" v-bind="ptm('removeTokenIcon')" /> <component :is="removeTokenIcon ? 'span' : 'TimesCircleIcon'" :class="[cx('removeTokenIcon'), removeTokenIcon]" @click="removeItem($event, i)" aria-hidden="true" v-bind="ptm('removeTokenIcon')" />
</slot> </slot>
</li> </li>