update tag custom color
This commit is contained in:
parent
7d4b325be8
commit
78fc1e14f1
2 changed files with 19 additions and 28 deletions
|
@ -3,7 +3,7 @@
|
||||||
<div :class="classes" @click.stop="check" :style="wraperStyles">
|
<div :class="classes" @click.stop="check" :style="wraperStyles">
|
||||||
<span :class="dotClasses" v-if="showDot" :style="bgColorStyle"></span>
|
<span :class="dotClasses" v-if="showDot" :style="bgColorStyle"></span>
|
||||||
<span :class="textClasses" :style="textColorStyle"><slot></slot></span>
|
<span :class="textClasses" :style="textColorStyle"><slot></slot></span>
|
||||||
<Icon v-if="closable" type="ios-close-empty" :color="lineColor" @click.native.stop="close"></Icon>
|
<Icon v-if="closable" :class="iconClass" :color="lineColor" type="ios-close-empty" @click.native.stop="close"></Icon>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
@ -71,6 +71,15 @@
|
||||||
dotClasses () {
|
dotClasses () {
|
||||||
return `${prefixCls}-dot-inner`;
|
return `${prefixCls}-dot-inner`;
|
||||||
},
|
},
|
||||||
|
iconClass () {
|
||||||
|
if (this.type === 'dot') {
|
||||||
|
return '';
|
||||||
|
} else if (this.type === 'border') {
|
||||||
|
return `${prefixCls}-color-${this.color}`;
|
||||||
|
} else {
|
||||||
|
return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : '';
|
||||||
|
}
|
||||||
|
},
|
||||||
showDot () {
|
showDot () {
|
||||||
return !!this.type && this.type === 'dot';
|
return !!this.type && this.type === 'dot';
|
||||||
},
|
},
|
||||||
|
@ -78,31 +87,22 @@
|
||||||
if (this.type === 'dot') {
|
if (this.type === 'dot') {
|
||||||
return '';
|
return '';
|
||||||
} else if (this.type === 'border') {
|
} else if (this.type === 'border') {
|
||||||
return this.color !== undefined ? this.transferColor(this.color) : '';
|
return this.color !== undefined ? (oneOf(this.color, initColorList) ? '' : this.color) : '';
|
||||||
} else {
|
} else {
|
||||||
return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : '';
|
return this.color !== undefined ? (this.color === 'default' ? '' : 'rgb(255, 255, 255)') : '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
borderColor () {
|
dotColor () {
|
||||||
if (this.type === 'dot') {
|
return this.color !== undefined ? (oneOf(this.color, initColorList) ? '' : this.color) : '';
|
||||||
return '';
|
|
||||||
} else if (this.type === 'border') {
|
|
||||||
return this.color !== undefined ? this.transferColor(this.color) : '';
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
textColorStyle () {
|
textColorStyle () {
|
||||||
return oneOf(this.color, initColorList) ? {} : {color: this.lineColor};
|
return oneOf(this.color, initColorList) ? {} : {color: this.lineColor};
|
||||||
},
|
},
|
||||||
mainColor () {
|
|
||||||
return this.color !== undefined ? this.transferColor(this.color) : '';
|
|
||||||
},
|
|
||||||
bgColorStyle () {
|
bgColorStyle () {
|
||||||
return oneOf(this.color, initColorList) ? {} : {background: this.mainColor};
|
return oneOf(this.color, initColorList) ? {} : {background: this.dotColor};
|
||||||
},
|
},
|
||||||
defaultTypeColor () {
|
defaultTypeColor () {
|
||||||
return (this.type !== 'dot' && this.type !== 'border') ? (this.color !== undefined ? this.transferColor(this.color) : '') : '';
|
return (this.type !== 'dot' && this.type !== 'border') ? (this.color !== undefined ? (oneOf(this.color, initColorList) ? '' : this.color) : '') : '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -122,19 +122,6 @@
|
||||||
} else {
|
} else {
|
||||||
this.$emit('on-change', checked, this.name);
|
this.$emit('on-change', checked, this.name);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
transferColor (name) {
|
|
||||||
if (oneOf(name, initColorList)) {
|
|
||||||
switch (name) {
|
|
||||||
case 'red': return '#ed3f14';
|
|
||||||
case 'green': return '#19be6b';
|
|
||||||
case 'yellow': return '#ff9900';
|
|
||||||
case 'blue': return '#2d8cf0';
|
|
||||||
case 'default': return '';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,15 +30,19 @@
|
||||||
&-color{
|
&-color{
|
||||||
&-red{
|
&-red{
|
||||||
color: @error-color !important;
|
color: @error-color !important;
|
||||||
|
border-color: @error-color !important;
|
||||||
}
|
}
|
||||||
&-green{
|
&-green{
|
||||||
color: @success-color !important;
|
color: @success-color !important;
|
||||||
|
border-color: @success-color !important;
|
||||||
}
|
}
|
||||||
&-blue{
|
&-blue{
|
||||||
color: @link-color !important;
|
color: @link-color !important;
|
||||||
|
border-color: @link-color !important;
|
||||||
}
|
}
|
||||||
&-yellow{
|
&-yellow{
|
||||||
color: @warning-color !important;
|
color: @warning-color !important;
|
||||||
|
border-color: @warning-color !important;
|
||||||
}
|
}
|
||||||
&-white{
|
&-white{
|
||||||
color: rgb(255, 255, 255) !important;
|
color: rgb(255, 255, 255) !important;
|
||||||
|
|
Loading…
Add table
Reference in a new issue