2023-03-31 23:42:09 +00:00
|
|
|
<template>
|
2023-04-11 07:17:19 +00:00
|
|
|
<DocSectionText v-bind="$attrs"> </DocSectionText>
|
2023-03-31 23:42:09 +00:00
|
|
|
<div class="card">
|
2023-04-07 13:01:40 +00:00
|
|
|
<Accordion :activeIndex="0">
|
2023-04-11 07:17:19 +00:00
|
|
|
<AccordionTab
|
|
|
|
v-for="(tab, index) in tabs"
|
|
|
|
:key="tab.title"
|
|
|
|
:header="tab.title"
|
|
|
|
:pt="{
|
|
|
|
headeraction: ({ props, parent }) => ({
|
|
|
|
class: panelClass(props, parent, index)
|
|
|
|
})
|
|
|
|
}"
|
|
|
|
>
|
|
|
|
<p>{{ tab.content }}</p>
|
2023-04-07 13:01:40 +00:00
|
|
|
</AccordionTab>
|
|
|
|
</Accordion>
|
2023-03-31 23:42:09 +00:00
|
|
|
</div>
|
|
|
|
<DocSectionCode :code="code" />
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
2023-04-11 07:17:19 +00:00
|
|
|
tabs: Array.from({ length: 3 }, (_, i) => ({
|
|
|
|
title: `Header ${i + 1}`,
|
|
|
|
content: `Tab ${i + 1} Content`
|
|
|
|
})),
|
2023-03-31 23:42:09 +00:00
|
|
|
code: {
|
|
|
|
basic: `
|
2023-04-07 13:01:40 +00:00
|
|
|
<Accordion :activeIndex="0">
|
2023-04-11 07:17:19 +00:00
|
|
|
<AccordionTab v-for="(tab, index) in tabs" :key="tab.title" :header="tab.title"
|
|
|
|
:pt="{
|
|
|
|
headeraction: ({ props, parent }) => ({
|
|
|
|
class: panelClass(props, parent, index)
|
|
|
|
})
|
|
|
|
}">
|
|
|
|
<p>{{ tab.content }}</p>
|
2023-04-07 13:01:40 +00:00
|
|
|
</AccordionTab>
|
|
|
|
</Accordion>`,
|
2023-03-31 23:42:09 +00:00
|
|
|
options: `
|
|
|
|
<template>
|
2023-04-07 13:01:40 +00:00
|
|
|
<div class="card">
|
|
|
|
<Accordion :activeIndex="0">
|
2023-04-11 07:17:19 +00:00
|
|
|
<AccordionTab v-for="(tab, index) in tabs" :key="tab.title" :header="tab.title"
|
|
|
|
:pt="{
|
|
|
|
headeraction: ({ props, parent }) => ({
|
|
|
|
class: panelClass(props, parent, index)
|
|
|
|
})
|
|
|
|
}">
|
|
|
|
<p>{{ tab.content }}</p>
|
2023-04-07 13:01:40 +00:00
|
|
|
</AccordionTab>
|
|
|
|
</Accordion>
|
|
|
|
</div>
|
2023-03-31 23:42:09 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-04-11 07:17:19 +00:00
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
tabs: Array.from({ length: 3 }, (_, i) => ({
|
|
|
|
title: \`Header \${i + 1}\`,
|
|
|
|
content: \`Tab \${i + 1} Content\`
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
panelClass(props, parent, index) {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
'bg-primary': parent.state.d_activeIndex === index
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-31 23:42:09 +00:00
|
|
|
<\/script>`,
|
|
|
|
composition: `
|
|
|
|
<template>
|
2023-04-07 13:01:40 +00:00
|
|
|
<div class="card">
|
|
|
|
<Accordion :activeIndex="0">
|
2023-04-11 07:17:19 +00:00
|
|
|
<AccordionTab v-for="(tab, index) in tabs" :key="tab.title" :header="tab.title"
|
|
|
|
:pt="{
|
|
|
|
headeraction: ({ props, parent }) => ({
|
|
|
|
class: panelClass(props, parent, index)
|
|
|
|
})
|
|
|
|
}">
|
|
|
|
<p>{{ tab.content }}</p>
|
2023-04-07 13:01:40 +00:00
|
|
|
</AccordionTab>
|
|
|
|
</Accordion>
|
|
|
|
</div>
|
2023-03-31 23:42:09 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2023-04-11 07:17:19 +00:00
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
|
const tabs = ref(Array.from({ length: 3 }, (_, i) => ({
|
|
|
|
title: \`Header \${i + 1}\`,
|
|
|
|
content: \`Tab \${i + 1} Content\`
|
|
|
|
})));
|
|
|
|
|
|
|
|
const panelClass = (props, parent, index) => {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
'bg-primary': parent.state.d_activeIndex === index
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2023-03-31 23:42:09 +00:00
|
|
|
<\/script>`
|
|
|
|
}
|
|
|
|
};
|
2023-04-11 07:17:19 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
panelClass(props, parent, index) {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
'bg-primary': parent.state.d_activeIndex === index
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
2023-03-31 23:42:09 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|