Add passthrough(pt) option to Accordion
parent
7001116104
commit
aff4519b9d
|
@ -12,6 +12,9 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
ptm(key = '', params = {}) {
|
ptm(key = '', params = {}) {
|
||||||
return ObjectUtils.getItemValue((this.pt || {})[key.toLowerCase()], { props: this.$props, state: this.$data, ...params });
|
return ObjectUtils.getItemValue((this.pt || {})[key.toLowerCase()], { props: this.$props, state: this.$data, ...params });
|
||||||
|
},
|
||||||
|
ptmo(obj = {}, key = '', params = {}) {
|
||||||
|
return ObjectUtils.getItemValue(obj[key.toLowerCase()], params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="p-accordion p-component">
|
<div class="p-accordion p-component" v-bind="ptm('root')">
|
||||||
<div v-for="(tab, i) of tabs" :key="getKey(tab, i)" :class="getTabClass(i)" :data-index="i">
|
<div v-for="(tab, i) of tabs" :key="getKey(tab, i)" :class="getTabClass(i)" :data-index="i" v-bind="getTabPT(tab, 'root')">
|
||||||
<div :style="getTabProp(tab, 'headerStyle')" :class="getTabHeaderClass(tab, i)" v-bind="getTabProp(tab, 'headerProps')">
|
<div :style="getTabProp(tab, 'headerStyle')" :class="getTabHeaderClass(tab, i)" v-bind="{ ...getTabProp(tab, 'headerProps'), ...getTabPT(tab, 'tabheader') }">
|
||||||
<a
|
<a
|
||||||
:id="getTabHeaderActionId(i)"
|
:id="getTabHeaderActionId(i)"
|
||||||
class="p-accordion-header-link p-accordion-header-action"
|
class="p-accordion-header-link p-accordion-header-action"
|
||||||
|
@ -40,11 +40,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ComponentBase from 'primevue/base';
|
||||||
import Ripple from 'primevue/ripple';
|
import Ripple from 'primevue/ripple';
|
||||||
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
import { DomHandler, UniqueComponentId } from 'primevue/utils';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Accordion',
|
name: 'Accordion',
|
||||||
|
extends: ComponentBase,
|
||||||
emits: ['update:activeIndex', 'tab-open', 'tab-close', 'tab-click'],
|
emits: ['update:activeIndex', 'tab-open', 'tab-close', 'tab-click'],
|
||||||
props: {
|
props: {
|
||||||
multiple: {
|
multiple: {
|
||||||
|
@ -112,6 +114,15 @@ export default {
|
||||||
getTabContentId(index) {
|
getTabContentId(index) {
|
||||||
return `${this.id}_${index}_content`;
|
return `${this.id}_${index}_content`;
|
||||||
},
|
},
|
||||||
|
getTabPT(tab, key) {
|
||||||
|
return this.ptmo(this.getTabProp(tab, 'pt'), key, {
|
||||||
|
props: tab.props,
|
||||||
|
parent: {
|
||||||
|
props: this.$props,
|
||||||
|
state: this.$data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
onTabClick(event, tab, index) {
|
onTabClick(event, tab, index) {
|
||||||
this.changeActiveIndex(event, tab, index);
|
this.changeActiveIndex(event, tab, index);
|
||||||
this.$emit('tab-click', { originalEvent: event, index });
|
this.$emit('tab-click', { originalEvent: event, index });
|
||||||
|
|
|
@ -3,8 +3,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import ComponentBase from 'primevue/base';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AccordionTab',
|
name: 'AccordionTab',
|
||||||
|
extends: ComponentBase,
|
||||||
props: {
|
props: {
|
||||||
header: null,
|
header: null,
|
||||||
headerStyle: null,
|
headerStyle: null,
|
||||||
|
|
Loading…
Reference in New Issue