eltree.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. sourcePosition: {
  10. type: String,
  11. },
  12. targetPosition: {
  13. type: String,
  14. },
  15. })
  16. onMounted(() => {
  17. });
  18. </script>
  19. <template>
  20. <!-- <div v-if="props.node.data.label!='模块化'"> -->
  21. <div v-if="props.node.data!=null">
  22. <div class="custom-node icons " :id="`node-${node.id}`" >
  23. <img v-if="props.node.data.label!='模块化'" :src="props.node.data.image"/>
  24. <span>{{props.node.data.label }}</span>
  25. </div>
  26. <Handle v-if="props.node.data.label!='模块化'" type="source" id="target-a" :position="Position.Right" />
  27. <Handle id="target-c" type="source" :position="Position.Top" />
  28. <Handle v-if="props.node.data.label!='模块化'" id="target-b" type="source" :position="Position.Left" />
  29. <Handle id="target-d" type="source" :position="Position.Bottom" />
  30. </div>
  31. <!-- </div> -->
  32. </template>
  33. <style scoped>
  34. .icons img{
  35. width: 26px;
  36. }
  37. .icons span{
  38. display: block;
  39. font-size: 8px;
  40. }
  41. </style>
  42. <style>
  43. .vue-flow__node-default, .vue-flow__node-input, .vue-flow__node-output{
  44. width: 60px;
  45. height: 58px;
  46. pointer-events: auto;
  47. }
  48. .vue-flow__node-default:not(.selected) {
  49. z-index: 1 !important; /* 强制设置未选中时的 z-index */
  50. }
  51. .vue-flow__node.draggable {
  52. background-color: rgba(0,0,0,0);
  53. }
  54. .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{
  55. box-shadow:none;
  56. }
  57. .vue-flow__node {
  58. stroke: none; /* 移除节点边框 */
  59. }
  60. .vue-flow__edge-text {
  61. display: block;
  62. }
  63. .vue-flow__node-custom {
  64. background: purple;
  65. color: white;
  66. border: 1px solid purple;
  67. border-radius: 4px;
  68. box-shadow: 0 0 0 1px purple;
  69. padding: 8px;
  70. }
  71. </style>