eltree.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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!=null">
  21. <div class="custom-node icons" :id="`node-${node.id}`" >
  22. <img :src="props.node.data.image" alt="节点图片" />
  23. <span>{{props.node.data.label }}</span>
  24. </div>
  25. <Handle type="source" :position="Position.Right" />
  26. <Handle id="target-c" type="source" :position="Position.Top" />
  27. <Handle id="target-b" type="target" :position="Position.Left" />
  28. <Handle id="target-d" type="target" :position="Position.Bottom" />
  29. </div>
  30. </template>
  31. <style scoped>
  32. .icons img{
  33. width: 26px;
  34. }
  35. .icons span{
  36. display: block;
  37. font-size: 8px;
  38. }
  39. </style>
  40. <style>
  41. .vue-flow__node.draggable {
  42. width: 60px !important;
  43. height: 58px !important;
  44. border: none;
  45. background-color: rgba(0,0,0,0);
  46. }
  47. .vue-flow__node {
  48. stroke: none; /* 移除节点边框 */
  49. }
  50. .vue-flow__edge-text {
  51. display: none;
  52. }
  53. .vue-flow__node-custom {
  54. background: purple;
  55. color: white;
  56. border: 1px solid purple;
  57. border-radius: 4px;
  58. box-shadow: 0 0 0 1px purple;
  59. padding: 8px;
  60. }
  61. </style>