5 글 보임 - 1 에서 5 까지 (총 5 중에서)
-
글쓴이글
-
2023년 6월 24일 14:21 #88230
차지은참가자App.vue
<template> <div> <div class="menu"> {{ menu }} </div>
<ModalDetail :onerooms="onerooms" :clickModal="clickModal" :modalOpen="modalOpen" /> <DiscountHtml />
<div v-for="(oneroom, i) in oneroooms" :key="i">
<h4 @click=" modalOpen = true; clickModal = i; " > {{ oneroooms[i].title }} </h4> <p>{{ oneroooms[i].price }} 원</p> <p>{{ oneroooms[i].content }}</p> </div> </div> </template>
<script> import data from "./assets/oneroom.js"; import DiscountHtml from "./DiscountHtml.vue"; import ModalDetail from "./ModalDetail.vue";
export default { name: "App", data() { return { report: [0, 0, 0], menus: ["Home", "Shop", "About"], products: ["역삼동원룸", "천호동원룸", "마포구원룸"], prices: [50, 70, 80], modalOpen: false, clickModal:0, oneroooms: data, }; },
methods: { increase1() { this.report[0]++; }, increase2() { this.report[1]++; }, increase3() { this.report[2]++; }, }, components: { DiscountHtml: DiscountHtml, ModalDetail: ModalDetail, }, }; </script>
<style> #app { font-family: Avenir, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; }
.discount { background: #eee; padding: 10px; margin: 10px; border-radius: 5px; }
.menu { background: darkslateblue; padding: 15px; border-radius: 5px; } .menu a { color: white; padding: 10px; }
.room-img { width: 50%; margin-top: 40px; }
/* modal */
body { margin: 0; } div { box-sizing: border-box; }
.black-bg { width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); position: fixed; padding: 20px; }
.white-bg { width: 100%; background: white; border-radius: 8px; padding: 20px; } </style>
====== ModalDetail.vue
<template> <div> <div class="black-bg" v-if="modalOpen == true"> <div class="white-bg">
<h4>{{ oneroooms[clickModal].title }}</h4> <p>{{ oneroooms[clickModal].price }}</p> <p>{{ oneroooms[clickModal].content }}</p> <!-- <button @click="modalOpen = false">닫기</button> --> </div> </div> </div> </template>
<script> export default { name: "ModalDetail", props: { onerooms: Array, clickModal: Number, modalOpen: Boolean, }, }; </script>
<style></style>
==== ERROR MESSAGE
-
글쓴이글
5 글 보임 - 1 에서 5 까지 (총 5 중에서)
- 답변은 로그인 후 가능합니다.