Parameters Mobile

This commit is contained in:
alisa 2023-04-27 19:00:44 +08:00
parent 881e64b3ff
commit a0104d5fee
3 changed files with 87 additions and 72 deletions

View File

@ -2,17 +2,24 @@
import type { PropType } from 'vue'; import type { PropType } from 'vue';
const props = defineProps({ const props = defineProps({
cardItem: { cardItem: {
type: Object as PropType<{title: string;items: Array<any>;}>, type: Object as PropType<{ title: string; items: Array<any> }>,
}, },
}) });
</script> </script>
<template> <template>
<div class="bg-card px-4 pt-3 pb-4 rounded mt-6" <div
v-if="props.cardItem?.items && props.cardItem?.items?.length > 0"> class="bg-card px-4 pt-3 pb-4 rounded mt-6"
v-if="props.cardItem?.items && props.cardItem?.items?.length > 0"
>
<div class="text-base mb-3 text-main">{{ props.cardItem?.title }}</div> <div class="text-base mb-3 text-main">{{ props.cardItem?.title }}</div>
<div class="grid grid-cols-5 gap-4"> <div
<div v-for="(item,index) of props.cardItem?.items" :key="index" class="rounded-sm bg-active px-4 py-2"> class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 2xl:grid-cols-6 gap-4"
>
<div
v-for="(item, index) of props.cardItem?.items"
:key="index"
class="rounded-sm bg-active px-4 py-2"
>
<div class="text-xs mb-2 text-secondary">{{ item?.subtitle }}</div> <div class="text-xs mb-2 text-secondary">{{ item?.subtitle }}</div>
<div class="text-base text-main">{{ item?.value }}</div> <div class="text-base text-main">{{ item?.value }}</div>
<!-- {{ item }} --> <!-- {{ item }} -->

View File

@ -2,23 +2,26 @@
import type { PropType } from 'vue'; import type { PropType } from 'vue';
const props = defineProps({ const props = defineProps({
tableItem: { tableItem: {
type: Object as PropType<{title: string;items: Object;}>, type: Object as PropType<{ title: string; items: Object }>,
}, },
}) });
function formatTitle(name: string) { function formatTitle(name: string) {
return String(name).replaceAll('_', ' ') return String(name).replaceAll('_', ' ');
} }
</script> </script>
<template> <template>
<div class="bg-card px-4 pt-3 pb-4 rounded mt-6"> <div class="bg-card px-4 pt-3 pb-4 rounded mt-6">
<div class="text-base mb-3 text-main">{{ props.tableItem?.title }}</div> <div class="text-base mb-3 text-main">{{ props.tableItem?.title }}</div>
<div class=""> <div class="">
<div class="d-flex flex-nowrap" v-for="(item,index ) of props.tableItem?.items" :key="index"> <div
class="flex flex-nowrap"
v-for="(item, index) of props.tableItem?.items"
:key="index"
>
<div class="mr-6">{{ formatTitle(item?.subtitle) }}</div> <div class="mr-6">{{ formatTitle(item?.subtitle) }}</div>
<div class="flex-1">{{ item?.value }}</div> <div class="flex-1">{{ item?.value }}</div>
<div>{{typeof(item?.value )}}</div> <div>{{ typeof item?.value }}</div>
<!-- {{ item }} --> <!-- {{ item }} -->
</div> </div>
</div> </div>

View File

@ -1,24 +1,29 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useParamStore } from '@/stores'; import { useParamStore } from '@/stores';
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue';
import CardParameter from '@/components/CardParameter.vue' import CardParameter from '@/components/CardParameter.vue';
import TableParameter from '@/components/TableParameter.vue' import TableParameter from '@/components/TableParameter.vue';
import { sort } from 'semver';
const store = useParamStore() const store = useParamStore();
const chain = ref(store.chain) const chain = ref(store.chain);
onMounted(() => { onMounted(() => {
// fetch the data // fetch the data
store.initial() store.initial();
}) });
</script> </script>
<template> <template>
<div> <div>
<!-- Chain ID --> <!-- Chain ID -->
<div class="bg-card px-4 pt-3 pb-4 rounded"> <div class="bg-card px-4 pt-3 pb-4 rounded">
<div class="text-base mb-3 text-main">{{ chain.title }}</div> <div class="text-base mb-3 text-main">{{ chain.title }}</div>
<div class="grid grid-cols-5 gap-4"> <div
<div v-for="(item,index) of chain.items" :key="index" class="rounded-sm bg-active px-4 py-2"> class="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 2xl:grid-cols-6 gap-4"
>
<div
v-for="(item, index) of chain.items"
:key="index"
class="rounded-sm bg-active px-4 py-2"
>
<div class="text-xs mb-2 text-secondary">{{ item.subtitle }}</div> <div class="text-xs mb-2 text-secondary">{{ item.subtitle }}</div>
<div class="text-base text-main">{{ item.value }}</div> <div class="text-base text-main">{{ item.value }}</div>
</div> </div>
@ -39,8 +44,8 @@ onMounted(() => {
<!-- Node Information --> <!-- Node Information -->
<TableParameter :tableItem="store.nodeVersion" /> <TableParameter :tableItem="store.nodeVersion" />
</div> </div>
</template> </template>
<route> <route>
{ {
meta: { meta: {