Wrote a training Vue component with a template. The template used template literals and there was a problem with the substitution of the url address before the image. I tried different options, but I could not solve the problem.
How in my case to substitute the address to the image taken from the object?
<img src="{{comment.comment_image}}"/> let queryComments = [{ comment_id: 1, comment_image: '//loremflickr.com/100/100', comment_description: 'Looks great Julianne!', }, { comment_id: 2, comment_image: '//loremflickr.com/100/100', comment_description: 'I love the sea', }, { comment_id: 3, comment_image: '//loremflickr.com/100/100', comment_description: 'Where are you at?', } ]; Vue.component('template_comment', { props: ['comment'], template: `<li> <img src="{{comment.comment_image}}"/> <div>id: {{comment.comment_id}}</div> <div>Комментарий: {{comment.comment_description}}</div> </li>` }); new Vue({ el: '#comments', data: { comments: queryComments }, }); <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> <ul id="comments"> <template_comment v-for="comment in comments" v-bind:comment="comment"> </template_comment> </ul>
<img :src="comment.comment_image"/>- Bleser