update tabmenu demo, doc
parent
2495d6099a
commit
132f91f7aa
|
@ -10,9 +10,21 @@
|
|||
|
||||
<div class="content-section implementation">
|
||||
<div class="card">
|
||||
<h5>Default</h5>
|
||||
<TabMenu :model="items" />
|
||||
<router-view/>
|
||||
</div>
|
||||
|
||||
<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" />
|
||||
</div>
|
||||
|
||||
<TabMenu :model="items2" v-model:activeIndex="active" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TabMenuDoc />
|
||||
|
@ -25,12 +37,20 @@ import TabMenuDoc from './TabMenuDoc';
|
|||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 3,
|
||||
items: [
|
||||
{label: 'Home', icon: 'pi pi-fw pi-home', to: '/tabmenu'},
|
||||
{label: 'Calendar', icon: 'pi pi-fw pi-calendar', to: '/tabmenu/calendar'},
|
||||
{label: 'Edit', icon: 'pi pi-fw pi-pencil', to: '/tabmenu/edit'},
|
||||
{label: 'Documentation', icon: 'pi pi-fw pi-file', to: '/tabmenu/documentation'},
|
||||
{label: 'Settings', icon: 'pi pi-fw pi-cog', to: '/tabmenu/settings'}
|
||||
],
|
||||
items2: [
|
||||
{label: 'Home', icon: 'pi pi-fw pi-home'},
|
||||
{label: 'Calendar', icon: 'pi pi-fw pi-calendar'},
|
||||
{label: 'Edit', icon: 'pi pi-fw pi-pencil'},
|
||||
{label: 'Documentation', icon: 'pi pi-fw pi-file'},
|
||||
{label: 'Settings', icon: 'pi pi-fw pi-cog'}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
|
@ -10,7 +10,30 @@ import TabMenu from 'primevue/tabmenu';
|
|||
<p>TabMenu uses the common MenuModel API to define the items, visit <router-link to="/menumodel">MenuModel API</router-link> for details.</p>
|
||||
|
||||
<h5>Getting Started</h5>
|
||||
<p>TabMenu is integrated with Vue Router and requires a collection of menuitems as its model.</p>
|
||||
<p>TabMenu requires a collection of menuitems as its model.</p>
|
||||
<pre v-code><code>
|
||||
<TabMenu :model="items" />
|
||||
|
||||
</code></pre>
|
||||
|
||||
<pre v-code.script><code>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
items: [
|
||||
{label: 'Home', icon: 'pi pi-fw pi-home'},
|
||||
{label: 'Calendar', icon: 'pi pi-fw pi-calendar'},
|
||||
{label: 'Edit', icon: 'pi pi-fw pi-pencil'},
|
||||
{label: 'Documentation', icon: 'pi pi-fw pi-file'},
|
||||
{label: 'Settings', icon: 'pi pi-fw pi-cog'}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</code></pre>
|
||||
|
||||
<p>TabMenu can be also integrated with Vue Router.</p>
|
||||
<pre v-code><code>
|
||||
<TabMenu :model="items" />
|
||||
<router-view />
|
||||
|
@ -32,6 +55,20 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h5>Active</h5>
|
||||
<p>Visibility of the content is specified with the activeIndex property that supports one or two-way binding.</p>
|
||||
|
||||
<pre v-code><code>
|
||||
<TabMenu :model="items" :activeIndex="activeIndex" />
|
||||
|
||||
</code></pre>
|
||||
|
||||
<p>Two-way binding requires v-model.</p>
|
||||
<pre v-code><code>
|
||||
<TabMenu :model="items" v-model:activeIndex="activeIndex" />
|
||||
|
||||
</code></pre>
|
||||
|
||||
<h5>Templating</h5>
|
||||
|
@ -69,6 +106,34 @@ export default {
|
|||
<td>boolean</td>
|
||||
<td>true</td>
|
||||
<td>Defines if active route highlight should match the exact route path.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>activeIndex</td>
|
||||
<td>number</td>
|
||||
<td>0</td>
|
||||
<td>Active index of menuitem.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h5>Events</h5>
|
||||
<div class="doc-tablewrapper">
|
||||
<table class="doc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Parameters</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>tab-change</td>
|
||||
<td>event.originalEvent: Browser event <br/>
|
||||
event.index: Index of the selected tab
|
||||
</td>
|
||||
<td>Callback to invoke when an active tab is changed.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -146,15 +211,30 @@ export default {
|
|||
content: `
|
||||
<template>
|
||||
<div>
|
||||
<div class="card">
|
||||
<h5>Default</h5>
|
||||
<TabMenu :model="items" />
|
||||
<router-view/>
|
||||
</div>
|
||||
|
||||
<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" />
|
||||
</div>
|
||||
|
||||
<TabMenu :model="items2" v-model:activeIndex="active" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
active: 3,
|
||||
items: [
|
||||
{
|
||||
label: 'Home',
|
||||
|
@ -181,6 +261,28 @@ export default {
|
|||
icon: 'pi pi-fw pi-cog',
|
||||
to: '/settings'
|
||||
}
|
||||
],
|
||||
items2: [
|
||||
{
|
||||
label: 'Home',
|
||||
icon: 'pi pi-fw pi-home'
|
||||
},
|
||||
{
|
||||
label: 'Calendar',
|
||||
icon: 'pi pi-fw pi-calendar'
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
icon: 'pi pi-fw pi-pencil'
|
||||
},
|
||||
{
|
||||
label: 'Documentation',
|
||||
icon: 'pi pi-fw pi-file'
|
||||
},
|
||||
{
|
||||
label: 'Settings',
|
||||
icon: 'pi pi-fw pi-cog'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +300,23 @@ export default {
|
|||
content: `
|
||||
<template>
|
||||
<div>
|
||||
<div class="card">
|
||||
<h5>Default</h5>
|
||||
<TabMenu :model="items" />
|
||||
<router-view/>
|
||||
</div>
|
||||
|
||||
<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" />
|
||||
</div>
|
||||
|
||||
<TabMenu :model="items2" v-model:activeIndex="active" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -208,6 +324,7 @@ import { ref } from 'vue';
|
|||
|
||||
export default {
|
||||
setup() {
|
||||
const active = ref(3);
|
||||
const items = ref([
|
||||
{
|
||||
label: 'Home',
|
||||
|
@ -235,8 +352,30 @@ export default {
|
|||
to: '/settings'
|
||||
}
|
||||
]);
|
||||
const items2 = ref([
|
||||
{
|
||||
label: 'Home',
|
||||
icon: 'pi pi-fw pi-home'
|
||||
},
|
||||
{
|
||||
label: 'Calendar',
|
||||
icon: 'pi pi-fw pi-calendar'
|
||||
},
|
||||
{
|
||||
label: 'Edit',
|
||||
icon: 'pi pi-fw pi-pencil'
|
||||
},
|
||||
{
|
||||
label: 'Documentation',
|
||||
icon: 'pi pi-fw pi-file'
|
||||
},
|
||||
{
|
||||
label: 'Settings',
|
||||
icon: 'pi pi-fw pi-cog'
|
||||
}
|
||||
]);
|
||||
|
||||
return { items }
|
||||
return { active, items, items2 }
|
||||
}
|
||||
}
|
||||
<\\/script>
|
||||
|
|
Loading…
Reference in New Issue