HTML代码
<el-input v-model="ruleForm.instruction" style="width: 70%" placeholder="请输入异常指令" @input="hexadecimal" ></el-input>
在methods里面写
hexadecimal () {
let str = this.ruleForm.instruction;
this.ruleForm.instruction = str
.replace(/[^0-9a-fA-F]/g, "")
.replace(/\s/g, "")
.replace(/(\w{2})(?=\w)/g, "$1 ");
}