From aae5520459d9b4a244fea9766c0fc4ff386ac1ec Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 29 Sep 2021 10:35:40 +0800 Subject: [PATCH] update --- src/types/block.d.ts | 10 ++++++ src/utils/filters.ts | 3 ++ src/views/Block/detail.vue | 74 +++++++++++++++++++++++++++++--------- 3 files changed, 71 insertions(+), 16 deletions(-) diff --git a/src/types/block.d.ts b/src/types/block.d.ts index 66431f1..c29dfc4 100644 --- a/src/types/block.d.ts +++ b/src/types/block.d.ts @@ -3,3 +3,13 @@ export declare type AssetType = { exec: string symbol: string } + +export declare type BlockOverview = { + height: number + hash: string + txCount: number + txHash: string + parentHash: string + blockTime: number + stateHash: string +} diff --git a/src/utils/filters.ts b/src/utils/filters.ts index 5bcae81..06a2ec0 100644 --- a/src/utils/filters.ts +++ b/src/utils/filters.ts @@ -3,6 +3,9 @@ import store from '@/store' export const filterHash = (str: string, num?: number): string => { const length = num || 16 + if (!str) { + return '' + } return str.substr(0, length) + '...' + str.substr(-4) } diff --git a/src/views/Block/detail.vue b/src/views/Block/detail.vue index 52f3f10..0d97b13 100644 --- a/src/views/Block/detail.vue +++ b/src/views/Block/detail.vue @@ -28,7 +28,14 @@
- {{ (info.height - 1) > 0 ? info.height - 1 : '无' }} + + + {{ info.height - 1 }} + + + + 无 +
@@ -45,15 +52,22 @@
- {{ (info.height + 1) > maxHeight ? '无' : (info.height + 1) }} + + + {{ next.height }} + + + + 无 +
@@ -99,36 +113,64 @@