Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

动态表单中,typenumber的动态属性使用exclusiveMinimum约束后表单的提交校验失效 #676

Closed
hungtcs opened this issue Sep 10, 2018 · 2 comments

Comments

@hungtcs
Copy link

hungtcs commented Sep 10, 2018

  • ng-alain version: 2.0.0-beta.0
  • Angular version: 6.1.7

重现链接 Reproduction link

https://stackblitz.com/edit/ng-alain-setup-e8nvss

重现步骤 Steps to reproduce

动态表单中,type: 'number‘的动态属性使用exclusiveMinimum约束后表单的提交校验失效。
具体表现为:

  • 刷新页面后提交按钮没有禁用
  • 刷新页面后在表单内,按下enter键可以触发提交
  • 改变表单内容,然后删除(使状态变为dirty)后,表单提交校验生效
@cipchk cipchk added Bug 🐛 and removed Bug 🐛 labels Sep 10, 2018
@cipchk
Copy link
Member

cipchk commented Sep 11, 2018

这个问题恐怕 无法处理,原因是 sf 的实现机制导致无法很好的处理 type 类型的错误捕获,因此默认情况下 sf 是忽略了所有 type (见 config.ts)类型错误,这就是倒置为什么无法触发无效检查的原因。

其实:

      price: {
        title: '价格',
        type: 'number',
        description: '商品的单价',
        minimum: 0,
        // 添加此属性后,表单校验出现问题
        exclusiveMinimum: true,
      }

等同于:

      price: {
        title: '价格',
        type: 'number',
        description: '商品的单价',
        minimum: 1
      }

@hungtcs
Copy link
Author

hungtcs commented Sep 12, 2018

@cipchk 是的,我是在按照API文档测试的时候发现的这个问题。是否可以在API文档中标注出来呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants