add empty ticker handler

This commit is contained in:
liangping 2022-09-25 13:25:58 +08:00
parent 5107b2a5cd
commit cca8af5ffd

View File

@ -74,9 +74,9 @@
<small>$</small> <small>$</small>
</sup> </sup>
<h2 class="d-inline mr-25"> <h2 class="d-inline mr-25">
{{ selectedTicker.converted_last.usd }} {{ selectedTicker.converted_last.usd || '-' }}
</h2> </h2>
<sub class="text-body"><small>/ {{ selectedTicker.target }}</small></sub> <sub class="text-body"><small>/ {{ selectedTicker.target || 'USDC' }}</small></sub>
</div> </div>
</div> </div>
<!--/ buy --> <!--/ buy -->
@ -346,7 +346,7 @@ export default {
] ]
}, },
color() { color() {
return this.colorMap(this.selectedTicker.trust_score) return this.colorMap(this.selectedTicker?.trust_score)
}, },
homepage() { homepage() {
if (this.coinInfo.links) { if (this.coinInfo.links) {
@ -382,9 +382,11 @@ export default {
this.$http.getCoinInfo().then(res => { this.$http.getCoinInfo().then(res => {
if (res) { if (res) {
this.coinInfo = res this.coinInfo = res
this.tickers = res.tickers if (res.tickers.lenght > 0) {
// eslint-disable-next-line prefer-destructuring this.tickers = res.tickers
this.selectedTicker = this.tickers[0] // eslint-disable-next-line prefer-destructuring
this.selectedTicker = this.tickers[0]
}
} }
}) })
}, },