I am learning vueJS and have 2 clickable divs that share the same method. So when I click one of the divs the action happens for both of them.
What is the best way to action an @click on a div (This div) the one that is being clicked.
So I'm trying to open and close a menu only on the one (div) that is being clicked.
<div class="row">
<div class="col-sm-3">
<div class="mainbox-wrapper">
<div class="mainbox">text</div>
<div class="selectbox" @click="actionMenu" id="foo" ref="foo">select box</div>
<div class="menu" v-show="isShow">select box</div>
</div>
</div>
<div class="col-sm-3">
<div class="mainbox-wrapper">
<div class="mainbox">text</div>
<div class="selectbox" @click="actionMenu" id="bar" ref="bar">select box</div>
<div class="menu" v-show="isShow">select box</div>
</div>
</div>
</div>
js
methods:{
actionMenu(event){
let targetId = event.currentTarget.id;
this.isShow = !this.isShow;
}
}