Refactor #4274 - For AutoComplete

pull/3943/head^2
Tuğçe Küçükoğlu 2023-08-16 09:24:31 +03:00
parent c263620978
commit dfb30bc1ac
2 changed files with 14 additions and 4 deletions

View File

@ -603,14 +603,24 @@ export interface AutoCompleteSlots {
*/ */
class: string; class: string;
/** /**
* Remove token icon function. * Index of the token.
*/ */
onClick: void; index: number;
/**
* Remove token icon function.
* @param {Event} event - Browser event
*/
onClick(event: Event, index: number): void;
}): VNode[]; }): VNode[];
/** /**
* Custom loading icon template. * Custom loading icon template.
*/ */
loadingicon(): VNode[]; loadingicon(scope: {
/**
* Style class of the loading icon.
*/
class: string;
}): VNode[];
} }
/** /**

View File

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