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 } },