JavaScript Add is-active class Bulma to router in Vue

I'm working on the router in Vue js. I display the current link in Navbar by adding style for router-link-active and exact property for each <router-link>. It's work fine.

But now I'm trying to use class is-active (Bulma CSS) to do it. How can I do that ?.

Code

<a class="navbar-item is-active">
      <router-link to="/" exact>Home</router-link>
    </a>
    <a class="navbar-item">
        <router-link to="/about" exact>About</router-link>
    </a>
    <a class="navbar-item">
        <router-link to="/information" exact>Information</router-link>
    </a>

Any logical and solutions ? Please help me.

Answer:1

You can specify the name of the active class in vue-router constructor by using the linkActiveClass option.

import Router from 'vue-router'

export default new Router({
 linkActiveClass: 'is-active',
 mode: 'history',
 routes: [ ... ]
})

This will add is-active class to the active router-link instead of router-link-active. Read the docs here: https://router.vuejs.org/en/api/options.html#linkactiveclass

Answer:2

If body is smaller than viewport, then the viewport size is returned. What I am trying to do is resize a picture so that the body fits inside the viewport. I want to have one of those nice "above the ...

If body is smaller than viewport, then the viewport size is returned. What I am trying to do is resize a picture so that the body fits inside the viewport. I want to have one of those nice "above the ...

I've been struggling with this for awhile and can't seem to find anyone else with the same issue. I've got this component and container which are my start screen which should be rendered at the ...

I've been struggling with this for awhile and can't seem to find anyone else with the same issue. I've got this component and container which are my start screen which should be rendered at the ...

  1. invalid prop component of type object supplied to route
  2. invalid prop component supplied to forwardref(buttonbase)
  3. invalid prop component supplied to connectedfield
  4. invalid prop component of type object
  5. invalid prop component supplied to indexroute
  6. invalid prop component supplied to
  7. invalid prop component supplied to field redux form
  8. invalid prop component
  9. invalid prop component of type function supplied to
  10. invalid prop component of type string supplied to route
  11. invalid prop component of type object supplied
  12. invalid prop textfield component supplied to datetextfield
  13. invalid value for prop component on a tag
  14. invalid value for prop component on div tag
  15. invalid value for prop component on input tag

Why would one need to use .constant(value) from lodash/fp/constant? I saw some other guys use _.constant(true) or _.constant(1) but don't really know what is the benefit of it. From what I know ....

Why would one need to use .constant(value) from lodash/fp/constant? I saw some other guys use _.constant(true) or _.constant(1) but don't really know what is the benefit of it. From what I know ....

I know that there are a lot of posts about that in web, but none of them satisfied me. Most of people recommends appending a verizon number to each script/css file. But this sound like a lot of job to ...

I know that there are a lot of posts about that in web, but none of them satisfied me. Most of people recommends appending a verizon number to each script/css file. But this sound like a lot of job to ...