<template>
<div class="menu">
<a href="#none" v-for="(link, i) in menus" :key="i"> {{ link }} </a>
</div>
<img src="./assets/logo.png">
<div v-for="(local, i) in products" :key="i">
<img
:src="imgSrc" alt="">
<h4>{{ local }}</h4>
<p> {{ priceArray[i] }} 만원</p>
<button @click="increase(i)">허위매물신고</button> <span>신고수: {{ reportCount[i] }}</span>
</div>
</template>
<script>
export default {
name: 'App',
data(i){
return {
menus: ['HOME', 'SHOP', 'ABOUT'],
products: ['역삼동원룸', '천호동원룸', '마포구원룸'],
priceArray: [50, 70, 20],
reportCount: [0,0,0],
imgSrc: ./assets/room${i}.jpg
}
},
methods : {
increase(i) {
this.reportCount[i] += 1;
},
},
components: {
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
.menu {
background : darkslateblue;
padding : 15px;
border-radius : 5px;
}
.menu a {
color : white;
padding : 10px;
}
</style>
저는 이렇게 작성했는데 문법 에러는 나지 않지만
실서버에 하얀 화면만 뜨네요 ㅠㅠ
v-for문 안에서 img src를 동적으로 구현하고 싶은데 어떻게 해야 할까요 ㅠㅠ?
여러 방법을 찾아봣는데.. ㅠㅠ 잘 모르겠습니다.