Fixed #3899 - AutoComplete: class style and click event refactor on removetokenicon scoped slot

pull/3913/head
Tuğçe Küçükoğlu 2023-04-26 14:02:00 +03:00
parent 03d419e6c2
commit 48b33f4f81
2 changed files with 11 additions and 2 deletions

View File

@ -413,7 +413,16 @@ export interface AutoCompleteSlots {
/** /**
* Custom remove token icon template in multiple mode. * Custom remove token icon template in multiple mode.
*/ */
removetokenicon(): VNode[]; removetokenicon(scope: {
/**
* Style class of the icon.
*/
class: string;
/**
* Remove token icon function.
*/
onClick: void;
}): VNode[];
/** /**
* Custom loading icon template. * Custom loading icon template.
*/ */

View File

@ -53,7 +53,7 @@
<slot name="chip" :value="option"> <slot name="chip" :value="option">
<span class="p-autocomplete-token-label">{{ getOptionLabel(option) }}</span> <span class="p-autocomplete-token-label">{{ getOptionLabel(option) }}</span>
</slot> </slot>
<slot name="removetokenicon"> <slot name="removetokenicon" class="p-autocomplete-token-icon" :onClick="(event) => removeOption(event, i)">
<component :is="removeTokenIcon ? 'span' : 'TimesCircleIcon'" :class="['p-autocomplete-token-icon', removeTokenIcon]" @click="removeOption($event, i)" aria-hidden="true" /> <component :is="removeTokenIcon ? 'span' : 'TimesCircleIcon'" :class="['p-autocomplete-token-icon', removeTokenIcon]" @click="removeOption($event, i)" aria-hidden="true" />
</slot> </slot>
</li> </li>