diff --git a/components/lib/accordion/Accordion.vue b/components/lib/accordion/Accordion.vue index 911802e38..1aa48c834 100755 --- a/components/lib/accordion/Accordion.vue +++ b/components/lib/accordion/Accordion.vue @@ -95,6 +95,7 @@ export default { return `${this.id}_${index}_content`; }, getTabPT(tab, key, index) { + const count = this.tabs.length; const tabMetaData = { props: tab.props, parent: { @@ -102,7 +103,10 @@ export default { state: this.$data }, context: { - index + index, + count, + first: index === 0, + last: index === count - 1 } }; diff --git a/components/lib/accordiontab/AccordionTab.d.ts b/components/lib/accordiontab/AccordionTab.d.ts index c9ebb214b..92db103b3 100755 --- a/components/lib/accordiontab/AccordionTab.d.ts +++ b/components/lib/accordiontab/AccordionTab.d.ts @@ -123,6 +123,18 @@ export interface AccordionTabContext { * Current index of the tab. */ index: number; + /** + * Count of tabs + */ + count: number; + /** + * Whether the tab is first. + */ + first: boolean; + /** + * Whether the tab is last. + */ + last: boolean; } /**