improve tolorent for missing field in price

This commit is contained in:
liangping 2022-05-17 08:43:31 +08:00
parent fc39b57115
commit 4e7587a619

View File

@ -527,14 +527,14 @@ export default {
getPrice(denom) { getPrice(denom) {
const d2 = this.formatDenom(denom) const d2 = this.formatDenom(denom)
const quote = this.$store.state.chains.quotes[d2] const quote = this.$store.state.chains.quotes[d2]
return quote ? quote[this.currency2] : 0 return quote ? quote[this.currency2] || 0 : 0
}, },
getChanges(denom) { getChanges(denom) {
const d2 = this.formatDenom(denom) const d2 = this.formatDenom(denom)
const quote = this.$store.state.chains.quotes[d2] const quote = this.$store.state.chains.quotes[d2]
if (quote) { if (quote) {
const price = quote[`${this.currency2}_24h_change`] const price = quote[`${this.currency2}_24h_change`]
return price return price || 0
} }
return 0 return 0
}, },
@ -543,7 +543,7 @@ export default {
if (price > 0) { if (price > 0) {
return `+${parseFloat(price.toFixed(2))}%` return `+${parseFloat(price.toFixed(2))}%`
} }
return '' return '0'
}, },
formatPrice(denom) { formatPrice(denom) {
const d2 = this.formatDenom(denom) const d2 = this.formatDenom(denom)