feat: DynamicComponent UI refactot

This commit is contained in:
Alisa | Side.one 2023-05-07 09:07:33 +08:00
parent 60767b499b
commit b1f3afba3e
4 changed files with 76 additions and 65 deletions

View File

@ -7,8 +7,8 @@ const props = defineProps({
</script> </script>
<template> <template>
<div> <div>
<div v-for="v in props.value"> <div v-for="(item,index) of props.value" :key="index">
{{ toBase64(v) }} {{ toBase64(item) }}
</div> </div>
</div> </div>
</template> </template>

View File

@ -18,6 +18,7 @@ const header = computed(() => {
}); });
</script> </script>
<template> <template>
<div class="overflow-x-auto">
<VTable <VTable
v-if="header.length > 0" v-if="header.length > 0"
density="compact" density="compact"
@ -46,4 +47,5 @@ const header = computed(() => {
</VTable> </VTable>
<div v-else class="h-[300px]"></div> <div v-else class="h-[300px]"></div>
</div>
</template> </template>

View File

@ -1,19 +1,26 @@
<script lang="ts" setup> <script lang="ts" setup>
import DynamicComponent from './DynamicComponent.vue'; import DynamicComponent from './DynamicComponent.vue';
import { select } from './index'; import { select } from './index';
import { ref} from 'vue'
const props = defineProps(['value']); const props = defineProps(['value']);
const tab = ref(''); const tab = ref('');
const changeTab = (val: string) => {
tab.value = val;
};
</script> </script>
<template> <template>
<div> <div>
<VTabs v-model="tab"> <div class="tabs">
<VTab v-for="(v, k) of value" :value="k">{{ k }}</VTab> <a class="tab tab-bordered text-gray-400 uppercase"
</VTabs> v-for="(item, index) of value" :value="index"
<VWindow v-model="tab" style="min-height: 25px"> :class="{ 'tab-active': tab === String(index) }"
<VWindowItem v-for="(v, k) of value" :value="k" @click="changeTab(String(index))"
><DynamicComponent :value="v" >{{ index }}</a>
/></VWindowItem> </div>
</VWindow> <div class="min-h-[25px] mt-4">
<div v-for="(v, k) of value" :value="k">
<DynamicComponent :value="v" v-show=" tab === String(k)"/>
</div>
</div>
</div> </div>
</template> </template>

View File

@ -21,15 +21,16 @@ const format = useFormatter();
const chain = useBlockchain(); const chain = useBlockchain();
</script> </script>
<template> <template>
<VTable density="compact" v-if="txs.length > 0"> <div class="overflow-x-auto mt-4">
<table class="table w-full" density="compact" v-if="txs.length > 0">
<thead> <thead>
<tr> <tr>
<th>Hash</th> <th style="position: relative">Hash</th>
<th>Msgs</th> <th>Msgs</th>
<th>Memo</th> <th>Memo</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody class="text-sm">
<tr v-for="item in txs"> <tr v-for="item in txs">
<td> <td>
<RouterLink :to="`/${chain.chainName}/tx/${item.hash}`">{{ <RouterLink :to="`/${chain.chainName}/tx/${item.hash}`">{{
@ -46,6 +47,7 @@ const chain = useBlockchain();
<td>{{ item.tx.body.memo }}</td> <td>{{ item.tx.body.memo }}</td>
</tr> </tr>
</tbody> </tbody>
</VTable> </table>
<div v-else>[]</div> <div v-else>[]</div>
</div>
</template> </template>