ruoyi.js 里代码
//金额千分符 会在整数后添加两个0
export function stateFormat(row, column, cellValue) {
if (cellValue) {
return Number(cellValue)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
return $1 + ",";
})
.replace(/\.$/, "");
}
}
然后在html代码里填写:formatter 属性就可以了,如
<el-table-column
align="center"
prop="amountTotal"
label="Money"
width="180"
:formatter="stateFormat">
如果有用,点个赞呗!