|
@@ -360,12 +360,23 @@ export default {
|
|
|
mounted() {
|
|
mounted() {
|
|
|
document.addEventListener('mousemove', this.dragMove);
|
|
document.addEventListener('mousemove', this.dragMove);
|
|
|
document.addEventListener('mouseup', this.dragEnd);
|
|
document.addEventListener('mouseup', this.dragEnd);
|
|
|
|
|
+ window.addEventListener('keydown', this.handleCopy);
|
|
|
},
|
|
},
|
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|
|
|
document.removeEventListener('mousemove', this.dragMove);
|
|
document.removeEventListener('mousemove', this.dragMove);
|
|
|
document.removeEventListener('mouseup', this.dragEnd);
|
|
document.removeEventListener('mouseup', this.dragEnd);
|
|
|
|
|
+ window.removeEventListener('keydown', this.handleCopy);
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 监听复制事件,触发复制组件方法
|
|
|
|
|
+ * @param {KeyboardEvent} event 键盘事件
|
|
|
|
|
+ */
|
|
|
|
|
+ handleCopy(event) {
|
|
|
|
|
+ if (event.ctrlKey && event.key === 'c' && this.curComponentId.length > 0) {
|
|
|
|
|
+ this.findChildComponentByKey(`grid-${this.curComponentId}`)?.copyComponent();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
handleHeightChange(id, newHeight) {
|
|
handleHeightChange(id, newHeight) {
|
|
|
this.data.row_list.forEach((row) => {
|
|
this.data.row_list.forEach((row) => {
|
|
|
row.col_list.forEach((col) => {
|
|
row.col_list.forEach((col) => {
|