<input type="text" name="bankId" v-model="userBankId" @keyup="handleKeyup""? placeholder="請?zhí)顚戙y行卡" maxlength="24" />
????//?銀行卡四位空格
????handleKeyup()?{
??????this.userBankId?=?this.userBankId.replace(/\D/g,?"");?//?不允許輸入非數(shù)字字符
??????this.userBankId?=?this.userBankId.replace(/(\d{4})(?=\d)/g,?"$1?");?//?4位一組,非獲取匹配最后一組數(shù)字,避免刪除到空格時(shí)會馬上自動補(bǔ)齊
????},