fixed #206
This commit is contained in:
梁灏 2017-01-16 14:36:53 +08:00
parent d0788ae9dd
commit 7a737482f0
3 changed files with 25 additions and 14 deletions

View file

@ -9,7 +9,7 @@
<div :class="tabCls(item)" v-for="item in navList" @click="handleChange($index)">
<Icon v-if="item.icon !== ''" :type="item.icon"></Icon>
{{ item.label }}
<Icon v-if="closable && type === 'card'" type="ios-close-empty" @click.stop="handleRemove($index)"></Icon>
<Icon v-if="showClose(item)" type="ios-close-empty" @click.stop="handleRemove($index)"></Icon>
</div>
</div>
</div>
@ -125,7 +125,8 @@
label: pane.label,
icon: pane.icon || '',
key: pane.key || index,
disabled: pane.disabled
disabled: pane.disabled,
closable: pane.closable
});
if (!pane.key) pane.key = index;
if (index === 0) {
@ -199,6 +200,17 @@
}
this.$emit('on-tab-remove', tab.key);
this.updateNav();
},
showClose (item) {
if (this.type === 'card') {
if (item.closable !== null) {
return item.closable;
} else {
return this.closable;
}
} else {
return false;
}
}
},
watch: {