Checkbox support Form's disabled

This commit is contained in:
梁灏 2019-09-16 21:21:41 +08:00
parent ac64ca753c
commit 75685898a5

View file

@ -6,7 +6,7 @@
v-if="group"
type="checkbox"
:class="inputClasses"
:disabled="disabled"
:disabled="itemDisabled"
:value="label"
v-model="model"
:name="name"
@ -17,7 +17,7 @@
v-else
type="checkbox"
:class="inputClasses"
:disabled="disabled"
:disabled="itemDisabled"
:checked="currentValue"
:name="name"
@change="change"
@ -30,12 +30,13 @@
<script>
import { findComponentUpward, oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
import mixinsForm from '../../mixins/form';
const prefixCls = 'ivu-checkbox';
export default {
name: 'Checkbox',
mixins: [ Emitter ],
mixins: [ Emitter, mixinsForm ],
props: {
disabled: {
type: Boolean,
@ -94,7 +95,7 @@
{
[`${prefixCls}-group-item`]: this.group,
[`${prefixCls}-wrapper-checked`]: this.currentValue,
[`${prefixCls}-wrapper-disabled`]: this.disabled,
[`${prefixCls}-wrapper-disabled`]: this.itemDisabled,
[`${prefixCls}-${this.size}`]: !!this.size,
[`${prefixCls}-border`]: this.border
}
@ -105,7 +106,7 @@
`${prefixCls}`,
{
[`${prefixCls}-checked`]: this.currentValue,
[`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-disabled`]: this.itemDisabled,
[`${prefixCls}-indeterminate`]: this.indeterminate
}
];
@ -137,7 +138,7 @@
},
methods: {
change (event) {
if (this.disabled) {
if (this.itemDisabled) {
return false;
}