V
V
VegasChickiChicki2019-08-19 05:55:10
Vue.js
VegasChickiChicki, 2019-08-19 05:55:10

How to pass parameter from data to active-class?

I use Nuxt and it became necessary to transfer to

<nuxt-link  active-class="active" to="/">some link</nuxt-link>

Parameter from data, I can't figure out how to do it.
Or perhaps there are other options based on the current path to change the class?
That is, if we are on the /a path, we have active-class="a" , and if we are on the /b path, then we have active-class="b", something like that.
I also read somewhere that there is a possibility that the path does not fully match, that is, that the class would not fall down if we are on the /a path and if we are on the /a/b/etc path.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cyril, 2019-08-19
@belyaevcyrill

You can do it through the Router , and in the components you can set the class change, for example, through the global data . And the class itself can be dynamically changed through :class .
If you use Vuex, then through getting the state

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question