[Vuejs]-Adding vue.js to attribute src

0👍

Vue’s syntax is unlike React’s where you use {object.url} a lot.
In Vue, this is like this directly

<img :src="object.url" />

0👍

In a Vue template, a colon : prefixing an html attribute is a shorthand for v-bind. This allows you to use variables, computed etc. as attribute value instead of static values.

What you are trying is a react way which replace quotes around the attribute value with curly braces. But in Vue you can directly bind the variables without using curly braces.

Hence, It should be :

<img :src="object.url"/>

Leave a comment