Checkbox add size prop

This commit is contained in:
梁灏 2017-08-24 17:25:21 +08:00
parent 3485243a4d
commit 77f1cc2e34
5 changed files with 99 additions and 7 deletions

View file

@ -27,7 +27,7 @@
},
size: {
validator (value) {
return oneOf(value, ['small', 'large']);
return oneOf(value, ['small', 'large', 'default']);
}
},
loading: Boolean,

View file

@ -4,7 +4,7 @@
</div>
</template>
<script>
import { findComponentsDownward } from '../../utils/assist';
import { findComponentsDownward, oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
const prefixCls = 'ivu-checkbox-group';
@ -17,6 +17,11 @@
default () {
return [];
}
},
size: {
validator (value) {
return oneOf(value, ['small', 'large', 'default']);
}
}
},
data () {
@ -27,7 +32,12 @@
},
computed: {
classes () {
return `${prefixCls}`;
return [
`${prefixCls}`,
{
[`ivu-checkbox-${this.size}`]: !!this.size
}
];
}
},
mounted () {

View file

@ -22,7 +22,7 @@
</label>
</template>
<script>
import { findComponentUpward } from '../../utils/assist';
import { findComponentUpward, oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
const prefixCls = 'ivu-checkbox';
@ -53,6 +53,11 @@
indeterminate: {
type: Boolean,
default: false
},
size: {
validator (value) {
return oneOf(value, ['small', 'large', 'default']);
}
}
},
data () {
@ -71,7 +76,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
}
];
},