Skip to content

Commit

Permalink
fix(QTable): add stopPropagation for checkbox (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilfrontend authored Jun 20, 2022
1 parent 128b840 commit da85128
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/qComponents/QCheckbox/src/QCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ export default defineComponent({
/**
* alias for update:modelValue
*/
'change'
'change',
/**
* triggers when click
*/
'click'
],
setup(props: QCheckboxProps, ctx): QCheckboxInstance {
Expand Down Expand Up @@ -141,7 +145,7 @@ export default defineComponent({
: props.disabled || (qForm?.disabled.value ?? false)
);
const handleCheckboxClick = (): void => {
const handleCheckboxClick = (event: Event): void => {
if (isDisabled.value) return;
const value = !isChecked.value;
Expand All @@ -162,6 +166,8 @@ export default defineComponent({
qCheckboxGroup.update(Array.from(set));
}
ctx.emit('click', event);
};
watch(
Expand Down
2 changes: 1 addition & 1 deletion src/qComponents/QCheckbox/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export interface QCheckboxInstance {
isLimitDisabled: ComputedRef<boolean>;
isDisabled: ComputedRef<boolean>;
nativeClick: () => void;
handleCheckboxClick: () => void;
handleCheckboxClick: (event: Event) => void;
checkboxInput: Ref<Nullable<HTMLInputElement>>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ export default defineComponent({
modelValue: props.checked,
indeterminate: props.indeterminate,
validateEvent: false,
onChange: handleCheckboxChange
onChange: handleCheckboxChange,
onClick: (event: Event) => event.stopPropagation()
});
});
Expand Down

0 comments on commit da85128

Please sign in to comment.