Disabled tabs support for TabView

pull/3/head
cagataycivici 2018-12-11 22:39:08 +03:00
parent 4db09b7040
commit 1732d766d2
2 changed files with 29 additions and 6 deletions

View File

@ -1,7 +1,8 @@
<template> <template>
<div class="p-tabview p-component p-tabview-top"> <div class="p-tabview p-component p-tabview-top">
<ul class="p-tabview-nav p-resest" role="tablist"> <ul class="p-tabview-nav p-resest" role="tablist">
<li role="presentation" v-for="(tab,i) of tabs" :key="tab.header" :class="{'p-highlight': (d_activeTabIndex === i)}"> <li role="presentation" v-for="(tab,i) of tabs" :key="tab.header"
:class="{'p-highlight': (d_activeTabIndex === i), 'p-disabled': tab.disabled}">
<a role="tab" @click="onTabClick($event, tab, i)"> <a role="tab" @click="onTabClick($event, tab, i)">
<span class="p-tabview-title">{{tab.header}}</span> <span class="p-tabview-title">{{tab.header}}</span>
</a> </a>
@ -42,12 +43,14 @@ export default {
}, },
methods: { methods: {
onTabClick(event, tab, index) { onTabClick(event, tab, index) {
this.activateTab(index); if (!tab.disabled) {
this.activateTab(index);
this.$emit('tabchange', { this.$emit('tabchange', {
tab: tab, tab: tab,
index: index index: index
}); });
}
}, },
activateTab(index) { activateTab(index) {
this.d_activeTabIndex = index; this.d_activeTabIndex = index;

View File

@ -48,6 +48,26 @@
A decade earlier, he gave custody of his two children to Kay, who has since remarried. A decade earlier, he gave custody of his two children to Kay, who has since remarried.
</p-tabPanel> </p-tabPanel>
</p-tabView> </p-tabView>
<h3>Disabled</h3>
<p-tabView>
<p-tabPanel header="Godfather I">
The story begins as Don Vito Corleone, the head of a New York Mafia family, overseeshis daughter's wedding. His beloved son ichael has just come home from the war,
but does not intend to become part of his father's business. Through Michael's life the nature of the family business becomes clear. The business of the family is
just like the head of the family, kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
</p-tabPanel>
<p-tabPanel header="Godfather II">
Francis Ford Coppola's legendary continuation and sequel to his landmark 1972 film, TheGodfather parallels the young Vito Corleone's rise with his son Michael's spiritual fall,
deepening The Godfather's depiction of the dark side of the American dream. In the early 1900s, the child Vito flees his Sicilian village for America after the local Mafia kills
his family. Vito struggles to make a living, legally or illegally, for his wife and growing brood in Little Italy.
</p-tabPanel>
<p-tabPanel header="Godfather III">
The Godfather Part III is set in 1979 and 1980. Michael has moved back to New York and taken great strides to remove the family from crime. He turns over his New York criminal
interests to longtime enforcer Joey Zasa. He uses his wealth in an attempt to rehabilitate his reputation through numerous philanthropic acts, administered by a foundation named after his father.
A decade earlier, he gave custody of his two children to Kay, who has since remarried.
</p-tabPanel>
<p-tabPanel header="Godfather IV" :disabled="true"></p-tabPanel>
</p-tabView>
</div> </div>
</div> </div>
</template> </template>