vue处理小数保留两位并百分比展示
2022-02-11 本文已影响0人
上海_前端_求内推
1,html
<el-table-column prop="drugRate" label="药占比" width="auto">
<template slot-scope="scope">
{{ towNumber(scope.row.drugRate*100) }}%
</template>
</el-table-column>
2,js
towNumber(val) {
return Number(val).toFixed(2);
},