Switch support Form's disabled
This commit is contained in:
parent
75685898a5
commit
763f08da5a
1 changed files with 4 additions and 3 deletions
|
@ -16,12 +16,13 @@
|
||||||
<script>
|
<script>
|
||||||
import { oneOf } from '../../utils/assist';
|
import { oneOf } from '../../utils/assist';
|
||||||
import Emitter from '../../mixins/emitter';
|
import Emitter from '../../mixins/emitter';
|
||||||
|
import mixinsForm from '../../mixins/form';
|
||||||
|
|
||||||
const prefixCls = 'ivu-switch';
|
const prefixCls = 'ivu-switch';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'iSwitch',
|
name: 'iSwitch',
|
||||||
mixins: [ Emitter ],
|
mixins: [ Emitter, mixinsForm ],
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number, Boolean],
|
type: [String, Number, Boolean],
|
||||||
|
@ -73,7 +74,7 @@
|
||||||
`${prefixCls}`,
|
`${prefixCls}`,
|
||||||
{
|
{
|
||||||
[`${prefixCls}-checked`]: this.currentValue === this.trueValue,
|
[`${prefixCls}-checked`]: this.currentValue === this.trueValue,
|
||||||
[`${prefixCls}-disabled`]: this.disabled,
|
[`${prefixCls}-disabled`]: this.itemDisabled,
|
||||||
[`${prefixCls}-${this.size}`]: !!this.size,
|
[`${prefixCls}-${this.size}`]: !!this.size,
|
||||||
[`${prefixCls}-loading`]: this.loading,
|
[`${prefixCls}-loading`]: this.loading,
|
||||||
}
|
}
|
||||||
|
@ -107,7 +108,7 @@
|
||||||
},
|
},
|
||||||
toggle (event) {
|
toggle (event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
if (this.disabled || this.loading) {
|
if (this.itemDisabled || this.loading) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue