|
@@ -21,7 +21,12 @@
|
|
<div :key="j" :class="['col', `col-${i}-${j}`]" :style="computedColStyle(col)">
|
|
<div :key="j" :class="['col', `col-${i}-${j}`]" :style="computedColStyle(col)">
|
|
<!-- 网格 -->
|
|
<!-- 网格 -->
|
|
<template v-for="(grid, k) in col.grid_list">
|
|
<template v-for="(grid, k) in col.grid_list">
|
|
- <div :key="k" @contextmenu.prevent="handleContextMenu($event, grid.id)">
|
|
|
|
|
|
+ <div
|
|
|
|
+ :key="k"
|
|
|
|
+ ref="component"
|
|
|
|
+ :data-id="grid.id"
|
|
|
|
+ @contextmenu.prevent="handleContextMenu($event, grid.id)"
|
|
|
|
+ >
|
|
<component
|
|
<component
|
|
:is="previewComponentList[grid.type]"
|
|
:is="previewComponentList[grid.type]"
|
|
ref="preview"
|
|
ref="preview"
|
|
@@ -300,6 +305,15 @@ export default {
|
|
this.showMenu = false;
|
|
this.showMenu = false;
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * 查找子组件
|
|
|
|
+ * @param {string} id 组件的唯一标识符
|
|
|
|
+ * @returns {Promise<HTMLElement|null>} 返回找到的子组件或 null
|
|
|
|
+ */
|
|
|
|
+ async findChildComponentByKey(id) {
|
|
|
|
+ await this.$nextTick();
|
|
|
|
+ return this.$refs.component.find((child) => child.dataset.id === id);
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -343,7 +357,7 @@ export default {
|
|
|
|
|
|
.custom-context-menu {
|
|
.custom-context-menu {
|
|
padding-left: 30px;
|
|
padding-left: 30px;
|
|
- background: url("../../../../assets/icon-publish.png") left center no-repeat;
|
|
|
|
|
|
+ background: url('../../../../assets/icon-publish.png') left center no-repeat;
|
|
background-size: 24px;
|
|
background-size: 24px;
|
|
}
|
|
}
|
|
}
|
|
}
|