Creating a link in Vue
Any HTML is legal, so you can just write a regular link, but if you want to have a fast response, it is recommended that you include Vue Router. This brings two important tags: <router-link>, which this post is mainly about and <router-view>.
Creating a link in Vue is as simple as:
<router-link to="home">Home</router-link>
This renders a perfectly correct link, using the earlier mentioned a-tag. It even adds a nice bonus, adding an ‘active’ class when that route is active. If you prefer this class on the containing element, do this:
<router-link to="home" tag="li"><a>Home</a></router-link>
This will render something along the lines of:
<li><a href="home">Home</a></li>
Be aware: this is the only valid use-case for the tag-property in vue’s router-link component. Hence be wary if you come across any use of the tag-property, but Vue’s default is good.
You pick up o…