1
How to add an effect dropdown
to this vertical menu, so that when placing the mouse on top it opens the ul
daughter if she exists.
I thought I’d do it with v-if
by clicking on li
Dad, but I don’t know how to do this without instantiating a object data
for each section... is there a more suitable alternative? follows the code.
new Vue({
el : '#app',
data : {
modal : {
estilos : {
filhos : {
padding : {
metodo : 'outer'
},
margin : {
metodo : 'outer'
}
}
},
containeres : {
filhos : {
div : {
filhos : {
example : {
metodo : 'outer'
}
}
},
header : {
metodo : 'outer'
}
}
}
}
},
methods : {
teste (item) {
if(this[item]) this[item]();
else console.warn('metodo inexistente')
},
outer () {
alert('outer');
}
}
})
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<div id="app">
<ul v-for="(item, key) in modal">
<li>
{{key}}
</li>
<ul v-for="(item2, key2) in item.filhos">
<li @click="teste(item2.metodo)">
{{key2}}
</li>
<ul v-for="(item3, key3) in item2.filhos">
<li @click="teste(item3.metodo)">
{{key3}}
</li>
</ul>
</ul>
</ul>
</div>
There are several alternatives, besides components already created, you can use the
mouseover
to do this by hovering the mouse.– Rafael Augusto
Why not use an existing component?
– Rafael Augusto
In fact my application is very specific, I can not find anything done that suits the requirements :/
– Felipe Duarte