处理小数两位

This commit is contained in:
17792275749
2026-02-05 10:48:17 +08:00
parent ecfaa188c2
commit d652ad1cc4
@@ -18,7 +18,7 @@
<countTo
:endVal="item.marginWeight_kg"
separator=""
:decimals="3"
:decimals="2"
:duration="300"
/>
kg
@@ -177,7 +177,7 @@ export default {
if (item.marginWeight < item.dangerWeight) {
item.class = "danger";
}
item.marginWeight_kg = item.marginWeight / 1000;
item.marginWeight_kg = Math.round(item.marginWeight / 10) / 100;
item.progress = (1 - item.marginWeight / item.foodWeight) * 100 + '%';
});
this.nutritionFoodList = res.data.nutritionFoodList;
@@ -187,7 +187,7 @@ export default {
}
if (res.data.recipeFoodProducedList && res.data.recipeFoodProducedList.length) {
res.data.recipeFoodProducedList.map(item => {
item.foodWeight_kg = item.foodWeight / 1000;
item.foodWeight_kg = Math.round(item.foodWeight / 10) / 100;
});
this.recipeFoodProducedList = res.data.recipeFoodProducedList;
}