-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[Schema] 低代码业务组件默认属性(defaultProps)在编辑态、生成代码时无效 #2712
Comments
没看懂问题描述,请再重新组织一下 issue 内容。描述一下问题的上下文。 |
你好 @charmtiger,由于缺乏必要的信息(如 bug 重现步骤、引擎版本信息 等),无法定位问题,请按照 issue bug 模板 补全信息,也可以通过阅读 引擎的 issue 说明 了解什么类型的 issue 可以获得更好、更快的支持。 |
已修改问题描述,帮忙看看,如果还无法了解,我再改 |
问题描述上面一段的意义不明,最好放在问题描述里,结合着你的描述来,最上面的貌似是个 md 的表格,但是格式乱了,也是意义不明。 |
摘录可以是以图片形式,或者把格式调整为可以阅读的(并且标注是协议内容),放在最上面无法理解是协议内容,还是自己希望修改的内容 |
@eternalsky 已修改,不好意思 😁 |
大致明白你的问题了,据我的理解,属性的默认值应该出现在物料描述当中,而不是在组件的 schema 当中,搭建协议中的 defaultProps 应该是没有实现的吧? 这点需要 @liujuping 确认一下。正常来讲,应该是放在物料描述协议当中,和使用源码开发的组件同样的配置方式。 |
物料描述可以参考:低代码引擎物料协议规范 。尤其是其中 configure 章节里里的 props,这里的 defaultValue 目前是实现属性默认值的最佳路径。 |
物料描述中我目前使用的是 setter.initialValue ,在使用这个低代码组件是正常的。但是在编辑态,我们openDocument或createDocument 时,所传入的schema,并不包含configure信息,协议中 Page/Component 容器schema中也并不包含configure 字段。所以我认为编辑态,用不到configure组件描述 |
schema 里没有,但是资产包里有,不是所有信息都描述在搭建 schema 里的,尤其是和物料相关的,基本都是描述在物料协议当中,可以看下开源协议里,关于资产包和物料协议的部分。 |
明白了,我以为是我用错了,谢谢! |
低代码组件中的 defaultProps 目前还没有实现。我提一个新的 issue,后面继续跟进。 |
问题描述
背景:我在使用lce的低代码组件相关能力,实现自定义组件的功能,也实现了定义configure.props配置等等,目前自定义组件拖拽到Page中是可以正常使用的。
问题:通过props的配置,现在拖拽组件到Page中使用,属性区表单都正常。包括本主题主要关注的某个prop的默认值,都正常使用。
但是,组件已经配置了props的默认值了,在编辑这个低码组件的时候,上下文中却拿不到 this.props.xxx 的默认值,这样调试起来比较麻烦,得写 this.props.xxx || '默认值' 才可以。我看到协议中有本贴顶部所copy 的
defaultProps
参数,觉得应该是用来解决这个问题,但是没有效果。协议文档地址
这是我的使用了
defaultProps
的Schema当前效果
绑定了this.props.examId的Text组件无法显示文字,其值为undefined
期望效果
可以在openDocument时将defaultProps中的数据赋值给this.props,方便调试
The text was updated successfully, but these errors were encountered: