Update Tabview demo
parent
85be3bb715
commit
41fe395bf3
|
@ -33,12 +33,12 @@
|
|||
<div class="card">
|
||||
<h5>Programmatic</h5>
|
||||
<div class="p-py-2">
|
||||
<Button @click="active = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active = 1" class="p-button-text p-mr-2" label="Activate 2nd" />
|
||||
<Button @click="active = 2" class="p-button-text p-mr-2" label="Activate 3rd" />
|
||||
<Button @click="active1 = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active1 = 1" class="p-button-text p-mr-2" label="Activate 2nd" />
|
||||
<Button @click="active1 = 2" class="p-button-text p-mr-2" label="Activate 3rd" />
|
||||
</div>
|
||||
|
||||
<TabView ref="tabview2" v-model:activeIndex="active">
|
||||
<TabView ref="tabview2" v-model:activeIndex="active1">
|
||||
<TabPanel header="Header I">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
|
||||
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
||||
|
@ -121,6 +121,21 @@
|
|||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h5>Scrollable</h5>
|
||||
<div class="p-py-2">
|
||||
<Button @click="active2 = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active2 = 29" class="p-button-text p-mr-2" label="Activate 30th" />
|
||||
<Button @click="active2 = 49" class="p-button-text p-mr-2" label="Activate 50th" />
|
||||
</div>
|
||||
|
||||
<TabView v-model:activeIndex="active2" :scrollable="true">
|
||||
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
|
||||
<p>{{tab.content}}</p>
|
||||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TabViewDoc/>
|
||||
|
@ -134,7 +149,8 @@ import EventBus from '@/AppEventBus';
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
active1: 0,
|
||||
active2: 0,
|
||||
tabs: [
|
||||
{
|
||||
title: 'Header I',
|
||||
|
@ -154,7 +170,8 @@ export default {
|
|||
cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio.
|
||||
Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus.`
|
||||
}
|
||||
]
|
||||
],
|
||||
scrollableTabs: Array.from({ length: 50 }, (_, i) => ({ title: `Tab ${i + 1}`, content: `Tab ${i + 1} Content` }))
|
||||
}
|
||||
},
|
||||
timeout: null,
|
||||
|
|
|
@ -333,12 +333,12 @@ export default {
|
|||
<div class="card">
|
||||
<h5>Programmatic</h5>
|
||||
<div class="p-py-2">
|
||||
<Button @click="active = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active = 1" class="p-button-text p-mr-2" label="Activate 2nd" />
|
||||
<Button @click="active = 2" class="p-button-text p-mr-2" label="Activate 3rd" />
|
||||
<Button @click="active1 = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active1 = 1" class="p-button-text p-mr-2" label="Activate 2nd" />
|
||||
<Button @click="active1 = 2" class="p-button-text p-mr-2" label="Activate 3rd" />
|
||||
</div>
|
||||
|
||||
<TabView ref="tabview2" v-model:activeIndex="active">
|
||||
<TabView ref="tabview2" v-model:activeIndex="active1">
|
||||
<TabPanel header="Header I">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</TabPanel>
|
||||
|
@ -409,6 +409,21 @@ export default {
|
|||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h5>Scrollable</h5>
|
||||
<div class="p-py-2">
|
||||
<Button @click="active2 = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active2 = 29" class="p-button-text p-mr-2" label="Activate 30th" />
|
||||
<Button @click="active2 = 49" class="p-button-text p-mr-2" label="Activate 50th" />
|
||||
</div>
|
||||
|
||||
<TabView v-model:activeIndex="active2" :scrollable="true">
|
||||
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
|
||||
<p>{{tab.content}}</p>
|
||||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -416,7 +431,8 @@ export default {
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 0,
|
||||
active1: 0,
|
||||
active2: 0,
|
||||
tabs: [
|
||||
{
|
||||
title: 'Header I',
|
||||
|
@ -430,7 +446,8 @@ export default {
|
|||
title: 'Header III',
|
||||
content: "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus."
|
||||
}
|
||||
]
|
||||
],
|
||||
scrollableTabs: Array.from({ length: 50 }, (_, i) => ({ title: \`Tab \${i + 1}\`, content: \`Tab \${i + 1} Content\` }))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -476,12 +493,12 @@ export default {
|
|||
<div class="card">
|
||||
<h5>Programmatic</h5>
|
||||
<div class="p-py-2">
|
||||
<Button @click="active = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active = 1" class="p-button-text p-mr-2" label="Activate 2nd" />
|
||||
<Button @click="active = 2" class="p-button-text p-mr-2" label="Activate 3rd" />
|
||||
<Button @click="active1 = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active1 = 1" class="p-button-text p-mr-2" label="Activate 2nd" />
|
||||
<Button @click="active1 = 2" class="p-button-text p-mr-2" label="Activate 3rd" />
|
||||
</div>
|
||||
|
||||
<TabView ref="tabview2" v-model:activeIndex="active">
|
||||
<TabView ref="tabview2" v-model:activeIndex="active1">
|
||||
<TabPanel header="Header I">
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||
</TabPanel>
|
||||
|
@ -552,6 +569,21 @@ export default {
|
|||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h5>Scrollable</h5>
|
||||
<div class="p-py-2">
|
||||
<Button @click="active2 = 0" class="p-button-text" label="Activate 1st" />
|
||||
<Button @click="active2 = 29" class="p-button-text p-mr-2" label="Activate 30th" />
|
||||
<Button @click="active2 = 49" class="p-button-text p-mr-2" label="Activate 50th" />
|
||||
</div>
|
||||
|
||||
<TabView v-model:activeIndex="active2" :scrollable="true">
|
||||
<TabPanel v-for="tab in scrollableTabs" :key="tab.title" :header="tab.title">
|
||||
<p>{{tab.content}}</p>
|
||||
</TabPanel>
|
||||
</TabView>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -560,7 +592,8 @@ import { ref } from 'vue';
|
|||
|
||||
export default {
|
||||
setup() {
|
||||
const active = ref(0);
|
||||
const active1 = ref(0);
|
||||
const active2 = ref(0);
|
||||
const tabs = ref([
|
||||
{
|
||||
title: 'Header I',
|
||||
|
@ -575,8 +608,9 @@ export default {
|
|||
content: "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus."
|
||||
}
|
||||
]);
|
||||
const scrollableTabs = ref(Array.from({ length: 50 }, (_, i) => ({ title: \`Tab \${i + 1}\`, content: \`Tab \${i + 1} Content\` })));
|
||||
|
||||
return { active, tabs }
|
||||
return { active1, active2, tabs, scrollableTabs }
|
||||
}
|
||||
}
|
||||
<\\/script>
|
||||
|
|
Loading…
Reference in New Issue