Imagine you want to implement events something like:
<Modal @ok.prevent="doNothing">
Modal Code
</Modal>
That is when ok button of the modal is clicked, you want to prevent the event. In that case the prevent modifier can be implemented by code given below:
okButtonClickedMethod(e) {
//First emit the ok event, then check if it is prevented or not
emit('ok', e);
//then hides modal
if (e.defaultPrevented) {
//emitted event is prevented now
}
}
**** Happy Coding ***
Top comments (0)