Vue-프로젝트
vue-프로젝트 (13일차)
꾸준2
2020. 4. 22. 10:51
오늘 할일- 코인이름 클릭시 해당 코인 데이터로 차트 갱신- 현재 날씨 mainTitle 왼쪽에 vuex이용해서 넣기
- 코인이름 클릭시 해당 코인 데이터로 차트 갱신
drawChart(eng, kor) {
if(this.total != []) {
this.total = []
this.find = false
}
axios.get('https://api.upbit.com/v1/candles/minutes/60?market='+eng+'&count=70')
.then(res => {
this.coinName = kor
this.find = true
for(var i=0; i<res.data.length; i++){
this.total.push([res.data[i].candle_date_time_kst, res.data[i].opening_price, res.data[i].high_price, res.data[i].low_price, res.data[i].trade_price])
}
})
}, // drawChart 끝
- 조건문에서 코인데이터 값이 들어있을경우 빈배열로 초기화
- find변수를 false로 바꿔준다(그렇지 않으면 데이터값은 들어가지만 차트가 갱신이 안됌)