el-input 金额千分位自动分割

1. input 只能输入数字, 首位不能为0, 金额千分位自动分割

<el-input v-model="payment" oninput="value=value.replace(/^0{1,}/g,'').replace(/[^\d^\,]/g,'').replace(/,/g,'').replace(/\B(?=(\d{3})+(?!\d))/g,',')"/>

在这里插入图片描述

2. 去除分隔符

this.payment

你可能感兴趣的:(javascript,html)