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
- mariadb
- partitioning
- 개발자
- SSE
- Node.js기본
- PostgreSQL
- 파티셔닝
- ServerSentEvent
- 성장기
- node.js란
- localStorage
- 열공하자
- Partition
- Lag
- frontend
- 실시간알림
- node.js
- EventSource
Archives
- Today
- Total
써치킴의 우당탕탕 개발 블로그
[Vue.js][Ch4][영화검색 사이트] Search - 버튼 본문
OMDb API
구글에 omdb api 검색 > https://www.omdbapi.com/ 이동 > Usage 요청주소 확인
http://www.omdbapi.com/?apikey=[yourkey]&
HTTP 요청할 수 있게 패키지 설치
npm i axios
영화 검색을 실행하는 버튼 추가
<button
class="btn btn-primary"
@click="apply">
Apply
</button>
- 버튼 선택하면 Apply 메서드 실행
영화 검색 데이터를 받아오는 메서드 작성
methods: {
async apply() { // 비동기 영화 검색 메소드
const OMDB_API_KEY = '7035c60c';
// https로 요청
// await : 처리된 결과가 나올때까지 기다리기 위해 사용
const res = await axios.get(`https://www.omdbapi.com/?apikey=${OMDB_API_KEY}&s=${this.title}&type=${this.type}&y=${this.year}&page=1`); // 보간법 사용
console.log(res);
}
}
출력
'완벽하게 Vue.js' 카테고리의 다른 글
[Vue.js][Ch4][영화검색 사이트] Vuex(Store) 구성 (0) | 2022.04.22 |
---|---|
[Vue.js][Ch4][영화검색 사이트] Vuex(Store) 개요 (0) | 2022.04.22 |
[Vue.js][Ch4][영화검색 사이트] Search - 필터 (0) | 2022.04.22 |
[Vue.js][Ch4][영화검색 사이트] Headline (0) | 2022.04.21 |
[Vue.js][Ch4][영화검색 사이트] Header - Logo 및 Google Fonts (0) | 2022.04.21 |
Comments