div class=recharge-amount v-for=itemindex in amountList key=index class= option-selected selectedOption == index click=changeAmountitemindex div class=topItem div c
可以在Vue的模板中使用过滤器来格式化输出,例如:
- 在Vue实例中定义一个名为toFixed的过滤器:
filters: { toFixed(value) { return value.toFixed(2) } }
- 在模板中使用该过滤器:
{{ (item.amount - item.realAmount) | toFixed }}
这样就可以保留两位小数输出了。
原文地址: https://www.cveoy.top/t/topic/ciaN 著作权归作者所有。请勿转载和采集!