How to pass a value from Vue data to href?

喜夏-厌秋 提交于 2019-11-27 18:13:57
asemahle

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}`"
Waqar Shahid

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>

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!