參考文獻元件

<BaseEdge />

GitHub 上的原始碼

<BaseEdge /> 元件在內部用於所有邊緣。它可以用在自訂邊緣內部,並為您處理不可見的輔助邊緣和邊緣標籤。

CustomEdge.svelte
<script lang="ts">
  import { BaseEdge, getStraightPath } from '@xyflow/svelte';
 
  const [edgePath] = getStraightPath({
    sourceX,
    sourceY,
    targetX,
    targetY,
  });
</script>
 
<BaseEdge path={edgePath} {...$$props} />

Props

#id
string
#interactionWidth
number
#path
string
#style
string
#class
string
#markerStart
string
#markerEnd
string
#label
string
#labelX
number
#labelY
number
#labelStyle
string

注意事項

  • 如果您想在 <BaseEdge /> 元件中使用邊緣標記,您可以將傳遞到自訂邊緣的 markerStartmarkerEnd props 傳遞到 <BaseEdge /> 元件。您可以透過查看 EdgeProps 類型來查看傳遞給自訂邊緣的所有 props。