Tag add type props,and optimize style
Tag add type props,and optimize style
This commit is contained in:
parent
a901da64ed
commit
382c000c8f
8 changed files with 146 additions and 17 deletions
|
@ -1,7 +1,6 @@
|
|||
<template>
|
||||
<div v-if="!closed" :class="classes" transition="fade">
|
||||
<span :class="textClasses"><slot></slot></span>
|
||||
<Icon v-if="closable" type="ios-close-empty" @click="close"></Icon>
|
||||
<span :class="dotClasses" v-if="showDot"></span><span :class="textClasses"><slot></slot></span><Icon v-if="closable" type="ios-close-empty" @click="close"></Icon>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -21,6 +20,11 @@
|
|||
validator (value) {
|
||||
return oneOf(value, ['blue', 'green', 'red', 'yellow']);
|
||||
}
|
||||
},
|
||||
type: {
|
||||
validator (value) {
|
||||
return oneOf(value, ['border', 'dot']);
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -33,12 +37,20 @@
|
|||
return [
|
||||
`${prefixCls}`,
|
||||
{
|
||||
[`${prefixCls}-${this.color}`]: !!this.color
|
||||
[`${prefixCls}-${this.color}`]: !!this.color,
|
||||
[`${prefixCls}-${this.type}`]: !!this.type,
|
||||
[`${prefixCls}-closable`]: this.closable
|
||||
}
|
||||
]
|
||||
},
|
||||
textClasses () {
|
||||
return `${prefixCls}-text`;
|
||||
},
|
||||
dotClasses () {
|
||||
return `${prefixCls}-dot-inner`;
|
||||
},
|
||||
showDot () {
|
||||
return !!this.type && this.type === 'dot';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
line-height: 22px;
|
||||
margin: 2px 4px 2px 0;
|
||||
padding: 0 8px;
|
||||
border-radius: @btn-border-radius-small;
|
||||
border: 1px solid @border-color-split;
|
||||
border-radius: @btn-border-radius-small;
|
||||
background: @background-color-base;
|
||||
font-size: @tag-font-size;
|
||||
vertical-align: middle;
|
||||
|
@ -17,6 +17,77 @@
|
|||
cursor: pointer;
|
||||
//.transition(all @transition-time @ease-in-out);
|
||||
|
||||
&-dot{
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
border: 1px solid @border-color-split !important;
|
||||
color: @text-color !important;
|
||||
background: #fff !important;
|
||||
padding: 0 12px;
|
||||
|
||||
&-inner{
|
||||
display: inline-block;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 8px;
|
||||
border-radius: 50%;
|
||||
background: @border-color-split;
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
.@{tag-close-prefix-cls} {
|
||||
color: #666 !important;
|
||||
margin-left: 12px !important;
|
||||
}
|
||||
}
|
||||
|
||||
&-border{
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
border: 1px solid @border-color-split !important;
|
||||
color: @text-color !important;
|
||||
background: #fff !important;
|
||||
position: relative;
|
||||
|
||||
.@{tag-close-prefix-cls} {
|
||||
color: #666 !important;
|
||||
margin-left: 12px !important;
|
||||
}
|
||||
|
||||
&:after{
|
||||
content: "";
|
||||
display: none;
|
||||
width: 1px;
|
||||
background: @border-color-split;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 22px;
|
||||
}
|
||||
|
||||
&.@{tag-prefix-cls}-closable {
|
||||
&:after{
|
||||
display: block;
|
||||
}
|
||||
.@{tag-close-prefix-cls} {
|
||||
margin-left: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.@{tag-prefix-cls}-blue {
|
||||
color: @link-color !important;
|
||||
}
|
||||
&.@{tag-prefix-cls}-green {
|
||||
color: @success-color !important;
|
||||
}
|
||||
&.@{tag-prefix-cls}-yellow {
|
||||
color: @warning-color !important;
|
||||
}
|
||||
&.@{tag-prefix-cls}-red {
|
||||
color: @error-color !important;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
@ -38,7 +109,7 @@
|
|||
.@{tag-close-prefix-cls} {
|
||||
.iconfont-size-under-12px(20px);
|
||||
cursor: pointer;
|
||||
margin-left: 3px;
|
||||
margin-left: 8px;
|
||||
color: #666;
|
||||
opacity: 0.66;
|
||||
position: relative;
|
||||
|
@ -64,25 +135,27 @@
|
|||
}
|
||||
}
|
||||
|
||||
&-blue {
|
||||
&-blue,
|
||||
&-blue&-dot &-dot-inner
|
||||
{
|
||||
background: @link-color;
|
||||
}
|
||||
|
||||
&-green {
|
||||
&-green,
|
||||
&-green&-dot &-dot-inner
|
||||
{
|
||||
background: @success-color;
|
||||
}
|
||||
|
||||
&-yellow {
|
||||
&-yellow,
|
||||
&-yellow&-dot &-dot-inner
|
||||
{
|
||||
background: @warning-color;
|
||||
}
|
||||
|
||||
&-red {
|
||||
&-red,
|
||||
&-red&-dot &-dot-inner
|
||||
{
|
||||
background: @error-color;
|
||||
}
|
||||
|
||||
&-close {
|
||||
width: 0 !important;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue