xy 1 year ago
parent fc61b403c2
commit 7a7bd2d732

@ -63,6 +63,8 @@
:h="item.h"
:i="item.i"
style="touch-action: none"
@move="active = item.i"
:style="{ 'border': active === item.i ? 'var(--theme-color) solid 1px' : '' }"
>
<component
:is="item.component"
@ -106,7 +108,8 @@ export default {
grid: {
x: 0,
y: 0
}
},
active: ''
}
},
computed: {
@ -129,8 +132,18 @@ export default {
return item
})
})
document.addEventListener('keyup', this.deleteListener)
},
beforeDestroy() {
document.removeEventListener('keyup', this.deleteListener)
},
methods: {
deleteListener(e) {
if (e.key === 'Backspace') {
this.layoutList.splice(this.layoutList.findIndex(j => j.i === this.active), 1)
}
},
dragEnd(item, e) {
this.isDrag = false
if (e.clientX >= this.grid.x && e.clientY >= this.grid.y) {

Loading…
Cancel
Save