Home > Net >  Disable highlight on q-item (Quasar Framework)
Disable highlight on q-item (Quasar Framework)

Time:10-08

When the current url is equal to :to="something" property, the q-item is highlighted in blue.

enter image description here

But I want q-item to keep black without highlighted in blue even though the current url is equal to the :to="something" property.

enter image description here

This is my q-item code (I use Quasar v2.0.4):

<q-item
  :to="{ name: 'home' }"
>
  <q-item-section avatar>
    <q-icon name="home" size="md" />
  </q-item-section>
  <q-item-section> 
    Home
  </q-item-section>
</q-item>

Is it possible to disable highlight on q-item?

CodePudding user response:

You can use the active-class property.

<style>
.remove-active{
}
</style>

<q-item active-class="remove-active"
          :to="'/'"
        >
          <q-item-section avatar>
            <q-icon name="home" size="md"/>
          </q-item-section>
          <q-item-section>
            Home
          </q-item-section>
        </q-item>

CodePudding user response:

You can use active-class="q-item-no-link-highlighting" to make q-item inactive keeping black:

<q-item
  active-class="q-item-no-link-highlighting" // Here
  :to="{ name: 'home' }"
>
  <q-item-section avatar>
    <q-icon name="home" size="md" />
  </q-item-section>
  <q-item-section> 
    Home
  </q-item-section>
</q-item>
  • Related