form表單驗證規則的各個屬性
有如下幾個屬性
rules: [{
pattern: /^[0-9]*$/,//該 pattern 規則屬性訓示一個正規表達式的值必須比對,才能通過驗證。
required: true,//表示此項為必填項
whitespace: true,//驗證是否隻有空格
type:'number',//限制輸入内容是什麼格式string,number,boolean,integer(類型為number且為整數)
transform(value) {//如果限制是數字,這裡可以轉換成數字格式的
if(value){
return Number(value);
}
},
message: '請輸入聯系方式' }//提示資訊
],
較為詳細的驗證規則描述https://www.suibianlu.com/c/p/16969.html