File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -22,19 +22,13 @@ export default {
22
22
if ( state . snapshotIndex >= 0 ) {
23
23
state . snapshotIndex --
24
24
let componentData = deepCopy ( state . snapshotData [ state . snapshotIndex ] ) || getDefaultcomponentData ( )
25
- if ( state . curComponent ) {
26
- // 如果当前组件不在 componentData 中,则置空
27
- const needClean = ! componentData . find ( ( component ) => state . curComponent . id === component . id )
28
25
29
- if ( needClean ) {
30
- store . commit ( 'setCurComponent' , {
31
- component : null ,
32
- index : null ,
33
- } )
34
- }
35
- }
36
26
componentData = changeComponentsSizeWithScale ( state . lastScale , componentData )
37
27
store . commit ( 'setComponentData' , componentData )
28
+ // 更新当前选中组件的引用
29
+ const curComponent = componentData . find ( ( component ) => component . id === state . curComponent ?. id )
30
+ const index = curComponent ? componentData . indexOf ( curComponent ) : null
31
+ store . commit ( 'setCurComponent' , { component : curComponent , index } )
38
32
}
39
33
} ,
40
34
You can’t perform that action at this time.
0 commit comments