Sometimes, we want to pass a value from Vue.js data to href.
In this article, we’ll look at how to pass a value from Vue.js data to href.
How to pass a value from Vue.js data to href?
To pass a value from Vue.js data to href, we can use template string literals.
For instance, we write
<template>
<div><a :href="`/job/${r.id}`"</div>
</template>
to set the href
prop to /job/${r.id}
where r
is a reactive property.
Conclusion
To pass a value from Vue.js data to href, we can use template string literals.