File tree Expand file tree Collapse file tree
packages/designer/src/designer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ export class Designer implements IDesigner {
144144
145145 private oobxList : OffsetObserver [ ] = [ ] ;
146146
147+ private selectionDispose : undefined | ( ( ) => void ) ;
148+
147149 @obx . ref private _componentMetasMap = new Map < string , IComponentMeta > ( ) ;
148150
149151 @obx . ref private _simulatorComponent ?: ComponentType < any > ;
@@ -265,10 +267,9 @@ export class Designer implements IDesigner {
265267 }
266268
267269 setupSelection = ( ) => {
268- let selectionDispose : undefined | ( ( ) => void ) ;
269- if ( selectionDispose ) {
270- selectionDispose ( ) ;
271- selectionDispose = undefined ;
270+ if ( this . selectionDispose ) {
271+ this . selectionDispose ( ) ;
272+ this . selectionDispose = undefined ;
272273 }
273274 const { currentSelection } = this ;
274275 // TODO: 避免选中 Page 组件,默认选中第一个子节点;新增规则 或 判断 Live 模式
@@ -284,7 +285,7 @@ export class Designer implements IDesigner {
284285 }
285286 this . postEvent ( 'selection.change' , currentSelection ) ;
286287 if ( currentSelection ) {
287- selectionDispose = currentSelection . onSelectionChange ( ( ) => {
288+ this . selectionDispose = currentSelection . onSelectionChange ( ( ) => {
288289 this . postEvent ( 'selection.change' , currentSelection ) ;
289290 } ) ;
290291 }
You can’t perform that action at this time.
0 commit comments