|
@@ -101,14 +101,25 @@ export default {
|
|
|
this.handleMiddleScroll();
|
|
this.handleMiddleScroll();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ window.addEventListener('keydown', this.handlePaste);
|
|
|
},
|
|
},
|
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
const middle = this.$refs.createMiddle;
|
|
const middle = this.$refs.createMiddle;
|
|
|
if (middle) {
|
|
if (middle) {
|
|
|
middle.removeEventListener('scroll', this.handleMiddleScroll);
|
|
middle.removeEventListener('scroll', this.handleMiddleScroll);
|
|
|
}
|
|
}
|
|
|
|
|
+ window.removeEventListener('keydown', this.handlePaste);
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @description 监听粘贴事件,触发粘贴组件方法
|
|
|
|
|
+ * @param {KeyboardEvent} event 键盘事件
|
|
|
|
|
+ */
|
|
|
|
|
+ handlePaste(event) {
|
|
|
|
|
+ if (event.ctrlKey && event.key === 'v') {
|
|
|
|
|
+ this.pasteComponent('bottom');
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
judgeIsHasChange() {
|
|
judgeIsHasChange() {
|
|
|
if (this.isChange) {
|
|
if (this.isChange) {
|
|
|
this.visibleWarn = true;
|
|
this.visibleWarn = true;
|
|
@@ -155,6 +166,7 @@ export default {
|
|
|
* @param {String} position 放入位置类型
|
|
* @param {String} position 放入位置类型
|
|
|
*/
|
|
*/
|
|
|
pasteComponent(position) {
|
|
pasteComponent(position) {
|
|
|
|
|
+ if (!this.isEdit) return;
|
|
|
if (!this.copyData) {
|
|
if (!this.copyData) {
|
|
|
this.$message.warning('请先复制组件');
|
|
this.$message.warning('请先复制组件');
|
|
|
return;
|
|
return;
|