【问题标题】:Vuelidate pass array to not sameAsVuelidate 将数组传递给 not sameAs
【发布时间】:2020-09-07 22:33:51
【问题描述】:

好的,我希望这有一个简单的解决方案。 我正在尝试在字段上使用 Vuelidate 进行验证,以使其不同于字符串数组。 所以 - 发送单个字符串正在工作:not(sameAs(() =>"hello")) 但是尝试发送数组或逗号分隔值将不再有效:not(sameAs(() => ["hello", "helloo"]))not(sameAs(() => "hello", "helloo"))。 希望有人可以帮助我,谢谢!

【问题讨论】:

    标签: vue.js vuelidate


    【解决方案1】:

    好的,如果有人感兴趣- 我刚刚创建了自己的验证器-> usedTitles:['hello','helloo']; const checkDuplicates = () => this.usedTitles.indexOf(this.val) === -1; val.unique = checkDuplicates;

    【讨论】:

      猜你喜欢
      • 2021-05-16
      • 1970-01-01
      • 2020-08-05
      • 2020-07-28
      • 2014-01-14
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多