Radio support Form's disabled

This commit is contained in:
梁灏 2019-09-16 21:18:39 +08:00
parent f7f276b419
commit ac64ca753c

View file

@ -5,7 +5,7 @@
<input <input
type="radio" type="radio"
:class="inputClasses" :class="inputClasses"
:disabled="disabled" :disabled="itemDisabled"
:checked="currentValue" :checked="currentValue"
:name="groupName" :name="groupName"
@change="change" @change="change"
@ -17,12 +17,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-radio'; const prefixCls = 'ivu-radio';
export default { export default {
name: 'Radio', name: 'Radio',
mixins: [ Emitter ], mixins: [ Emitter, mixinsForm ],
props: { props: {
value: { value: {
type: [String, Number, Boolean], type: [String, Number, Boolean],
@ -77,7 +78,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}-focus`]: this.focusWrapper, [`${prefixCls}-focus`]: this.focusWrapper,
[`${prefixCls}-border`]: this.border [`${prefixCls}-border`]: this.border
@ -89,7 +90,7 @@
`${prefixCls}`, `${prefixCls}`,
{ {
[`${prefixCls}-checked`]: this.currentValue, [`${prefixCls}-checked`]: this.currentValue,
[`${prefixCls}-disabled`]: this.disabled [`${prefixCls}-disabled`]: this.itemDisabled
} }
]; ];
}, },
@ -127,7 +128,7 @@
}, },
methods: { methods: {
change (event) { change (event) {
if (this.disabled) { if (this.itemDisabled) {
return false; return false;
} }