File tree Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Expand file tree Collapse file tree 4 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -116,9 +116,9 @@ export default {
116
116
}
117
117
},
118
118
119
- // FIXME: indexOf('image') 替换图片
119
+ // 替换图片
120
120
replaceImage (e ) {
121
- if (this .id . toLowerCase (). indexOf ( ' image ' ) > - 1 ) {
121
+ if (this .$store . state . activeElement . isUpload ) {
122
122
window .$communicator .$emit (' upload' , payload => {
123
123
this .$store .commit (' replaceImage' , payload)
124
124
})
Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ export default {
31
31
guides () {
32
32
var state = this .$store .state
33
33
var guides = []
34
- var index = state .index
34
+ var uuid = state .uuid
35
35
36
- state .widgets .forEach (( item , i ) => {
36
+ state .widgets .forEach (item => {
37
37
// 排除选中元素
38
- if (item .hasGuide && i === index ) return
38
+ if (item .hasGuide && item . uuid === uuid ) return
39
39
// 排除容器中的元件
40
40
if (item .hasGuide && item .belong !== ' page' ) return
41
41
Original file line number Diff line number Diff line change 1
1
export default {
2
2
addWidget ( { state, commit } , item ) {
3
- if ( item . isUpload ) {
3
+ if ( item . setting . isUpload ) {
4
4
window . $communicator . $emit ( 'upload' , ( payload ) => {
5
5
commit ( 'addWidget' , { data : payload , item } )
6
6
} , true )
7
7
} else {
8
8
commit ( 'addWidget' , { item } )
9
9
// 设置选中
10
10
commit ( 'select' , {
11
- type : item . setting . type ,
12
- index : state . widgets . length - 1
11
+ uuid : state . widgets [ state . widgets . length - 1 ] . uuid
13
12
} )
14
13
}
15
14
} ,
Original file line number Diff line number Diff line change @@ -6,8 +6,11 @@ export default {
6
6
state . uuid = payload . uuid
7
7
if ( payload . uuid === - 1 ) {
8
8
state . activeElement = state . page
9
+ state . type = 'page'
9
10
} else {
10
- state . activeElement = state . widgets . find ( w => w . uuid === payload . uuid )
11
+ let widget = state . widgets . find ( w => w . uuid === payload . uuid )
12
+ state . activeElement = widget
13
+ state . type = widget . type
11
14
}
12
15
} ,
13
16
@@ -146,8 +149,8 @@ export default {
146
149
147
150
// 重置 activeElement
148
151
state . activeElement = state . page
149
- state . type = 'page'
150
- state . index = - 1
152
+ // state.type = 'page'
153
+ state . uuid = - 1
151
154
} ,
152
155
153
156
// 添加组件
You can’t perform that action at this time.
0 commit comments