preparing listingComponent to receive empty data and updated this data according to vue lifecycle hook
This commit is contained in:
parent
d81580a134
commit
0f1822ae87
@ -1,6 +1,6 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import blockchain from "@/utils/blockchain";
|
import blockchain from "@/utils/blockchain";
|
||||||
import { ref } from "vue";
|
import { ref, onUpdated } from "vue";
|
||||||
|
|
||||||
// props
|
// props
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@ -38,13 +38,27 @@ const loadMore = () => {
|
|||||||
else itemsToShow.value = props.walletTransactions;
|
else itemsToShow.value = props.walletTransactions;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// lifecycle methods
|
||||||
|
|
||||||
|
onUpdated(() => {
|
||||||
|
if (itemsToShow.value.length == 0) {
|
||||||
|
itemsToShow.value =
|
||||||
|
props.walletTransactions?.length > 3
|
||||||
|
? props.walletTransactions.slice(0, 3)
|
||||||
|
: props.walletTransactions;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//emits
|
//emits
|
||||||
const emit = defineEmits(["cancelDeposit", "withdrawDeposit"]);
|
const emit = defineEmits(["cancelDeposit", "withdrawDeposit"]);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="blur-container">
|
<div class="blur-container">
|
||||||
<div class="grid grid-cols-4 grid-flow-row w-full px-6">
|
<div
|
||||||
|
class="grid grid-cols-4 grid-flow-row w-full px-6"
|
||||||
|
v-if="props.walletTransactions?.length != 0"
|
||||||
|
>
|
||||||
<span class="text-xs text-gray-50 font-medium justify-self-center"
|
<span class="text-xs text-gray-50 font-medium justify-self-center"
|
||||||
>Valor</span
|
>Valor</span
|
||||||
>
|
>
|
||||||
@ -102,14 +116,20 @@ const emit = defineEmits(["cancelDeposit", "withdrawDeposit"]);
|
|||||||
<img alt="Redirect image" src="@/assets/redirect.svg" />
|
<img alt="Redirect image" src="@/assets/redirect.svg" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center w-full mt-2">
|
<div
|
||||||
|
class="flex justify-center w-full mt-2"
|
||||||
|
v-if="props.walletTransactions?.length != 0"
|
||||||
|
>
|
||||||
<button type="button" class="text-white" @click="loadMore()">
|
<button type="button" class="text-white" @click="loadMore()">
|
||||||
Carregar mais
|
Carregar mais
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p class="font-bold" v-if="props.walletTransactions?.length == 0">
|
<span
|
||||||
|
class="font-bold text-gray-900"
|
||||||
|
v-if="props.walletTransactions?.length == 0"
|
||||||
|
>
|
||||||
Não há nenhuma transação anterior
|
Não há nenhuma transação anterior
|
||||||
</p>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -9,12 +9,9 @@ const { depositsAddedList } = storeToRefs(etherStore);
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div class="header">
|
<div class="header">Gerenciar ofertas</div>
|
||||||
Gerenciar ofertas
|
|
||||||
</div>
|
|
||||||
<ListingComponent
|
<ListingComponent
|
||||||
v-if="depositsAddedList?.length != 0"
|
:wallet-transactions="depositsAddedList"
|
||||||
:wallet-transactions="depositsAddedList!"
|
|
||||||
:is-manage-mode="true"
|
:is-manage-mode="true"
|
||||||
></ListingComponent>
|
></ListingComponent>
|
||||||
</div>
|
</div>
|
||||||
@ -25,7 +22,7 @@ const { depositsAddedList } = storeToRefs(etherStore);
|
|||||||
@apply flex flex-col gap-10 mt-20 w-full;
|
@apply flex flex-col gap-10 mt-20 w-full;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header{
|
.header {
|
||||||
@apply text-3xl text-gray-900 leading-9 font-bold justify-center flex
|
@apply text-3xl text-gray-900 leading-9 font-bold justify-center flex;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user