cr vc-switch

pull/1040/head
tangjinzhou 2019-06-30 20:43:46 +08:00
parent b380b30e90
commit e444ca1c7e
1 changed files with 4 additions and 4 deletions

View File

@ -42,14 +42,14 @@ export default {
});
},
methods: {
setChecked(checked) {
setChecked(checked, e) {
if (this.disabled) {
return;
}
if (!hasProp(this, 'checked')) {
this.stateChecked = checked;
}
this.$emit('change', checked);
this.$emit('change', checked, e);
},
handleClick(e) {
const checked = !this.stateChecked;
@ -59,10 +59,10 @@ export default {
handleKeyDown(e) {
if (e.keyCode === 37) {
// Left
this.setChecked(false);
this.setChecked(false, e);
} else if (e.keyCode === 39) {
// Right
this.setChecked(true);
this.setChecked(true, e);
}
},
handleMouseUp(e) {