A
A
Andrej Sharapov2019-07-16 09:51:27
JavaScript
Andrej Sharapov, 2019-07-16 09:51:27

How to make a drop down menu like this in Vue?

Good morning everybody!
Compiled such a menu in the vue component

but it was required for item three ( three ) to add a submenu. I moved the nesting to childred , but I don't understand how to rebuild the template and implement a click on the third item. I need your help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrej Sharapov, 2019-07-16
@Madeas

figured out

<ul>
        <li v-for="item in navList">
            <a :href="item.url" :class="item.cls" :title="item.name" @click="isOpen = !isOpen">{{ item.name }}
                <ul v-if="item.children" :class="{ isOpen }" class="dropdown">
                    <li v-for="{ url, name, index } in item.children" :key="index">
                        <a :href="url" :title="name">{{ name }}
                     </li>
                </ul>
             </a>
        </li>
    </ul>

S
shmatuan, 2019-07-16
@shmatuan

Better take a look here
https://vuejs.org/v2/examples/tree-view.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question