javascript
<template>
<div>
{{ num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",") }}
</div>
</template>
<script>
</script>
<style>
</style>
如上所示:保留两位小数后,用正则进行替换
效果:
<template>
<div>
{{ num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ",") }}
</div>
</template>
<script>
</script>
<style>
</style>
如上所示:保留两位小数后,用正则进行替换
效果: