forked from cerc-io/cosmos-explorer
34 lines
989 B
Vue
34 lines
989 B
Vue
<script lang="ts" setup>
|
|
import { toBase64 } from '@cosmjs/encoding';
|
|
import type { PropType } from 'vue';
|
|
import { computed } from '@vue/reactivity';
|
|
import DynamicComponentVue from './DynamicComponent.vue';
|
|
import {select} from './index'
|
|
import ArrayBytesElement from './ArrayBytesElement.vue';
|
|
import ArrayObjectElement from './ArrayObjectElement.vue';
|
|
import TextElement from './TextElement.vue';
|
|
import ArrayCoinElement from './ArrayCoinElement.vue';
|
|
|
|
const props = defineProps({
|
|
value: { type: Array<Object>},
|
|
})
|
|
|
|
function selectByElement() {
|
|
if(props.value && props.value.length > 0) {
|
|
const [first] = props.value
|
|
switch(true) {
|
|
case first instanceof Uint8Array:
|
|
return ArrayBytesElement
|
|
case Object.keys(first).includes('denom'):
|
|
return ArrayCoinElement
|
|
default:
|
|
return ArrayObjectElement
|
|
}
|
|
}
|
|
return TextElement
|
|
}
|
|
|
|
</script>
|
|
<template>
|
|
<Component :is="selectByElement()" :value="props.value"></Component>
|
|
</template> |