JavaScript: Rounding Price to 2 Decimal Places in Vue.js Computed Property
To fix the issue of the price appearing as "\u00A5333.299999999999999999999999999999999999999999999", you can use the toFixed() method to round the value to 2 decimal places:
good.good_total = (good.number * good.price).toFixed(2);
This will ensure that the price is displayed as "\u00A5333.30" instead.
原文地址: https://www.cveoy.top/t/topic/qow5 著作权归作者所有。请勿转载和采集!