-
Vue 프로젝트 영화 아이템 - 기본 출력프로젝트/영화 검색 (Vue) 2021. 8. 6. 06:31
Vue 프로젝트 영화 아이템 - 기본 출력
1. /src/components/MovieItem.vue 수정
- 영화 포스터, 년도, 제목 출력
<template> <div :style="{ backgroundImage: `url(${movie.Poster})` }" class="movie"> <div class="info"> <div class="year"> {{ movie.Year }} </div> <div class="title"> {{ movie.Title }} </div> </div> </div> </template>
<script> export default { props: { movie: { type: Object, default: () => ({}) } } } </script>
<style lang="scss" scoped> @import "~/scss/main"; .movie { $width: 200px; width: $width; height: $width * 3 / 2; margin: 10px; background-repeat: 4px; background-color: $gray-400; background-size: cover; overflow: hidden; position: relative; .info { background-color: rgba($black, .3); width: 100%; padding: 14px; font-size: 14px; text-align: center; position: absolute; left: 0; bottom: 0; } } </style>
2. /src/components/MovieList.vue 수정
- MovieItem 수평 정렬
<template> <div class="container"> <div class="inner"> ... 생략 <div class="movies"> <MovieItem v-for="movie in movies" :key="movie.imdbID" :movie="movie" /> </div> </div> </div> </template>
<script> import MovieItem from '~/components/MovieItem' export default { components: { MovieItem }, computed: { ... 생략 } } </script>
<style lang="scss" scoped> .container { .movies { display: flex; flex-wrap: wrap; justify-content: center; } } </style>
결과
'프로젝트 > 영화 검색 (Vue)' 카테고리의 다른 글
Vue 프로젝트 Container 너비 사용자 지정 (0) 2021.08.07 Vue 프로젝트 영화 아이템 - 텍스트 말줄임 표시와 배경 흐림 처리 (0) 2021.08.06 Vue 프로젝트 영화 검색 코드 리팩토링 (0) 2021.08.06 Vue 프로젝트 영화 목록 ID 중복 제거 (0) 2021.08.03 Vue 프로젝트 영화 검색 추가 요청 (0) 2021.08.03