To stop event propagation in functional components I have to include dirty piece of DOMEvent code in form of:
attrs: {
role: 'button',
alt: __('reset_to_default_value'),
title: __('reset_to_default_value'),
'onclick': 'event.stopPropagation()'
},
on: {
click: context.parent.resetValue
}
it would be really neat if we could use standard vue's event modifiers known from standard templates,
perhaps in form of (to keep the syntax similar to existing watch syntax):
on: {
click: {
stop:true,
prevent:true,
handler: context.parent.resetValue
}
}
it's up to the click function to control that:
on: {
click (event) {
event.stopPropagation()
context.parent.resetValue(event)
}
}
Adding those attrs will just do magically the same for you (if the feature was implemented)
Wow, just wow.
I was so trapped inside particular way of thinking about it I've missed the obvious solution, thank You @posva 👍
Most helpful comment
it's up to the click function to control that:
Adding those attrs will just do magically the same for you (if the feature was implemented)