Radio add size prop

This commit is contained in:
梁灏 2017-08-24 17:50:30 +08:00
parent 77f1cc2e34
commit 4d54542083
5 changed files with 73 additions and 21 deletions

View file

@ -19,7 +19,7 @@
},
size: {
validator (value) {
return oneOf(value, ['small', 'large']);
return oneOf(value, ['small', 'large', 'default']);
}
},
type: {
@ -44,6 +44,7 @@
`${prefixCls}`,
{
[`${prefixCls}-${this.size}`]: !!this.size,
[`ivu-radio-${this.size}`]: !!this.size,
[`${prefixCls}-${this.type}`]: !!this.type,
[`${prefixCls}-vertical`]: this.vertical
}

View file

@ -12,7 +12,7 @@
</label>
</template>
<script>
import { findComponentUpward } from '../../utils/assist';
import { findComponentUpward, oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
const prefixCls = 'ivu-radio';
@ -39,6 +39,11 @@
disabled: {
type: Boolean,
default: false
},
size: {
validator (value) {
return oneOf(value, ['small', 'large', 'default']);
}
}
},
data () {
@ -55,7 +60,8 @@
{
[`${prefixCls}-group-item`]: this.group,
[`${prefixCls}-wrapper-checked`]: this.currentValue,
[`${prefixCls}-wrapper-disabled`]: this.disabled
[`${prefixCls}-wrapper-disabled`]: this.disabled,
[`${prefixCls}-${this.size}`]: !!this.size
}
];
},

View file

@ -73,6 +73,30 @@
transform: scale(0);
}
}
&-large{
font-size: @font-size-base;
& .@{radio-inner-prefix-cls}{
width: 16px;
height: 16px;
&:after{
width: 10px;
height: 10px;
}
}
&.@{radio-prefix-cls}-wrapper, & .@{radio-prefix-cls}-wrapper{
font-size: @font-size-base;
}
}
&-small{
& .@{radio-inner-prefix-cls}{
width: 12px;
height: 12px;
&:after{
width: 6px;
height: 6px;
}
}
}
&-input {
position: absolute;

View file

@ -49,7 +49,6 @@
}
}
&-large{
font-size: 16px;
& .@{checkbox-inner-prefix-cls} {
width: 16px;
height: 16px;