I have an image with a dynamic (interpolated) src
attribute.
<img src="./{{bar}}.jpg"/>
How do I get vue-loader to interpolate {{bar}}
?
I have an image with a dynamic (interpolated) src
attribute.
<img src="./{{bar}}.jpg"/>
How do I get vue-loader to interpolate {{bar}}
?
In attribute interpolation is not allowed, use v-bind instead
https://vuejs.org/v2/guide/syntax.html#Attributes
I'm pretty sure that your code throws a warning (not referred it):
So, you should bind the value:
The above example it loads an image
xxx.jpg
from the static directoryassets
, but not via loader yet.To accomplish that, you should use a dynamic require: