Tag add new prop size

This commit is contained in:
梁灏 2019-09-16 17:32:52 +08:00
parent 04f5779c02
commit 8a8a1b4c40
3 changed files with 26 additions and 4 deletions

View file

@ -1,5 +1,5 @@
<template>
<div>
<div style="margin: 200px 0;">
<div>
<Tag color="default">default</Tag>
<Tag color="primary">primary</Tag>
@ -71,6 +71,10 @@
<span>{{ checked }}</span>
<br><br>
<Tag type="dot" color="gold">标签四</Tag>
<Divider>Size</Divider>
<Tag color="primary" size="large">大号标签</Tag>
<Tag color="primary" size="medium">中号标签</Tag>
<Tag color="primary">默认尺寸</Tag>
</div>
</template>
<script>

View file

@ -50,6 +50,13 @@
fade: {
type: Boolean,
default: true
},
// 4.0.0
size: {
validator (value) {
return oneOf(value, ['default', 'medium', 'large']);
},
default: 'default'
}
},
data () {
@ -61,6 +68,7 @@
classes () {
return [
`${prefixCls}`,
`${prefixCls}-size-${this.size}`,
{
[`${prefixCls}-${this.color}`]: !!this.color && oneOf(this.color, initColorList),
[`${prefixCls}-${this.type}`]: !!this.type,
@ -144,4 +152,4 @@
}
}
};
</script>
</script>

View file

@ -14,9 +14,19 @@
vertical-align: middle;
opacity: 1;
overflow: hidden;
cursor: pointer;
//transition: all @transition-time @ease-in-out;
&-size-large{
height: 32px;
line-height: 32px;
padding: 0 12px;
}
&-size-medium{
height: 28px;
line-height: 28px;
padding: 0 10px;
}
// for color and unchecked
&:not(&-border):not(&-dot):not(&-checked){
background: transparent;
@ -251,4 +261,4 @@
}
.make-color-classes();
}
}