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

View file

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