vue-manager icon indicating copy to clipboard operation
vue-manager copied to clipboard

是否可以为table item的添加和修改添加属性校验?

Open liuyatao opened this issue 7 years ago • 2 comments

liuyatao avatar Sep 25 '17 02:09 liuyatao

是不是可以理解为,校验失败后,弹窗保留,显示错误信息

  1. 显示错误信息可以
<VmTable title="Editable Table" 
           type="edit" 
           v-on:edit-ok="edit"
  </VmTable>
<script>
<script>
...
    methods: {
      edit: function (data) {
         //这里验证data数据,如果失败,通过汽包框弹出错误
      },
</script>
  1. 弹窗保留,需要<VmTable>设置新属性绑定组件内部Modal的v-model属性,然后验证失败后保留弹窗显示,你可以先尝试一下是否符合需求

可以参考 https://www.iviewui.com/components/modal

luosijie avatar Sep 25 '17 04:09 luosijie

可以这里理解。

首先说明一下如果使用edit-ok的话iview的对话框+form表单验证是有问题的(第一次点ok是可以做验证的,但是第二次点击就直接关闭了),可以查看链接

我的处理方式是使用slot自定义了footer

<!--自定义footer-->
        <div slot="footer">
          <Button type="primary" @click="handleSubmit('userFormValidate')">提交</Button>
          <Button type="ghost" @click="handleReset('userFormValidate')" style="margin-left: 8px">重置</Button>
        </div>

当校验完成后处理完网络请求后再让对话框消失。

liuyatao avatar Sep 26 '17 07:09 liuyatao