defaultnode.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <script setup>
  2. import { ref, onMounted, reactive, } from "vue";
  3. import { VueFlow,Handle, useVueFlow,Position } from '@vue-flow/core'
  4. const props = defineProps({
  5. node: {
  6. type: Object,
  7. required: true,
  8. },
  9. })
  10. onMounted(() => {
  11. });
  12. </script>
  13. <template>
  14. <!-- <div v-if="props.node.data.label!='模块化'"> -->
  15. <div v-if="props.node.data!=null">
  16. <div class="custom-node icons " :id="`node-${node.id}`" >
  17. <img :src="props.node.data.image"/>
  18. <span>{{props.node.data.idCodeser }}</span>
  19. </div>
  20. <Handle id="target-a" type="source" :position="Position.Right" class="custom-handle"/>
  21. <Handle id="target-c" type="source" :position="Position.Top" class="custom-handle"/>
  22. <Handle id="target-b" type="source" :position="Position.Left" class="custom-handle"/>
  23. <Handle id="target-d" type="source" :position="Position.Bottom" class="custom-handle"/>
  24. </div>
  25. <!-- </div> -->
  26. </template>
  27. <style scoped>
  28. .icons img{
  29. width: 20px;
  30. }
  31. .icons span{
  32. display: block;
  33. font-size: 8px;
  34. }
  35. </style>
  36. <style>
  37. .custom-handle {
  38. background: #c11f1f; /* 更浅的颜色 */
  39. width: 6px; /* 更小的尺寸 */
  40. height: 6px; /* 更小的尺寸 */
  41. border-radius: 50%;
  42. border: 1px solid #fff;
  43. transition: all 0.2s ease;
  44. }
  45. .vue-flow__node-default .vue-flow__handle, .vue-flow__node-input .vue-flow__handle, .vue-flow__node-output .vue-flow__handle {
  46. background: #ddd;
  47. }
  48. .vue-flow__node-default .vue-flow__handle:hover,
  49. .vue-flow__node-input .vue-flow__handle:hover,
  50. .vue-flow__node-output .vue-flow__handle:hover {
  51. background: #161616; /* 悬停时稍深 */
  52. }
  53. .vue-flow__node-default, .vue-flow__node-input, .vue-flow__node-output{
  54. width: 50px;
  55. height: 50px;
  56. pointer-events: auto;
  57. border: none;
  58. }
  59. .vue-flow__node-default:not(.selected) {
  60. z-index: 1 !important; /* 强制设置未选中时的 z-index */
  61. }
  62. .vue-flow__node.draggable {
  63. background-color: rgba(0,0,0,0);
  64. }
  65. .vue-flow__node-default.selected, .vue-flow__node-default.selected:hover, .vue-flow__node-input.selected, .vue-flow__node-input.selected:hover, .vue-flow__node-output.selected, .vue-flow__node-output.selected:hover{
  66. box-shadow:none !important;
  67. }
  68. .vue-flow__node {
  69. stroke: none; /* 移除节点边框 */
  70. }
  71. .vue-flow__node:hover{
  72. /* 移除 hover 时的阴影 */
  73. box-shadow: none !important;
  74. }
  75. .vue-flow__edge-text {
  76. display: block;
  77. }
  78. .vue-flow__node-custom {
  79. background: purple;
  80. color: white;
  81. border: 1px solid purple;
  82. border-radius: 4px;
  83. box-shadow: 0 0 0 1px purple;
  84. padding: 8px;
  85. }
  86. </style>