From cca8af5ffd6dcedcba6541da9b10547d41d785c4 Mon Sep 17 00:00:00 2001
From: liangping <18786721@qq.com>
Date: Sun, 25 Sep 2022 13:25:58 +0800
Subject: [PATCH] add empty ticker handler
---
.../components/dashboard/DashboardPriceChart2.vue | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/views/components/dashboard/DashboardPriceChart2.vue b/src/views/components/dashboard/DashboardPriceChart2.vue
index ab3502d5..aaa05483 100644
--- a/src/views/components/dashboard/DashboardPriceChart2.vue
+++ b/src/views/components/dashboard/DashboardPriceChart2.vue
@@ -74,9 +74,9 @@
$
- {{ selectedTicker.converted_last.usd }}
+ {{ selectedTicker.converted_last.usd || '-' }}
- / {{ selectedTicker.target }}
+ / {{ selectedTicker.target || 'USDC' }}
@@ -346,7 +346,7 @@ export default {
]
},
color() {
- return this.colorMap(this.selectedTicker.trust_score)
+ return this.colorMap(this.selectedTicker?.trust_score)
},
homepage() {
if (this.coinInfo.links) {
@@ -382,9 +382,11 @@ export default {
this.$http.getCoinInfo().then(res => {
if (res) {
this.coinInfo = res
- this.tickers = res.tickers
- // eslint-disable-next-line prefer-destructuring
- this.selectedTicker = this.tickers[0]
+ if (res.tickers.lenght > 0) {
+ this.tickers = res.tickers
+ // eslint-disable-next-line prefer-destructuring
+ this.selectedTicker = this.tickers[0]
+ }
}
})
},