S
S
shasoft2021-02-15 11:03:51
Vue.js
shasoft, 2021-02-15 11:03:51

How to highlight only one menu item in vuetify?

This is how I display the menu:

<v-navigation-drawer v-model="drawer" app>
      <v-list dense>
        <v-list-item v-for="(item, i) in menu" :key="i" :to="item.path">
          <v-list-item-action>
            <v-icon>{{ item.icon }}</v-icon>
          </v-list-item-action>
          <v-list-item-content>
            <v-list-item-title>
              <router-link :to="item.path">{{ item.title }}</router-link>
            </v-list-item-title>
          </v-list-item-content>
        </v-list-item>
      </v-list>
    </v-navigation-drawer>

The problem is that it always highlights as the active first link
. Here are the path values:
  • /shasoft/core-ui/
  • /shasoft/core-ui/message
  • /shasoft/core-ui/test

This is how it is displayed (link /shasoft/core-ui/test is active)
uVi3kmQ.png

I don’t understand what needs to be done so that only the actual current link is highlighted?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SvinkaBacilka, 2021-02-15
@shasoft

Try adding the exact attribute like this:

<v-list-item
    v-for="(item, i) in menu"
    :key="i"
    :to="item.path"
    exact
>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question