We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ms-duplex-gt规则使用max属性的值来作为 最小值 参数, 语义是不是反了, 应该用 min 吧?
ms-duplex-gt
min
我当时没有继续纠结, 就这样用了:
<input type="number" ms-duplex-gt="amount" max="100" />
但是后来发现这与浏览器自己语义是冲突的(针对input[type=number]), 比如在chrome里面, 向上滚动鼠标的时候最大能输入的值就是max指定的值, 与avalon.validation的语义正好相反.
input[type=number]
附avalon.validation的gt相关实现:
gt: { message: '必须大于{{max}}', get: function(value, data, next) { var elem = data.element var a = parseInt(elem.getAttribute("max"), 10) if (!isFinite(a)) { a = parseInt(elem.getAttribute("data-duplex-gt"), 10) } var num = data.data.max = a next(parseFloat(value) > num) return value } },
The text was updated successfully, but these errors were encountered:
好像是这样,这下惨了,业务已经在用了,改不了
Sorry, something went wrong.
@RubyLouvre 如果由于业务风险不便于改, 建议后续版本保留现有用法, 但是要把 ms-duplex-gt 加 Deprecated, 从文档中隐藏, 并运行时警告, 然后使用其它替代实现.
Deprecated
我为什么这么建议呢, 因为 max, min 这些属于input的标准属性, 当使用场景多的时候冲突就会很难避免.
至于用什么替代呢, 下面是我的建议:
No branches or pull requests
ms-duplex-gt
规则使用max属性的值来作为 最小值 参数, 语义是不是反了, 应该用min
吧?我当时没有继续纠结, 就这样用了:
但是后来发现这与浏览器自己语义是冲突的(针对
input[type=number]
), 比如在chrome里面, 向上滚动鼠标的时候最大能输入的值就是max指定的值, 与avalon.validation的语义正好相反.附avalon.validation的gt相关实现:
The text was updated successfully, but these errors were encountered: