【问题标题】:Vue JS 2 - Vuetify and Vulidate on openning modalVue JS 2 - 打开模式时的 Vuetify 和 Vuelidate
【发布时间】:2021-07-15 09:37:43
【问题描述】:

所以这是我的问题。

我只是在对话框中放置了一个表单,当我第一次打开它时,一切都很好,vuelidate 有效,如果我的字段为空也会出错。我完成了表单发送它,它关闭了模式。

但是,当我再次打开它以完成它时,会无缘无故地显示错误: Image of the error

<v-select
 v-model="selectedDoctor"
 :items="doctors"
 item-text="username"
 item-value="id"
 :label="$t('components.homeCardTeleconsultation.doctor')"
 :error-messages="
 fieldErrors($v.selectedDoctor, $t('components.homeCardTeleconsultation.doctor'))"
 return-object
 />

  addTeleconsultant () {
    this.$v.$touch()
    if (this.$v.$invalid || this.isSaving) {
    } else {
    const query = {
      xxxxx
    }

    this.$repositories.teleconsultations.create(query).then((reponse) => {
      this.teleconsults = reponse.data
    })
    this.close()
  }

当我打开模式时似乎 vuelidate 检查我的字段是否需要,但不是第一次。我真的不明白这是怎么回事,所以如果有人有解决方案或什么的......

谢谢!

【问题讨论】:

    标签: forms vue.js vuejs2 vuetify.js vuelidate


    【解决方案1】:

    只需一行this.$v.$reset()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-29
      • 1970-01-01
      • 2019-07-24
      • 2020-01-28
      • 1970-01-01
      • 2021-08-28
      相关资源
      最近更新 更多