Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- SSE
- ServerSentEvent
- node.js
- mariadb
- frontend
- node.js란
- Node.js기본
- 개발자
- Partition
- 성장기
- 파티셔닝
- localStorage
- partitioning
- 열공하자
- Lag
- 실시간알림
- PostgreSQL
- EventSource
Archives
- Today
- Total
써치킴의 우당탕탕 개발 블로그
[Vue.js][Ch4][영화검색 사이트] 영화 상세 페이지 정리 본문
Movie.vue
<template>
<div class="container">
<template v-if="loading"> <!-- 로딩중이면 skeleton 출력 -->
<div class="skeletons">
<div class="skeleton poster"></div>
<div class="specs">
<div class="skeleton title"></div>
<div class="skeleton spec"></div>
<div class="skeleton plot"></div>
<div class="skeleton etc"></div>
<div class="skeleton etc"></div>
<div class="skeleton etc"></div>
</div>
</div>
<Loader
:size="3"
:zIndex="9"
fixed /> <!-- 정중앙에 로딩애니메이션 동작 -->
</template>
<div
v-else
class="movie-details"> <!-- 로딩중이지 않으면 상세정보 출력 -->
<div
:style="{ backgroundImage: `url(${theMovie.Poster})` }"
class="poster"></div>
<div class="specs">
<div class="title">
{{ theMovie.Title }}
</div>
<div class="labels">
<span>{{ theMovie.Released }}</span>
<span>{{ theMovie.Runtime }}</span>
<span>{{ theMovie.Country }}</span>
</div>
<div class="plot">
{{ theMovie.Plot }}
</div>
<div class="ratings">
<h3>Ratings</h3>
</div>
<div>
<h3>Actors</h3>
{{ theMovie.Actors }}
</div>
<div>
<h3>Director</h3>
{{ theMovie.Director }}
</div>
<div>
<h3>Production</h3>
{{ theMovie.Production }}
</div>
<div>
<h3>Genre</h3>
{{ theMovie.Genre }}
</div>
</div>
</div>
</div>
</template>
<script>
import Loader from '~/components/Loader'
export default {
components: {
Loader
},
computed: {
theMovie() {
return this.$store.state.movie.theMovie;
},
loading() {
return this.$store.state.movie.loading;
}
},
created() { // Movie 컴포넌트가 실행되면
console.log(this.$route); // 현재 페이지 주소 정보를 가져옴
this.$store.dispatch('movie/searchMovieWithId', {
// ex) movie/tt1234545
id: this.$route.params.id // 주소 부분의 파라미터에서 omdbID를 가져옴
});
}
}
</script>
<style lang="scss" scoped>
@import "~/scss/main"; /* 부트스트랩을 사용할 수 있게 import */
.container {
padding-top: 40px;
}
.skeletons {
display: flex;
.poster {
flex-shrink: 0; // 감소 너비를 사용하지 않겠다.
width: 500px;
height: 500px * 3 / 2;
margin-right: 70px;
}
.specs {
flex-grow: 1; // 증가 너비를 최대한 많이 사용하겠다.
}
.skeleton {
border-radius: 10px;
background-color: $gray-200;
&.title {
width: 80%;
height: 70px;
}
&.spec {
width: 60%;
height: 30px;
margin-top: 20px;
}
&.plot {
width: 100%;
height: 250px;
margin-top: 20px;
}
&.etc {
width: 50%;
height: 50px;
margin-top: 20px;
}
}
}
.movie-details {
display: flex;
color: $gray-600;
.poster {
width: 500px;
height: 500px * 3/2;
margin-right: 70px;
border-radius: 10px;
background-color: $gray-200;
background-size: cover;
background-position: center;
position: relative;
flex-shrink: 0;
}
.specs {
flex-grow: 1;
.title {
color: $black;
font-family: "Oswald", sans-serif;
font-size: 70px;
line-height: 1;
margin-bottom: 30px;
}
.labels {
color: $primary;
span {
&::after { // 가상요소 생성
content: "\00b7"; // 가운데점
margin: 0 6px;
}
&:last-child::after {
display: none;
}
}
}
.plot {
margin-top: 20px;
}
.ratings {
}
h3 {
margin: 24px 0 6px;
color: $black;
font-family: "Oswald", sans-serif;
font-size: 20px;
}
}
}
</style>
출력
'완벽하게 Vue.js' 카테고리의 다른 글
[Vue.js][Ch4][영화검색 사이트] 더 높은 해상도의 영화 포스터 가져오기 (0) | 2022.04.28 |
---|---|
[Vue.js][Ch4][영화검색 사이트] Rating 데이터 출력 (0) | 2022.04.28 |
[Vue.js][Ch4][영화검색 사이트] Loader (0) | 2022.04.25 |
[Vue.js][Ch4][영화검색 사이트] 스켈레톤 UI (0) | 2022.04.25 |
[Vue.js][Ch4][영화검색 사이트] 단일 영화 상세 정보 가져오기 (0) | 2022.04.25 |
Comments