cr vc-switch
parent
b380b30e90
commit
e444ca1c7e
|
@ -42,14 +42,14 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setChecked(checked) {
|
setChecked(checked, e) {
|
||||||
if (this.disabled) {
|
if (this.disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!hasProp(this, 'checked')) {
|
if (!hasProp(this, 'checked')) {
|
||||||
this.stateChecked = checked;
|
this.stateChecked = checked;
|
||||||
}
|
}
|
||||||
this.$emit('change', checked);
|
this.$emit('change', checked, e);
|
||||||
},
|
},
|
||||||
handleClick(e) {
|
handleClick(e) {
|
||||||
const checked = !this.stateChecked;
|
const checked = !this.stateChecked;
|
||||||
|
@ -59,10 +59,10 @@ export default {
|
||||||
handleKeyDown(e) {
|
handleKeyDown(e) {
|
||||||
if (e.keyCode === 37) {
|
if (e.keyCode === 37) {
|
||||||
// Left
|
// Left
|
||||||
this.setChecked(false);
|
this.setChecked(false, e);
|
||||||
} else if (e.keyCode === 39) {
|
} else if (e.keyCode === 39) {
|
||||||
// Right
|
// Right
|
||||||
this.setChecked(true);
|
this.setChecked(true, e);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleMouseUp(e) {
|
handleMouseUp(e) {
|
||||||
|
|
Loading…
Reference in New Issue