Vue Concatenate variable and text

November 18, 2020

You can see the following example for cocatenating

<div class="wrapper"  v-bind:key="index" v-for="(obj, index) in phones">
    <input :id="'id_'+index" name="a11y-issues" v-model="seleted_phone" type="radio" :value="obj.id" />
</div>

This is how you do it

:id="'id_'+index"

You can’t use curly bracket (moustache tags) in attributes.

See how src of the image has been concatenated with variable and text

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