Sometimes, we want to concatenate variable and text with Vue.js img src.
In this article, we’ll look at how to concatenate variable and text with Vue.js img src.
How to concatenate variable and text with Vue.js img src?
To concatenate variable and text with Vue.js img src, we can do the concatenation in the src prop.
For instance, we write
<template>
<img :src="imgPreUrl + 'img/logo.png'" />
</template>
to set the src prop of the img element to the imgPreUrl + 'img/logo.png', which concatenates imgPreUrl and 'img/logo.png' together.
Conclusion
To concatenate variable and text with Vue.js img src, we can do the concatenation in the src prop.