This commit is contained in:
梁灏 2017-10-23 18:26:42 +08:00
parent b92a1b5c99
commit c2d74eca9a
2 changed files with 47 additions and 18 deletions

View file

@ -94,39 +94,65 @@
}
</script> -->
<!--<template>-->
<!--<div>-->
<!--<Button type="ghost" @click="toFirst" size="small">to first</Button>-->
<!--<Button type="ghost" @click="toLast" size="small">to last</Button>-->
<!--<Tabs type="card" :animated="animated" v-model="activeTab">-->
<!--<TabPane v-for="tab in tabs" :key="tab" :label="'标签' + tab" :name="tab+''" closable>标签{{ tab }}</TabPane>-->
<!--<div slot="extra">-->
<!--<Button type="ghost" @click="handleTabsAdd" size="small">增加</Button>-->
<!--</div>-->
<!--</Tabs>-->
<!--</div>-->
<!--</template>-->
<!--<script>-->
<!--export default {-->
<!--data () {-->
<!--return {-->
<!--tabs: 2,-->
<!--activeTab:"2",-->
<!--animated:true-->
<!--}-->
<!--},-->
<!--methods: {-->
<!--handleTabsAdd () {-->
<!--this.tabs ++;-->
<!--this.activeTab = this.tabs + '';-->
<!--},-->
<!--toFirst () {-->
<!--this.activeTab = '1';-->
<!--},-->
<!--toLast () {-->
<!--this.activeTab = this.tabs+'';-->
<!--}-->
<!--}-->
<!--}-->
<!--</script>-->
<template>
<div>
<Button type="ghost" @click="toFirst" size="small">to first</Button>
<Button type="ghost" @click="toLast" size="small">to last</Button>
<Tabs type="card" :animated="animated" v-model="activeTab">
<TabPane v-for="tab in tabs" :key="tab" :label="'标签' + tab" :name="tab+''" closable>标签{{ tab }}</TabPane>
<div slot="extra">
<Button type="ghost" @click="handleTabsAdd" size="small">增加</Button>
</div>
<Tabs type="card">
<TabPane v-for="tab in tabs" :key="tab" :label="'标签' + tab">标签{{ tab }}</TabPane>
</Tabs>
<Button type="ghost" @click="handleTabsAdd" size="small">增加</Button>
<Button type="ghost" @click="handleTabsMin" size="small">减少</Button>
</div>
</template>
<script>
export default {
data () {
return {
tabs: 2,
activeTab:"2",
animated:true
tabs: 2
}
},
methods: {
handleTabsAdd () {
this.tabs ++;
this.activeTab = this.tabs + '';
},
toFirst () {
this.activeTab = '1';
},
toLast () {
this.activeTab = this.tabs+'';
handleTabsMin () {
this.tabs --;
}
}
}
</script>

View file

@ -55,6 +55,9 @@
},
mounted () {
this.updateNav();
},
destroyed () {
this.updateNav();
}
};
</script>