cosmos-explorer/src/views/WalletTransactions.vue

63 lines
1.3 KiB
Vue
Raw Normal View History

2021-12-13 09:15:36 +00:00
<template>
<div>
<b-table
2021-12-22 07:43:07 +00:00
:items="history"
:fields="fields"
2021-12-13 09:15:36 +00:00
stacked="sm"
>
2021-12-22 07:43:07 +00:00
<template #cell(chain)="data">
<b-avatar
2021-12-13 09:15:36 +00:00
size="sm"
2021-12-22 07:43:07 +00:00
:src="data.item.chain.logo"
/> {{ data.item.chain.chain_name }}
</template>
<template #cell(hash)="data">
<router-link :to="`/${data.item.chain.chain_name}/tx/${data.value}`">
{{ data.value }}
</router-link>
2021-12-13 09:15:36 +00:00
</template>
</b-table>
2021-12-22 07:43:07 +00:00
<div class="text-center">
<b-button @click="clear()">
Clear History
</b-button>
</div>
2021-12-13 09:15:36 +00:00
</div>
</template>
<script>
import {
2021-12-22 07:43:07 +00:00
VBTooltip, BTable, BAvatar, BButton,
2021-12-13 09:15:36 +00:00
} from 'bootstrap-vue'
2021-12-22 07:43:07 +00:00
import { getLocalTxHistory } from '@/libs/utils'
2021-12-13 09:15:36 +00:00
export default {
components: {
2021-12-22 07:43:07 +00:00
BTable, BAvatar, BButton,
2021-12-13 09:15:36 +00:00
},
directives: {
'b-tooltip': VBTooltip,
},
2021-12-22 07:43:07 +00:00
data() {
return {
fields: [
{ key: 'chain', label: 'BLOCKCHAIN' },
{ key: 'op', label: 'ACTION' },
{ key: 'hash', label: 'TX HASH' },
{ key: 'time', label: 'TIME' },
],
history: [],
}
},
2021-12-22 06:21:23 +00:00
created() {
2021-12-22 07:43:07 +00:00
this.history = getLocalTxHistory()
},
methods: {
clear() {
this.history = []
localStorage.setItem('txHistory', [])
},
2021-12-22 06:21:23 +00:00
},
2021-12-13 09:15:36 +00:00
}
</script>