1
0
mirror of synced 2026-04-04 23:38:37 +08:00

feat(ui): 修改useApp实现,与ui-react中保持一致

This commit is contained in:
roymondchen
2023-04-10 19:59:53 +08:00
parent abcac71826
commit befaf67ba7
11 changed files with 213 additions and 492 deletions

View File

@@ -35,18 +35,18 @@ export default ({ config, methods }: UseAppOptions) => {
const node = app?.page?.getNode(config.id);
const [created, setCreated] = useState(false);
const emitData = {
config,
...methods,
};
if (!created) {
// 只需要触发一次 created
setCreated(true);
node?.emit('created', { methods });
node?.emit('created', emitData);
}
useEffect(() => {
const emitData = {
config,
...methods,
};
node?.emit('mounted', emitData);
return () => {