Vue Concatenate variable and text in attribute binding image src example

If you are looking to concatenate a variable and a text together while binding an HTML attribute (for example src of image attribute)

Here is how you can do it in Vue

<img v-bind:src="imgPreUrl + 'img/logo.png'">


Or the short version:


<img :src="imgPreUrl + 'img/logo.png'">

Related Articles

Leave a reply:

Your email address will not be published.

Site Footer