April 2017
Intermediate to advanced
454 pages
12h 51m
English
The astute reader will certainly find what can be interpreted as a bug--we added a couple of CSS styles before running the application. The .router-link-active class is automatically injected in the <router-link> component whenever the page corresponds to the link actually pointed to.
When we click on Menu and Bar, the background color changes but it seems that it remains stuck to be selected for the Home link. This is because the matching performed by the <router-link> component is not exact. In other words, /bar and /menu contain the / string and, for this reason, / is always matched.
A quick fix for this is to add the attribute exactly the same as the first <router-link>:
<li><router-link to="/" exact>Home</router-link></li> ...
Read now
Unlock full access