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