iview表單密碼自定義驗證

From中定義   ref="passwordForm" 獲取dom節點  :model="passwordForm" 關聯表單數據對象 :rules="ruleValidate"關聯表單驗證規則

 

data return中dom

 

或者ui

  repeatCount:[{
                            required: true,
                            message: "請選擇效鏡像路徑",
                            trigger: "change"
                        },
                        {
                            type: 'string',
                            pattern: /^((ht|f)tps?):\/\/([\w\-]+(\.[\w\-]+)*\/)*[\w\-]+(\.[\w\-]+)*\/?(\?([\w\-\.,@?^=%&:\/~\+#]*)+)?/,
                            message: '無效的次數',
                            trigger: 'blur'
                        }
                    ],

 

this.$refs[specificationForm].validate(valid => {
//validate表示     整個表單進行校驗,參數爲檢驗完的回調,會返回一個 Boolean 表示成功與失敗,支持 Promise
if (valid) {
  return sucess;
} else {
this.$Message.error("請完善項目信息");
}
});
 
1,表單驗證錯誤一直提示,,prop 須要與v-model中字段一致
相關文章
相關標籤/搜索