feat: add listen code change

This commit is contained in:
2024-09-23 20:51:59 +08:00
parent 4d308921a3
commit 27f487c48f
13 changed files with 419 additions and 97 deletions

View File

@@ -43,22 +43,25 @@ export const Deck = () => {
const codes = nodes.map((node: any) => {
const container = node.container;
const data = container?.data || {};
const nodeData = node.data || {};
let style = nodeData.style ?? {
position: 'absolute',
width: 100,
height: 100,
};
return {
id: node.id,
title: node.title,
code: container?.code || '',
data: data,
children: node.children,
...data, // style className shadowRoot showChild
// TODO: style className shadowRoot showChild
className: nodeData.className,
shadowRoot: nodeData.shadowRoot,
showChild: nodeData.showChild,
style,
};
});
// const code = {
// id: data.id,
// title: data.title,
// code: data.code,
// data: data.data,
// };
// init([code]);
init(codes);
console.log('codes', codes);
}