mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Fixed #5643 - Reimplement: Accordion
This commit is contained in:
parent
6cbb5e0993
commit
10f530f7b1
30 changed files with 1049 additions and 243 deletions
40
components/lib/accordionpanel/AccordionPanel.vue
Normal file
40
components/lib/accordionpanel/AccordionPanel.vue
Normal file
|
@ -0,0 +1,40 @@
|
|||
<template>
|
||||
<component v-if="!asChild" :is="as" v-ripple :class="cx('root')" v-bind="attrs">
|
||||
<slot></slot>
|
||||
</component>
|
||||
<slot v-else :class="cx('root')" :active="active" :a11yAttrs="a11yAttrs"></slot>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mergeProps } from 'vue';
|
||||
import BaseAccordionPanel from './BaseAccordionPanel.vue';
|
||||
|
||||
export default {
|
||||
name: 'AccordionPanel',
|
||||
extends: BaseAccordionPanel,
|
||||
inheritAttrs: false,
|
||||
inject: ['$pcAccordion'],
|
||||
computed: {
|
||||
active() {
|
||||
return this.$pcAccordion.isItemActive(this.value);
|
||||
},
|
||||
attrs() {
|
||||
return mergeProps(this.a11yAttrs, this.ptmi('root', this.ptParams));
|
||||
},
|
||||
a11yAttrs() {
|
||||
return {
|
||||
'data-pc-name': 'accordionpanel',
|
||||
'data-p-disabled': this.disabled,
|
||||
'data-p-active': this.active
|
||||
};
|
||||
},
|
||||
ptParams() {
|
||||
return {
|
||||
context: {
|
||||
active: this.active
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue