Fixed some issues

This commit is contained in:
liangping 2021-08-08 13:34:00 +08:00
parent b7cf79e1cc
commit eaac3b295a
4 changed files with 15 additions and 13 deletions

View File

@ -1,11 +1,20 @@
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import {
Bech32, fromBase64, fromHex, toHex,
} from '@cosmjs/encoding'
import { sha256 } from '@cosmjs/crypto'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime'
import localeData from 'dayjs/plugin/localeData'
dayjs.extend(duration)
dayjs.extend(relativeTime)
dayjs.extend(localeData)
export function toDuration(value) {
return dayjs.duration(value).humanize()
}
export function toDay(time, format = 'long') {
if (format === 'long') {

View File

@ -242,6 +242,7 @@ section {
.gov-wrapper .gov {
padding: .5rem;
margin: .3rem;
min-width: 8rem;
text-align: center;
background-color: #f8f8f8;
border-radius: .357rem;

View File

@ -15,7 +15,7 @@
Top 67% of Voting Power
</small>
<b-card-title>
<span>Validators<small> {{ validators.length }}/{{ stakingParameters.max_validators }}</small> </span>
<span>Validators {{ validators.length }}/{{ stakingParameters.max_validators }} </span>
</b-card-title>
</b-card-header>
<b-table

View File

@ -36,19 +36,11 @@
<script>
import { BRow, BCol } from 'bootstrap-vue'
import {
formatNumber, isToken, percent, tokenFormatter,
formatNumber, isToken, percent, toDuration, tokenFormatter,
} from '@/libs/data'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime'
import localeData from 'dayjs/plugin/localeData'
import SummaryParmetersComponent from './SummaryParmetersComponent.vue'
dayjs.extend(duration)
dayjs.extend(relativeTime)
dayjs.extend(localeData)
export default {
components: {
BRow,
@ -162,7 +154,7 @@ export default {
return { title: `${percent(d)}%`, subtitle: k }
}
if (d > 1000000000) {
return { title: `${dayjs.duration(d / 1000000).humanize()}`, subtitle: k }
return { title: `${toDuration(d / 1000000)}`, subtitle: k }
}
return { title: data[k], subtitle: k }
})