mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix(editor): 删除组件后,组件树不更新
This commit is contained in:
parent
29e31e9cad
commit
bcbd1f5d37
@ -76,7 +76,7 @@ export default defineComponent({
|
|||||||
{
|
{
|
||||||
type: 'button',
|
type: 'button',
|
||||||
text: '新增',
|
text: '新增',
|
||||||
display: () => node.value?.items?.length > 0,
|
display: () => node.value?.items,
|
||||||
items: getSubMenuData.value,
|
items: getSubMenuData.value,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -193,6 +193,12 @@ export default defineComponent({
|
|||||||
() => statusData.highlightNode.value?.id !== statusData.clickNode.value?.id && !clicked.value,
|
() => statusData.highlightNode.value?.id !== statusData.clickNode.value?.id && !clicked.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
editorService?.on('remove', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
tree.value?.getNode(editorService.get('node').id)?.updateChildren();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
tree,
|
tree,
|
||||||
menu,
|
menu,
|
||||||
|
@ -191,6 +191,9 @@ class Editor extends BaseService {
|
|||||||
} else {
|
} else {
|
||||||
historyService.empty();
|
historyService.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.emit('select', node);
|
||||||
|
|
||||||
return node!;
|
return node!;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,6 +294,8 @@ class Editor extends BaseService {
|
|||||||
|
|
||||||
stage?.select(newNode.id);
|
stage?.select(newNode.id);
|
||||||
|
|
||||||
|
this.emit('add', newNode);
|
||||||
|
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,6 +336,8 @@ class Editor extends BaseService {
|
|||||||
this.addModifiedNodeId(parent.id);
|
this.addModifiedNodeId(parent.id);
|
||||||
this.pushHistoryState();
|
this.pushHistoryState();
|
||||||
|
|
||||||
|
this.emit('remove', node);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,6 +399,8 @@ class Editor extends BaseService {
|
|||||||
this.addModifiedNodeId(newConfig.id);
|
this.addModifiedNodeId(newConfig.id);
|
||||||
this.pushHistoryState();
|
this.pushHistoryState();
|
||||||
|
|
||||||
|
this.emit('update', newConfig);
|
||||||
|
|
||||||
return newConfig;
|
return newConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user