-
Notifications
You must be signed in to change notification settings - Fork 548
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
关于dataType的支持 #40
Comments
json schema根据我和 @jinzhubaofu 先否定了,主要原因在于无法对element之类的非json类型进行校验 另一方面来说,vue也存在这样的问题,并且vue开放function支持后,早晚会变成prop types这种样子 所以综合来说,我选择prop types吧 |
现在看来 pro-types 只是写起来有点麻烦,其他没毛病,所以 prop types +1 |
ok,大家倾向都差不多,那 @jinzhubaofu 实现完了再关issue吧。不过我们是data不是prop,只能叫 DataTypes。
|
好的没问题 有个一小问题, 所以,是否要加一个给 defineComponent 加一个 displayName 之类的东西? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
和 @jinzhubaofu 讨论后,确定:
然后是形式:
json schema
太大了,而且只能支持json定义的类型(我没好好读spec,不知道对date这种常用的复合类型支持的怎样)
react propType
https://github.com/facebook/prop-types
这种方式,除了支持基本的类型外,还:
PropTypes.arrayOf(PropTypes.shape({id, age}))
?类似vue,贴近JS
这种方式,除了支持基本的类型外,最多能支持深层次结构,但是很多值相关的就做不了了。当然,可以开放支持function来定制校验规则。如果内置校验规则,和 react propType 也没毛区别。
来讨论下
@otakustay @jinzhubaofu 你俩觉得选哪种好
The text was updated successfully, but these errors were encountered: