|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div
|
|
|
- class="courserware"
|
|
|
ref="courserware"
|
|
|
+ class="courserware"
|
|
|
:style="[
|
|
|
{
|
|
|
backgroundImage: background.background_image_url ? `url(${background.background_image_url})` : '',
|
|
@@ -21,7 +21,7 @@
|
|
|
<div :key="j" :class="['col', `col-${i}-${j}`]" :style="computedColStyle(col)">
|
|
|
<!-- 网格 -->
|
|
|
<template v-for="(grid, k) in col.grid_list">
|
|
|
- <div @contextmenu.prevent="handleContextMenu($event, grid.id)" :key="k">
|
|
|
+ <div :key="k" @contextmenu.prevent="handleContextMenu($event, grid.id)">
|
|
|
<component
|
|
|
:is="previewComponentList[grid.type]"
|
|
|
ref="preview"
|
|
@@ -36,17 +36,17 @@
|
|
|
|
|
|
<div
|
|
|
v-if="showMenu && componentId === grid.id"
|
|
|
+ :key="'menu' + grid.id + k"
|
|
|
class="custom-context-menu"
|
|
|
:style="{ left: menuPosition.x + 'px', top: menuPosition.y + 'px' }"
|
|
|
@click="handleMenuItemClick"
|
|
|
- :key="'menu' + grid.id + k"
|
|
|
>
|
|
|
<SvgIcon icon-class="icon-publish" size="24" />
|
|
|
添加批注
|
|
|
</div>
|
|
|
<div
|
|
|
- :key="'show' + grid.id + k"
|
|
|
v-if="showRemark && Object.keys(componentRemarkObj).length !== 0 && componentRemarkObj[grid.id]"
|
|
|
+ :key="'show' + grid.id + k"
|
|
|
>
|
|
|
<el-popover
|
|
|
v-for="(items, indexs) in componentRemarkObj[grid.id]"
|
|
@@ -58,10 +58,10 @@
|
|
|
<div v-html="items.content"></div>
|
|
|
<template #reference>
|
|
|
<SvgIcon
|
|
|
+ slot="reference"
|
|
|
icon-class="icon-info"
|
|
|
size="24"
|
|
|
class="remark-info"
|
|
|
- slot="reference"
|
|
|
:style="{ left: items.position_x - 12 + 'px', top: items.position_y - 12 + 'px' }"
|
|
|
/>
|
|
|
</template>
|
|
@@ -136,6 +136,9 @@ export default {
|
|
|
};
|
|
|
window.addEventListener('mousedown', this.handleMouseDown);
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ window.removeEventListener('mousedown', this.handleMouseDown);
|
|
|
+ },
|
|
|
methods: {
|
|
|
/**
|
|
|
* 计算组件内容
|
|
@@ -278,7 +281,7 @@ export default {
|
|
|
this.menuPosition = {
|
|
|
x: this.menuPosition.x + left,
|
|
|
y: this.menuPosition.y + top,
|
|
|
- select_node: select_node,
|
|
|
+ select_node,
|
|
|
}; // 设置菜单位置
|
|
|
this.showMenu = true; // 显示菜单
|
|
|
},
|
|
@@ -293,15 +296,12 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
handleMouseDown(event) {
|
|
|
- if (event.button === 0) {
|
|
|
+ if (event.button === 0 && event.target.className !== 'custom-context-menu') {
|
|
|
// 0 表示左键
|
|
|
this.showMenu = false;
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- beforeDestroy() {
|
|
|
- window.removeEventListener('mousedown', this.handleMouseDown);
|
|
|
- },
|
|
|
};
|
|
|
</script>
|
|
|
|