Replies: 1 comment
-
尝试魔改,把使用“共用组件”的实例,其对应的 TreeNode,都使用一个 id,譬如对使用第一个实例的id 继续这个路线魔改的话,需要对 useSelectedNode 或 useSelection 之类动手吧 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
譬如一个图片组件,我拖动两次,生成两个图片实例,让两个图片实例都指向同样一张图片,编辑其中一个,另外一个自动更新。
我这种尝试的一个办法,是让共享内容的node,指定其 props['x-component-props'] 为一个 observable值(这里是 shareContent)
但这样,会导致页面不断重复渲染而崩溃,我怀疑是(已经证实确实是这个原因)因为每个组件的实例,都会自动在props['x-component-props']里加入各自的 nod id 如
(相关源代码:FormPath.setIn(results['component'][1], nodeIdAttrName, id) 在文件 formily/antd/src/components/Field/preview.tsx)
之前还尝试一个办法,把所有node的props存到一个数组里,在 ActionsWidget 组件的useEffect里跟踪props的变化,但没有效果。
Beta Was this translation helpful? Give feedback.
All reactions