update Tabs

This commit is contained in:
梁灏 2017-03-23 11:03:43 +08:00
parent 8948742c75
commit 087ad37d3f
2 changed files with 19 additions and 54 deletions

View file

@ -1,59 +1,23 @@
<style>
.demo-tabs-style1 > .ivu-tabs-card > .ivu-tabs-content {
height: 120px;
margin-top: -16px;
}
.demo-tabs-style1 > .ivu-tabs-card > .ivu-tabs-content > .ivu-tabs-tabpane {
background: #fff;
padding: 16px;
}
.demo-tabs-style1 > .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab {
border-color: transparent;
}
.demo-tabs-style1 > .ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab-active {
border-color: #fff;
}
.demo-tabs-style2 > .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab{
border-radius: 0;
background: #fff;
}
.demo-tabs-style2 > .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab-active{
border-top: 1px solid #3399ff;
}
.demo-tabs-style2 > .ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-tab-active:before{
content: '';
display: block;
width: 100%;
height: 1px;
background: #3399ff;
position: absolute;
top: 0;
left: 0;
}
</style>
<template>
<Row :gutter="32">
<i-col span="12" class="demo-tabs-style1" style="background: #e3e8ee;padding:16px;">
<Tabs type="card">
<Tab-pane label="标签一">标签一的内容</Tab-pane>
<Tab-pane label="标签二">标签二的内容</Tab-pane>
<Tab-pane label="标签三">标签三的内容</Tab-pane>
</Tabs>
</i-col>
<i-col span="12" class="demo-tabs-style2">
<Tabs type="card">
<Tab-pane label="标签一">标签一的内容</Tab-pane>
<Tab-pane label="标签二">标签二的内容</Tab-pane>
<Tab-pane label="标签三">标签三的内容</Tab-pane>
</Tabs>
</i-col>
</Row>
<Tabs type="card" closable @on-tab-remove="handleTagRemove">
<Tab-pane label="标签一" v-if="tab0">标签一的内容</Tab-pane>
<Tab-pane label="标签二" v-if="tab1">标签二的内容</Tab-pane>
<Tab-pane label="标签三" v-if="tab2">标签三的内容</Tab-pane>
</Tabs>
</template>
<script>
export default {
data () {
return {
tab0: true,
tab1: true,
tab2: true
}
},
methods: {
handleTagRemove (name) {
this['tab' + name] = false;
}
}
}
</script>

View file

@ -181,7 +181,7 @@
handleRemove (index) {
const tabs = this.getTabs();
const tab = tabs[index];
tab.$destroy(true);
tab.$destroy();
if (tab.currentName === this.activeKey) {
const newTabs = this.getTabs();
@ -200,6 +200,7 @@
}
}
this.activeKey = activeKey;
this.$emit('input', activeKey);
}
this.$emit('on-tab-remove', tab.currentName);
this.updateNav();