How to pass a value from Vue data to href? How to pass a value from Vue data to href? vue.js vue.js

How to pass a value from Vue data to href?


You need to use v-bind: or its alias :. For example,

<a v-bind:href="'/job/'+ r.id">

or

<a :href="'/job/' + r.id">


Or you can do that with ES6 template literal:

<a :href="`/job/${r.id}`"


If you want to display links coming from your state or store in Vue 2.0, you can do like this:

<a v-bind:href="''"> {{ url_link }}</a>