optimize Tabs

This commit is contained in:
mo.duan 2019-09-24 12:02:52 +08:00
parent b143ea52eb
commit 551c730771
2 changed files with 32 additions and 14 deletions

View file

@ -55,22 +55,40 @@
<!-- }--> <!-- }-->
<!-- }--> <!-- }-->
<!--</script>--> <!--</script>-->
<!--<template>-->
<!-- <div>-->
<!-- <Button @click="showSecond = !showSecond">change</Button>-->
<!-- <Tabs value="name1">-->
<!-- <TabPane label="标签一" name="name1" :index="1">标签一的内容</TabPane>-->
<!-- <TabPane label="标签二" name="name2" :index="2" v-if="showSecond">标签二的内容</TabPane>-->
<!-- <TabPane label="标签三" name="name3" :index="3">标签三的内容</TabPane>-->
<!-- </Tabs>-->
<!-- </div>-->
<!--</template>-->
<!--<script>-->
<!-- export default {-->
<!-- data () {-->
<!-- return {-->
<!-- showSecond: false-->
<!-- }-->
<!-- }-->
<!-- }-->
<!--</script>-->
<template> <template>
<div> <Tabs>
<Button @click="showSecond = !showSecond">change</Button> <TabPane label="macOS" icon="logo-apple">
<Tabs value="name1"> <Tabs>
<TabPane label="标签一" name="name1" :index="1">标签一的内容</TabPane> <TabPane label="macOS" icon="logo-apple">标签一的内容</TabPane>
<TabPane label="标签二" name="name2" :index="2" v-if="showSecond">标签二的内容</TabPane> <TabPane label="Windows" icon="logo-windows">标签二的内容</TabPane>
<TabPane label="标签三" name="name3" :index="3">标签三的内容</TabPane> <TabPane label="Linux" icon="logo-tux">标签三的内容</TabPane>
</Tabs> </Tabs>
</div> </TabPane>
<TabPane label="Windows" icon="logo-windows">标签二的内容</TabPane>
<TabPane label="Linux" icon="logo-tux">标签三的内容</TabPane>
</Tabs>
</template> </template>
<script> <script>
export default { export default {
data () {
return {
showSecond: false
}
}
} }
</script> </script>

View file

@ -217,7 +217,7 @@
if (item.tab === this.name) { if (item.tab === this.name) {
TabPanes.push(item); TabPanes.push(item);
} }
} else if (this.$children.indexOf(item) !== -1) { }else if (this.$children.includes(item)) { // #6279 #6299
TabPanes.push(item); TabPanes.push(item);
} }
}); });