Quasar Vue Framework:重置验证的输入字段

问题描述

我正在使用的Quasar应用程序允许拍照并在输入字段中添加一些文本。成功发送图像后,将出现对话框,并提供2个按钮,一个获取其他图片”(另一个重定向到另一页面):

// text input field
<div class="row justify-center q-ma-md">
  <q-input
    v-model="post.caption"
    ref="inputCaption"
    hint="Please enter at least 4 characters."
    :rules="[required(),minLength()]"
    clearable
    label="Caption *"
    dense
    class="col col-sm-6" />
</div>

// Dialog buttons
<q-dialog v-model="savedSuccessfully">
    [...]
    <q-card-actions align="right" class="text-primary">
      <q-btn unelevated rounded color="secondary" label="Take another photo" @click="resetCanvas" />
      <q-btn unelevated rounded color="primary" label="Go to postings" @click="goToPostings" />
    </q-card-actions>

“ resetCanvas”功能不仅会重置图像画布,还会重置输入字段,但不幸的是,resetValidation() –根据Quasar的文档,它应该执行此操作–输入字段仍被认为是脏的:>

resetCanvas() {
  [...]

  this.$refs.inputCaption.resetValidation()
  this.$refs.inputCaption.isDirty = false
},

我什至在重设脚本中添加this.$refs.inputCaption.isDirty = false,但无济于事。 (请参见屏幕截图)

Input field still reacts to validation rules after resetValidation()

重置后我该怎么做才能正确清除输入字段?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)