1.禁止輸入空格
方法1: oninput="value=value.replace(/\s+/g,'')" 在 ios中 用手機原生鍵盤 輸入 會出現bug, 就是你點一下輸入 會出現一大段文字 數字
<input type="text" oninput="value=value.replace(/\s+/g,'')">
方法2: v-model.trim 就不會出現上面的bug
<input type="text" @blur="changBlur" placeholder="請輸入兌換碼" v-model.trim="code">
2.只能輸入純數字
<input type="text" maxlength="13" v-model="phone" oninput="value=value.replace(/[^\d]/g,'')" placeholder="請輸入手機號/QQ號"></div>