wangting
2024-10-18 07ba00bbc814f67050c46f028c5b56966d269c46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<template>
  <context-menu class="contextMenu">
    <node-menu>
<!--      <menu-li command="copy" text="拷贝" />-->
      <menu-li command="delete" text="删除" />
    </node-menu>
    <edge-menu>
      <menu-li command="delete" text="删除" />
    </edge-menu>
    <canvas-menu>
      <menu-li command="undo" text="撤销" />
      <menu-li command="redo" text="重做" />
<!--      <menu-li command="pasteHere" icon="paste" text="粘贴到这里" />-->
    </canvas-menu>
  </context-menu>
</template>
 
<script>
import {
  NodeMenu,
  EdgeMenu,
  GroupMenu,
  MultiMenu,
  CanvasMenu,
  ContextMenu,
} from 'vue-flowchart-editor'
import MenuLi from './ContextMenuItem'
 
export default {
  name: 'EditorContextMenu',
  components: {
    NodeMenu,
    EdgeMenu,
    GroupMenu,
    MultiMenu,
    CanvasMenu,
    ContextMenu,
    MenuLi,
  },
}
</script>
 
<style lang="scss" scoped>
.contextMenu {
  display: none;
  overflow: hidden;
  font-size: 12px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  padding: 5px;
}
::v-deep {
  .contextMenu .command.disable .item {
    color: rgba(0, 0, 0, 0.25);
    cursor: auto;
  }
 
  .contextMenu .command.disable .item:hover {
    background: #fff;
  }
 
  .contextMenu .item {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
  }
 
  .contextMenu .item:hover {
    background: #e6f7ff;
  }
 
  .contextMenu .item i {
    margin-right: 8px;
    margin-top: 3px;
  }
}
</style>