Switch add loading prop

This commit is contained in:
梁灏 2018-06-22 10:14:13 +08:00
parent ac2f8493b1
commit eb7f31db00
3 changed files with 65 additions and 9 deletions

View file

@ -45,6 +45,10 @@
},
name: {
type: String
},
loading: {
type: Boolean,
default: false
}
},
data () {
@ -59,7 +63,8 @@
{
[`${prefixCls}-checked`]: this.currentValue === this.trueValue,
[`${prefixCls}-disabled`]: this.disabled,
[`${prefixCls}-${this.size}`]: !!this.size
[`${prefixCls}-${this.size}`]: !!this.size,
[`${prefixCls}-loading`]: this.loading,
}
];
},
@ -70,7 +75,7 @@
methods: {
toggle (event) {
event.preventDefault();
if (this.disabled) {
if (this.disabled || this.loading) {
return false;
}