修正股票变动颜色逻辑:将负值显示为绿色,正值显示为红色,确保在不同屏幕尺寸下的一致性。

This commit is contained in:
齐斌 2025-06-09 12:12:56 +08:00
parent 1bdea06916
commit 0b000f2eb0
4 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ getStockQuate()
<div class="info-card">
<div class="text-base text-gray-400">% Change</div>
<div class="text-3xl font-bold"
:class="stockQuote.change?.includes('-') ? 'text-red-500' : (stockQuote.change?.includes('+') ? 'text-green-500' : '')">
:class="stockQuote.change?.includes('-') ? 'text-green-500' : 'text-red-500'">
{{ stockQuote.change }}</div>
</div>
<div class="info-card">

View File

@ -28,7 +28,7 @@ getStockQuate()
:class="stockQuote.change?.[1]?.startsWith('-') ? 'text-red-500' : (stockQuote.change?.[1]?.startsWith('+') ? 'text-green-500' : '')">
{{ stockQuote.change?.join('') }}</div> -->
<div class="text-3xl font-bold"
:class="stockQuote.change?.includes('-') ? 'text-red-500' : (stockQuote.change?.includes('+') ? 'text-green-500' : '')">
:class="stockQuote.change?.includes('-') ? 'text-green-500' : 'text-red-500'">
{{ stockQuote.change }}</div>
</div>
<div class="info-card">

View File

@ -22,7 +22,7 @@ getStockQuate();
<div class="text-xs text-gray-400">% Change</div>
<div class="text-lg font-bold"
:class="stockQuote.change?.includes('-') ? 'text-red-500' : (stockQuote.change?.includes('+') ? 'text-green-500' : '')">
:class="stockQuote.change?.includes('-') ? 'text-green-500' : 'text-red-500'">
{{ stockQuote.change }}</div>
</div>
<div class="info-card">

View File

@ -25,7 +25,7 @@ getStockQuate();
<div class="info-card">
<div class="text-sm text-gray-400">% Change</div>
<div class="text-xl font-bold"
:class="stockQuote.change?.includes('-') ? 'text-red-500' : (stockQuote.change?.includes('+') ? 'text-green-500' : '')">
:class="stockQuote.change?.includes('-') ? 'text-green-500' : 'text-red-500'">
{{ stockQuote.change }}</div>
</div>
<div class="info-card">