primevue-mirror/doc/tabview/ScrollableDoc.vue

71 lines
1.9 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Adding <i>scrollable</i> property displays navigational buttons at each side to scroll between tabs.</p>
</DocSectionText>
<div class="card">
<TabView :scrollable="true">
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
<p>{{ tab.content }}</p>
</TabPanel>
</TabView>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
scrollableTabs: Array.from({ length: 50 }, (_, i) => ({ title: `Tab ${i + 1}`, content: `Tab ${i + 1} Content` })),
code: {
2023-09-22 12:54:14 +00:00
basic: `
<TabView :scrollable="true">
2023-02-28 08:29:30 +00:00
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
<p>{{ tab.content }}</p>
</TabPanel>
2023-10-15 09:38:39 +00:00
</TabView>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-03-09 11:39:38 +00:00
<div class="card">
2023-02-28 08:29:30 +00:00
<TabView :scrollable="true">
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
<p>{{ tab.content }}</p>
</TabPanel>
</TabView>
</div>
</template>
<script>
export default {
data() {
return {
scrollableTabs: Array.from({ length: 50 }, (_, i) => ({ title: \`Tab \${i + 1}\`, content: \`Tab \${i + 1} Content\` }))
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-03-09 11:39:38 +00:00
<div class="card">
2023-02-28 08:29:30 +00:00
<TabView :scrollable="true">
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
<p>{{ tab.content }}</p>
</TabPanel>
</TabView>
</div>
</template>
<script setup>
import { ref } from 'vue';
const scrollableTabs = ref(Array.from({ length: 50 }, (_, i) => ({ title: \`Tab \${i + 1}\`, content: \`Tab \${i + 1} Content\` })));
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>