How to create a Vue.js logic to handle all tag elements with the same class selector?
I have this simple code: http://jsfiddle.net/x2spo1qu/
var dropdown = new Vue({
el: '.dropdown',
data: {
is_open : false
},
methods: {
onClick: function (event) {
// # toggle the dropdown open/closed state
// ---
this.is_open = ! this.is_open;
},
mouseLeave: function (event) {
// # set show of dropdown to false
// ----
this.is_open = false;
}
}
});
But it only works for the first dropdown in the HTML and does not work for the second.
Please explain me how to do this.
From vuejs.org :
you can achieve this using Vue component system follow this example :