Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vue - Interpolation inside attributes

I have following error:

src="/images/{{ this.phCode }}/{{ this.galCode }}/thumb/thumb_{{ this.fileName }}": 
Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. 
For example, instead of <div id="{{ val }}">, use <div :id="val">.

While the example is very clear, I am having difficulties to understand how to do it for my situation, where I have more than one variable in the attribute.

like image 647
sharkyenergy Avatar asked Apr 24 '20 19:04

sharkyenergy


1 Answers

You can use template literals as follows:

:src="`/images/${this.phCode}/${this.galCode}/thumb/thumb_${this.fileName}`"
like image 72
Majed Badawi Avatar answered Sep 30 '22 23:09

Majed Badawi