Im currently working with vue.js and got into a problem.
My Boards.vue
<template>
<div class="boards_container">
<div class="board_element" :key="board.id" v-for="board in boards">
<img class="boardBanner" :src="board.image">
<h2>{{ board.name }}</h2>
<p>{{ board.rating }}</p>
<p>$ {{ board.price }}</p>
</div>
</div>
</template>
<script>
export default {
name: 'Boards',
props: {
boards: Array
},
data() {
}
}
</script>
The Body.vue where the Boards.vue is included:
<template>
<div>
<img :src="surfer_banner" alt="Surfer on the ocean">
<Boards :boards="boards" />
<h2>catch every wave</h2>
<img class="surfboardIcon" src="../assets/QUI_SurfboardIcon.svg" alt="SurfboardIcon">
</div>
</template>
<script>
import Button from './Button'
import Boards from './Boards'
export default {
name: 'Body',
props: {
title: {
type: String,
default: 'Quiver'
}
},
components: {
Button,
Boards,
},
data() {
},
created() {
this.boards = [
{
id: '0',
name: "The Special Recipe Fish",
rating: 4,
price: 995.00,
image: "/assets/board_1_image.jpeg",
},
{
id: '1',
name: "The Big Bueno Fish",
rating: 4,
price: 1050.00,
image: "https://cdn.shopify.com/s/files/1/0203/7640/products/BBF_Fish_web_1200x.jpg?v=1570360599",
}
]
}
}
keep in mid. The h2 and p tags are working. When I insert a online link into the image: element, the image is getting displayed.
To sum it up. These are working:
<img class="boardBanner" :src="../assets/board_1_image.jpg">
created() {
this.boards = [
{
id: '1',
name: "The Big Bueno Fish",
rating: 4,
price: 1050.00,
image: "https://cdn.shopify.com/s/files/1/0203/7640/products/BBF_Fish_web_1200x.jpg?v=1570360599",
}
]
}
with
<img class="boardBanner" :src="board.image">
I want to do this, but it is not working:
this.boards = [
{
id: '0',
name: "The Special Recipe Fish",
rating: 4,
price: 995.00,
image: "../assets/board_1_image.jpeg",
},
]
with
<img class="boardBanner" :src="board.image">
I tried different ideas already existing in this forum but nothing helped.