【问题标题】:Refresh dialog and its contents after submission提交后刷新对话框及其内容
【发布时间】:2019-08-15 13:12:36
【问题描述】:

我正在使用v-dialog 向数据库添加一些内容。这些字段使用:rules 进行验证,如下所示:

模板:

<v-text-field label="Title" v-model="title" prepend-icon="folder" :rules="inputRules"></v-text-field>
...

脚本:

inputRules: [
    v => (v && v.length >= 1) || "Kindly enter a value for this field"
  ],

但在提交表单并再次重新打开后,inputRules 仍在验证中:

如何再次刷新表单内容或对话框?

【问题讨论】:

    标签: javascript vue.js vuetify.js


    【解决方案1】:

    使用refs 属性分配整个表单引用。然后在提交表单后清除内容

    this.$refs.resetValidation()
    

    【讨论】:

      【解决方案2】:

      在提交表单后尝试将success props (API) 设置为true。或者像解决方法一样,在您的验证器 (inputRules) 中使用一些标志,以了解表单是否已提交

      【讨论】:

        猜你喜欢
        • 2020-06-03
        • 2013-03-29
        • 2011-04-13
        • 1970-01-01
        • 2012-09-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多