Skip to content
Advertisement

Display images with VueJS and Laravel

I am trying to display images with VueJS, but it either prints {{ activity.image }} or shows a compilation error. These are the attempts:

JavaScript

How do I do it?

Advertisement

Answer

I assume activity.image is coming from the JavaScript, since you’re using the dot notation.

You can use v-bind:src="activity.image", yes, without the mustache.

or if it came from PHP, you should be using the -> operator.

v-bind:src="{{ $activity->image }}", you need those mustache for the Blade rendering, however you don’t need the mustache for the Vue.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement