Vue+ElementUI動態切換驗證規則, 以及自定義驗證會引起表單驗證失效,使用callback()解決


 

 

Vue+ElementUI動態切換驗證規則

https://blog.csdn.net/weixin_43810973/article/details/106040451

 

PS: 

自定義驗證存在時 會引起表單驗證失效,使用callback()解決
但是修改的時候,按鈕禁用,仍然觸發驗證,無法提交修改,因此做2套驗證規則,切換
    // 自定義驗證存在時 會引起表單驗證失效,因此做2套驗證規則,切換
    switchRules() {
      if (this.disabled === false) {
        this.rules = this.temp
        this.rules = {}
        this.rules = this.rules1
      } else if (this.disabled === true) {
        this.rules = {}
        this.rules = this.temp
      }
    },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM