1
0
mirror of synced 2026-04-05 07:48:35 +08:00

fix(editor): 首次选中组件后拖动,更新节点无效

This commit is contained in:
roymondchen
2022-03-15 15:44:08 +08:00
committed by jia000
parent 12de0f5414
commit dee685f0b3
3 changed files with 12 additions and 33 deletions

View File

@@ -17,7 +17,7 @@
*/
import { reactive, toRaw } from 'vue';
import { cloneDeep } from 'lodash-es';
import { cloneDeep, mergeWith } from 'lodash-es';
import serialize from 'serialize-javascript';
import type { Id, MApp, MComponent, MContainer, MNode, MPage } from '@tmagic/schema';
@@ -31,7 +31,6 @@ import { LayerOffset, Layout } from '@editor/type';
import {
change2Fixed,
COPY_STORAGE_KEY,
defaults,
Fixed2Other,
getNodeIndex,
initPosition,
@@ -292,7 +291,11 @@ class Editor extends BaseService {
let newConfig = await this.toggleFixedPosition(toRaw(config), node, this.get<MApp>('root'));
defaults(newConfig, node);
newConfig = mergeWith(node, newConfig, (objValue, srcValue) => {
if (Array.isArray(srcValue)) {
return srcValue;
}
});
if (!newConfig.type) throw new Error('配置缺少type值');