File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 11
11
@start =" drag = true"
12
12
@end =" drag = false"
13
13
>
14
- <div class =" list-group-item" v-for =" (element, index) in renderList" :key =" index + Date.now()" >
15
- {{ element.text }}
16
- <i class =" fas fa fa-trash fa-md" @click =" deleteElement(index)" ></i >
14
+ <!-- <div class="list-group-item" v-for="(element, index) in renderList" :key="index + Date.now()"> -->
15
+ <div class =" list-group-item" v-for =" (element) in renderList" :key =" element[1] + Date.now()" >
16
+ {{ element[0] }}
17
+ <i class =" fas fa fa-trash fa-md" @click =" deleteElement(element[1])" ></i >
17
18
</div >
18
19
</draggable >
19
20
</section >
@@ -44,7 +45,10 @@ export default {
44
45
renderList: {
45
46
get () {
46
47
if (this .activeComponent === ' ' ) return this .selectedElementList
47
- return this .componentMap [this .activeComponent ].htmlList .filter (el => el .text )
48
+ let newArr = this .componentMap [this .activeComponent ].htmlList .map ((el , index ) => [el .text , index]).filter (el => {
49
+ return el[0 ] !== undefined
50
+ })
51
+ return newArr
48
52
},
49
53
set (value) {
50
54
this .$store .dispatch (setSelectedElementList, value)
Original file line number Diff line number Diff line change @@ -183,7 +183,10 @@ const mutations = {
183
183
for ( let compKey in newObj ) {
184
184
let children = newObj [ compKey ] . children
185
185
children . forEach ( ( child , index ) => {
186
- if ( activeComponent === child ) children . splice ( index , 1 )
186
+ if ( activeComponent === child ) {
187
+ children . splice ( index , 1 )
188
+ newObj [ compKey ] . htmlList = newObj [ compKey ] . htmlList . filter ( el => el !== activeComponent )
189
+ }
187
190
} )
188
191
}
189
192
You can’t perform that action at this time.
0 commit comments