//input 两位小数
//input 保持两位小数
//input 两位小数
//input 保持两位小数
<input type="number" @input="inputChange" v-model=" xxx">
inputChange(e) {
var that = this
e.target.value = (e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
this.$nextTick(() => {
that.xxx= e.target.value
})
},
监听input 银行卡四位空格
<input type="text" placeholder-style="color:#909399;font-size:28rpx;" v-model="xxx" @input="inputCard"/> //@input="inputCard"监听input变化
watch: {
['refueling_card'](val) {
this.$nextTick(() => {
this.xxx = val.replace(/\D/g,'').replace(/....(?!$)/g,'$& ');
});
}
},