Skip to content

Commit b9068b9

Browse files
committed
代码优化
1 parent c45f42d commit b9068b9

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

src/components/widget-form-list.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<draggable
33
v-model="pageData[list]"
44
:options="{group:'widget', ghostClass: 'ghost',swapThreshold:0.5,animation: 100}"
5-
@end="handleMoveEnd"
65
@add="handleWidgetAdd"
76
class="widget-form-list"
87
:class="{'widget-empty': pageData[list].length === 0}"
@@ -127,9 +126,6 @@ export default {
127126
})
128127
},
129128
methods: {
130-
handleMoveEnd({ newIndex, oldIndex }) {
131-
console.log('index', newIndex, oldIndex)
132-
},
133129
handleWidgetAdd(evt) {
134130
const newIndex = evt.newIndex;
135131

src/components/widget-form.vue

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,6 @@ export default {
3636
methods: {
3737
setConfigTab() {
3838
this.$store.commit("setConfigTab", "page");
39-
},
40-
handleMoveEnd({ newIndex, oldIndex }) {
41-
console.log('index', newIndex, oldIndex)
42-
},
43-
handleWidgetAdd(evt) {
44-
const newIndex = evt.newIndex
45-
46-
//为拖拽到容器的元素添加唯一 key
47-
const key = Date.parse(new Date()) + '_' + Math.ceil(Math.random() * 99999)
48-
let newObj = this.$util.deepClone(this.pageData.list[newIndex]);
49-
// 绑定键值
50-
newObj.key = this.pageData.list[newIndex].type + '_' + key;
51-
this.$set(this.pageData.list, newIndex, newObj)
52-
this.$store.commit('setSelectWg', this.pageData.list[newIndex])
5339
}
5440
}
5541
}

0 commit comments

Comments
 (0)