js 輸出數據類型為decimal(18, 2),加0


<script>
function fixed(str) {
if (!str) str = '0.00';
let ret = Math.round(parseFloat(str) * 100) / 100;
let decimal = ret.toString().split('.');
if (decimal.length === 1) {
return ret.toString() + '.00'
};
if (decimal.length > 1) {
if (decimal[1].length < 2) {
return ret.toString() + '0'
}
return ret
};
return ret;
}
</script>
<script type="text/html" id="tplMoney">{{fixed(d.inputMoney)}}</script>
數據表格列設置
{field: 'inputMoney', title: '投入總資金', width: 105, templet: '#tplMoney'}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM