jd-opensource / drip-form

基于React和JSONSchema的动态表单解决方案
https://jd-opensource.github.io/drip-form/
MIT License
613 stars 73 forks source link

目的给div添加自定义class,方便获取dom #265

Closed guojinchao closed 1 year ago

guojinchao commented 1 year ago

在uiProp里面加一个classCode 属性需要加到form-container的calss上,这样每个关键dom节点就可以被获取到

Motivation

(Write your motivation here.)

Have you read the Contributing Guidelines on pull requests?

(Write your answer here.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/JDFED/drip-form/tree/dev/website, and link to your PR here.)

mengshang918 commented 1 year ago

有几个问题确认下。

  1. 需要获取dom是为了数组容器内部元素过多,方便滚动到具体元素上?
  2. 为啥不直接使用id?uiProp是传递到每个表单组件的,我理解应该可以用id获取元素。是因为id需要动态生成每一个不同的?
  3. classcode是不是可以换个更语义化的词。
guojinchao commented 1 year ago

有几个问题确认下。

  1. 需要获取dom是为了数组容器内部元素过多,方便滚动到具体元素上?
  2. 为啥不直接使用id?uiProp是传递到每个表单组件的,我理解应该可以用id获取元素。是因为id需要动态生成每一个不同的?
  3. classcode是不是可以换个更语义化的词。
  1. 动态渲染的数组会有多项dom. id具有唯一性,无法获取到多个数组下的dom节点, id的使用规则也没有被解析到dom上, 只有表单的单项会生效,所以使用class更方便
  2. classCode是作为替代className关键字使用, 使用className会跟原生react的className重复,造成渲染的class有被解析的风险
mengshang918 commented 1 year ago

同步更新下文档unitedSchema协议#特殊配置部分,在特殊配置中添加自定义表单容器类名(customClassName)的介绍和用例