I just started learning vuejs and I'm trying to incorporate it in my laravel project but I'm running into a problem. I have an array of image paths inside my vue object like this:
new Vue({
el: '#app',
data: {
images: [
"img/image-1.png",
"img/image-2.png",
"img/image-3.png"
]
}
});
I would like to loop through all the images and display them inside my page using the Laravel asset() helper. I tried using it like this:
<img v-for="image in images" :src="{{ asset('image') }}">
But it doesn't recognize the vue directive:
[Vue warn]: Error compiling template:
invalid expression: Unexpected token ':' in
http://127.0.0.1:8000/image
Raw expression: :src="http://127.0.0.1:8000/image"
srcwithout ':':src="'{{ url()->to('/') }}/'+image"