changeInt(msg) { // 判断是否为颜色的16进制 console.log(msg); var reg = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/; console.log(reg.test(msg)); },
<input type="number" v-model="amount" @input="changeInt(color)">