Vue-router: how can i add `class` and `target` to the router link ?

Created on 28 Sep 2016  ·  1Comment  ·  Source: vuejs/vue-router

in vue-router@1, i can do this <a class="xxx" target="_blank">dfdfds</a>,

but in docs, i find <router-link> has not props about this.

Most helpful comment

Hello @ccqgithub,

Thank your for your interest in this project.

However, your issue is a usage/support question, and the issue tracker is reserved exclusively for bug reports and feature requests. We encourage you to ask it on the forum or on gitter.


As with all components, all attributes you set on <router-link> that aren't props will be added to the root element (the geenrated <a> element).

<router-link to="/path" class="button">

The target property won't work though, because the generated <a> does not navigate via href="", it navigates with vue-router's Javascript.

to open a new window, use a regular link.

>All comments

Hello @ccqgithub,

Thank your for your interest in this project.

However, your issue is a usage/support question, and the issue tracker is reserved exclusively for bug reports and feature requests. We encourage you to ask it on the forum or on gitter.


As with all components, all attributes you set on <router-link> that aren't props will be added to the root element (the geenrated <a> element).

<router-link to="/path" class="button">

The target property won't work though, because the generated <a> does not navigate via href="", it navigates with vue-router's Javascript.

to open a new window, use a regular link.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rr326 picture rr326  ·  3Comments

mitar picture mitar  ·  3Comments

Lyfme picture Lyfme  ·  3Comments

thomas-alrek picture thomas-alrek  ·  3Comments

gil0mendes picture gil0mendes  ·  3Comments