diff --git a/src/qComponents/QCheckbox/src/QCheckbox.vue b/src/qComponents/QCheckbox/src/QCheckbox.vue index 8da394d5..3043ff6b 100644 --- a/src/qComponents/QCheckbox/src/QCheckbox.vue +++ b/src/qComponents/QCheckbox/src/QCheckbox.vue @@ -98,7 +98,11 @@ export default defineComponent({ /** * alias for update:modelValue */ - 'change' + 'change', + /** + * triggers when click + */ + 'click' ], setup(props: QCheckboxProps, ctx): QCheckboxInstance { @@ -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; @@ -162,6 +166,8 @@ export default defineComponent({ qCheckboxGroup.update(Array.from(set)); } + + ctx.emit('click', event); }; watch( diff --git a/src/qComponents/QCheckbox/src/types.ts b/src/qComponents/QCheckbox/src/types.ts index 132b1c60..7fe769f2 100644 --- a/src/qComponents/QCheckbox/src/types.ts +++ b/src/qComponents/QCheckbox/src/types.ts @@ -17,6 +17,6 @@ export interface QCheckboxInstance { isLimitDisabled: ComputedRef; isDisabled: ComputedRef; nativeClick: () => void; - handleCheckboxClick: () => void; + handleCheckboxClick: (event: Event) => void; checkboxInput: Ref>; } diff --git a/src/qComponents/QTable/src/QTableCellCheckbox/QTableCellCheckbox.vue b/src/qComponents/QTable/src/QTableCellCheckbox/QTableCellCheckbox.vue index d247561e..e593e86e 100644 --- a/src/qComponents/QTable/src/QTableCellCheckbox/QTableCellCheckbox.vue +++ b/src/qComponents/QTable/src/QTableCellCheckbox/QTableCellCheckbox.vue @@ -89,7 +89,8 @@ export default defineComponent({ modelValue: props.checked, indeterminate: props.indeterminate, validateEvent: false, - onChange: handleCheckboxChange + onChange: handleCheckboxChange, + onClick: (event: Event) => event.stopPropagation() }); });