用element的el-input限定只輸入數字

使用@input 只能輸入完成才能觸發事件vue

最後經過vue的navtive修飾符,監聽組件根元素的原生事件this

<el-input size='small' @keyup.native="changeAmount"  v-model="formInline.money" placeholder="請輸入充值金額"></el-input>
changeAmount () {
	this.formInline.money = this.formInline.money.replace(/[^\d.]/g, '')
}
相關文章
相關標籤/搜索