细节调整

This commit is contained in:
kron
2025-11-13 14:51:44 +08:00
parent 24996a4b35
commit eba65a4fbd

View File

@@ -1,15 +1,11 @@
<script setup>
import { ref, computed } from "vue";
import { ref, computed, onMounted } from "vue";
const props = defineProps({
data: {
type: Object,
default: () => ({}),
},
total: {
type: Number,
default: 0,
},
});
const barColor = (rate) => {
@@ -44,13 +40,12 @@ const ringText = (ring) => {
<view>
<view v-for="(b, index) in bars" :key="index">
<text v-if="b && b.rate">
{{ total === 0 ? `${Number((b.rate * 100).toFixed(1))}%` : b.rate }}
{{ `${Number((b.rate * 100).toFixed(1))}%` }}
</text>
<view
:style="{
background: barColor(total === 0 ? b.rate : b.rate / total),
height:
Math.max((total === 0 ? b.rate : b.rate / total) * 240) + 'rpx',
background: barColor(b.rate),
height: (b.rate === 1 ? 150 : b.rate * 240) + 'rpx',
}"
>
</view>