[Vuejs]-Click to toggle class

0👍

I don´t see a click handler in your Navigation?

<navigation @click="class1 = !class1" class="navigation" v-bind:class="{'class1': class1}">

This will for example toggle the class on click.

0👍

I figured out how to solve it, by using the following code:

<navigation id="mobile-toggle"
    v-bind:class="{ active: showMobileMenu }"
    v-on:click="showMobileMenu = !showMobileMenu">something
</navigation>

data: {
    showMobileMenu: false
},

Leave a comment