feat(Switch): add click event (#4915)

This commit is contained in:
neverland
2019-11-04 17:58:20 +08:00
committed by GitHub
parent a19d3cc5c0
commit 577174c7f8
5 changed files with 62 additions and 77 deletions
+3 -1
View File
@@ -40,7 +40,9 @@ function Switch(
const loadingColor = checked ? activeColor || BLUE : inactiveColor || GRAY_DARK;
function onClick() {
function onClick(event: PointerEvent) {
emit(ctx, 'click', event);
if (!disabled && !loading) {
const newValue = checked ? inactiveValue : activeValue;
emit(ctx, 'input', newValue);