Fixed #4679 - Accordion: new togglericon slot

pull/4683/head
Tuğçe Küçükoğlu 2023-10-24 15:44:47 +03:00
parent 0d1beb2f1c
commit 61c7212438
2 changed files with 16 additions and 0 deletions

View File

@ -174,6 +174,21 @@ export interface AccordionSlots {
* Default slot to detect AccordionTab components.
*/
default(): VNode[];
/**
* Custom toggler icon template.
* @param {Object} scope - togglericon slot's params.
*/
togglericon(scope: {
/**
* Current index of the tab
*/
index: number;
/**
* Whether the current tab is active
* @param {number} index - Current index of the tab
*/
isTabActive: (index: number) => void;
}): VNode[];
}
/**

View File

@ -21,6 +21,7 @@
v-bind="{ ...getTabProp(tab, 'headeractionprops'), ...getTabPT(tab, 'headeraction', i) }"
>
<component v-if="tab.children && tab.children.headericon" :is="tab.children.headericon" :isTabActive="isTabActive(i)" :index="i"></component>
<component v-else-if="$slots.toggleicon" :is="$slots.toggleicon" :isTabActive="isTabActive(i)" :index="i"></component>
<component v-else-if="isTabActive(i)" :is="collapseIcon ? 'span' : 'ChevronDownIcon'" :class="[cx('tab.headerIcon'), collapseIcon]" aria-hidden="true" v-bind="getTabPT(tab, 'headericon', i)" />
<component v-else :is="expandIcon ? 'span' : 'ChevronRightIcon'" :class="[cx('tab.headerIcon'), expandIcon]" aria-hidden="true" v-bind="getTabPT(tab, 'headericon', i)" />
<span v-if="tab.props && tab.props.header" :class="cx('tab.headerTitle')" v-bind="getTabPT(tab, 'headertitle', i)">{{ tab.props.header }}</span>