Tabs add global setting, #5592

This commit is contained in:
梁灏 2019-04-10 14:07:07 +08:00
parent 154bb8226e
commit 383e96a86a
3 changed files with 44 additions and 4 deletions

View file

@ -19,7 +19,7 @@
<Icon v-if="item.icon !== ''" :type="item.icon"></Icon> <Icon v-if="item.icon !== ''" :type="item.icon"></Icon>
<Render v-if="item.labelType === 'function'" :render="item.label"></Render> <Render v-if="item.labelType === 'function'" :render="item.label"></Render>
<template v-else>{{ item.label }}</template> <template v-else>{{ item.label }}</template>
<Icon v-if="showClose(item)" type="ios-close" @click.native.stop="handleRemove(index)"></Icon> <Icon :class="[prefixCls + '-close']" v-if="showClose(item)" :type="arrowType" :custom="customArrowType" :size="arrowSize" @click.native.stop="handleRemove(index)"></Icon>
</div> </div>
</div> </div>
</div> </div>
@ -169,6 +169,41 @@
} }
return style; return style;
},
// 3.4.0, global setting customArrow arrow
arrowType () {
let type = 'ios-close';
if (this.$IVIEW) {
if (this.$IVIEW.tabs.customCloseIcon) {
type = '';
} else if (this.$IVIEW.tabs.closeIcon) {
type = this.$IVIEW.tabs.closeIcon;
}
}
return type;
},
// 3.4.0, global setting
customArrowType () {
let type = '';
if (this.$IVIEW) {
if (this.$IVIEW.tabs.customCloseIcon) {
type = this.$IVIEW.tabs.customCloseIcon;
}
}
return type;
},
// 3.4.0, global setting
arrowSize () {
let size = '';
if (this.$IVIEW) {
if (this.$IVIEW.tabs.closeIconSize) {
size = this.$IVIEW.tabs.closeIconSize;
}
}
return size;
} }
}, },
methods: { methods: {

View file

@ -211,6 +211,11 @@ const install = function(Vue, opts = {}) {
icon: opts.timePicker ? opts.timePicker.icon ? opts.timePicker.icon : '' : '', icon: opts.timePicker ? opts.timePicker.icon ? opts.timePicker.icon : '' : '',
customIcon: opts.timePicker ? opts.timePicker.customIcon ? opts.timePicker.customIcon : '' : '', customIcon: opts.timePicker ? opts.timePicker.customIcon ? opts.timePicker.customIcon : '' : '',
iconSize: opts.timePicker ? opts.timePicker.iconSize ? opts.timePicker.iconSize : '' : '' iconSize: opts.timePicker ? opts.timePicker.iconSize ? opts.timePicker.iconSize : '' : ''
},
tabs: {
closeIcon: opts.tabs ? opts.tabs.closeIcon ? opts.tabs.closeIcon : '' : '',
customCloseIcon: opts.tabs ? opts.tabs.customCloseIcon ? opts.tabs.customCloseIcon : '' : '',
closeIconSize: opts.tabs ? opts.tabs.closeIconSize ? opts.tabs.closeIconSize : '' : ''
} }
}; };

View file

@ -203,7 +203,7 @@
&&-card > &-bar &-nav-wrap { &&-card > &-bar &-nav-wrap {
margin-bottom: 0; margin-bottom: 0;
} }
&&-card > &-bar &-tab .@{css-prefix-iconfont}-ios-close { &&-card > &-bar &-tab &-close {
width: 0; width: 0;
height: 22px; height: 22px;
font-size: 22px; font-size: 22px;
@ -221,8 +221,8 @@
} }
} }
&&-card > &-bar &-tab-active .@{css-prefix-iconfont}-ios-close, &&-card > &-bar &-tab-active &-close,
&&-card > &-bar &-tab:hover .@{css-prefix-iconfont}-ios-close { &&-card > &-bar &-tab:hover &-close {
width: 22px; width: 22px;
transform: translateZ(0); transform: translateZ(0);
margin-right: -6px; margin-right: -6px;