From 4a98482eeb470cb3a0a9c47b82261f07d125eae3 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 15 Jun 2023 15:59:31 +0800 Subject: [PATCH] add price calculator and fix color of buy --- src/modules/[chain]/index.vue | 59 ++++++++++++++++++++++++++++--- src/modules/[chain]/indexStore.ts | 2 +- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/src/modules/[chain]/index.vue b/src/modules/[chain]/index.vue index e97dc3ef..3b54f71a 100644 --- a/src/modules/[chain]/index.vue +++ b/src/modules/[chain]/index.vue @@ -103,6 +103,25 @@ function updateState() { function trustColor(v: string) { return `text-${colorMap(v)}` } + +const quantity = ref(100) +const qty = computed({ + get: () => { + return parseFloat(quantity.value.toFixed(6)) + }, + set: val => { + quantity.value = val + } +}) +const amount = computed({ + get: () => { + return quantity.value * ticker.value.converted_last.usd || 0 + }, + set: val => { + quantity.value = val / ticker.value.converted_last.usd || 0 + } +}) +