Skip to content

Commit

Permalink
Disabled tabs support for TabView
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Dec 11, 2018
1 parent 4db09b7 commit 1732d76
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/components/tabview/TabView.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<template>
<div class="p-tabview p-component p-tabview-top">
<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)">
<span class="p-tabview-title">{{tab.header}}</span>
</a>
Expand Down Expand Up @@ -42,12 +43,14 @@ export default {
},
methods: {
onTabClick(event, tab, index) {
this.activateTab(index);
if (!tab.disabled) {
this.activateTab(index);
this.$emit('tabchange', {
tab: tab,
index: index
});
this.$emit('tabchange', {
tab: tab,
index: index
});
}
},
activateTab(index) {
this.d_activeTabIndex = index;
Expand Down
20 changes: 20 additions & 0 deletions src/views/tabview/TabViewDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@
A decade earlier, he gave custody of his two children to Kay, who has since remarried.
</p-tabPanel>
</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>
</template>
Expand Down

0 comments on commit 1732d76

Please sign in to comment.