I am struggling with events propagation. The task is to prevent clicking on anything alse, if the data is not saved. So, The left div contains a tree of options. After clicking on an item, a setting in the right div is showed. I want to warn the user, when he tries to click outside the settings div, that the data is not saved.
The code looks like this:
<div class="row">
<div class="col-sm-6">
<tree
:data="treeData">
.. some tree data
</tree>
</div>
<div class="col-sm-6">
<div class="treeOptionEdit" v-if="showEditBox" v-click-outside.stop="checkIfSaved">
... setting input fields
vue-outside-events
package is used to detect clicks outside div. It works fine. The problem is, that this code, doesn't do anything:
checkIfSaved : function (event, el)
{
event.stopPropagation();
event.preventDefault();
},
The click gets propagated to the parent anyway. If I put an event @click
to the parent, it is fired an all clicks.
Does stop propagation work only from parent to children?