Fix: trust color

This commit is contained in:
liangping 2023-06-13 08:18:37 +08:00
parent a42eb4fae7
commit c5b88d73c2
2 changed files with 10 additions and 6 deletions

View File

@ -12,7 +12,7 @@ import {
useParamStore,
} from '@/stores';
import { onMounted, ref } from 'vue';
import { useIndexModule } from './indexStore';
import { useIndexModule, colorMap } from './indexStore';
import { computed } from '@vue/reactivity';
import CardStatisticsVertical from '@/components/CardStatisticsVertical.vue';
@ -99,6 +99,10 @@ const color = computed(() => {
function updateState() {
walletStore.loadMyAsset()
}
function trustColor(v: string) {
return `text-${colorMap(v)}`
}
</script>
<template>
@ -158,7 +162,7 @@ function updateState() {
<li v-for="(item, index) in store.coinInfo.tickers" :key="index" @click="store.selectTicker(index)">
<div class="flex items-center justify-between hover:bg-base-100">
<div class="flex-1">
<div class="text-main text-sm">
<div class="text-main text-sm" :class="trustColor(item.trust_score)">
{{ item?.market?.name }}
</div>
<div class="text-sm text-gray-500 dark:text-gray-400">
@ -178,7 +182,7 @@ function updateState() {
</div>
</div>
<a :color="store.trustColor" class="my-5 !text-white btn !bg-yes !border-yes w-full" :href="ticker.trade_url"
<a class="my-5 !text-white btn w-full" :class="store.trustColor" :href="ticker.trade_url"
target="_blank">
Buy {{ coinInfo.symbol || '' }}
</a>

View File

@ -13,7 +13,7 @@ import type { Coin, Tally } from '@/types';
import numeral from 'numeral';
import { defineStore } from 'pinia';
function colorMap(color: string) {
export function colorMap(color: string) {
switch (color) {
case 'yellow':
return 'warning';
@ -128,7 +128,7 @@ export const useIndexModule = defineStore('module-index', {
trustColor(): string {
if(!this.coinInfo?.tickers) return ""
const change = this.coinInfo?.tickers[this.tickerIndex]?.trust_score;
return colorMap(change);
return `btn-${colorMap(change)}`;
},
pool() {