Commit 56588845 by 胡悦

fix(WeeklyConversionRate): Adjust conversion rate display logic to limit values between 2% and 100%

- Updated the width and position calculations to ensure that conversion rates are capped at a maximum of 100% and a minimum of 2%, improving the accuracy of the displayed data.
1 parent 88f38faf
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
class="bar" class="bar"
:class="item.class" :class="item.class"
:style="{ :style="{
width: `${Math.max(2, Number(currentConversionData[item.key]) || 0)}%` width: `${Math.min(100, Math.max(2, Number(currentConversionData[item.key]) || 0))}%`
}" }"
></view> ></view>
<view <view
class="bar-text" class="bar-text"
:style="{ left: `calc(${currentConversionData[item.key]}%)` }" :style="{ left: `calc(${Number(currentConversionData[item.key]) > 100 ? 100 : currentConversionData[item.key]}%)` }"
>{{ (Number(currentConversionData[item.key]) || 0).toFixed(1) }}%</view> >{{ (Number(currentConversionData[item.key]) || 0).toFixed(1) }}%</view>
</view> </view>
</view> </view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!