Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
saas-dml
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
saas-dml
Commits
fd51d195
提交
fd51d195
authored
4月 06, 2023
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 修改旅程连接线为折线
上级
ce2bf577
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
22 行增加
和
4 行删除
+22
-4
CustomEdge.vue
src/components/flow/CustomEdge.vue
+3
-3
Index.vue
src/components/flow/Index.vue
+19
-1
没有找到文件。
src/components/flow/CustomEdge.vue
浏览文件 @
fd51d195
<
script
setup
>
import
{
St
raightEdge
,
EdgeLabelRenderer
,
useVueFlow
,
getStraight
Path
}
from
'@vue-flow/core'
import
{
St
epEdge
,
EdgeLabelRenderer
,
useVueFlow
,
getSmoothStep
Path
}
from
'@vue-flow/core'
import
{
CircleCloseFilled
}
from
'@element-plus/icons-vue'
const
props
=
defineProps
({
...
...
@@ -19,7 +19,7 @@ const props = defineProps({
const
{
removeEdges
}
=
useVueFlow
()
const
path
=
computed
(()
=>
getS
traight
Path
(
props
))
const
path
=
computed
(()
=>
getS
moothStep
Path
(
props
))
const
labelColor
=
computed
(()
=>
props
.
style
?.
stroke
)
</
script
>
...
...
@@ -31,7 +31,7 @@ export default {
</
script
>
<
template
>
<St
raightEdge
:id=
"id"
:style=
"style"
:path=
"path[0]"
:marker-end=
"markerEnd"
:interactionWidth=
"2"
></Straight
Edge>
<St
epEdge
:id=
"id"
:style=
"style"
:path=
"path[0]"
:marker-end=
"markerEnd"
:interactionWidth=
"2"
></Step
Edge>
<EdgeLabelRenderer>
<div
class=
"edge-label"
:style=
"
{ transform: `translate(-50%, -50%) translate(${path[1]}px,${path[2]}px)` }">
<span
v-if=
"label"
:style=
"
{ color: labelColor }">
{{
label
}}
</span>
...
...
src/components/flow/Index.vue
浏览文件 @
fd51d195
...
...
@@ -6,6 +6,8 @@ export default {
<
script
setup
lang=
"ts"
>
import
{
nanoid
}
from
'nanoid'
import
type
{
GraphNode
}
from
'@vue-flow/core'
import
{
VueFlow
,
useVueFlow
,
PanelPosition
,
MarkerType
,
ConnectionLineType
}
from
'@vue-flow/core'
import
{
Controls
}
from
'@vue-flow/controls'
import
CustomNode
from
'./CustomNode.vue'
...
...
@@ -34,6 +36,16 @@ const onDragOver = (event: DragEvent) => {
}
}
function
getDirection
(
source
:
GraphNode
,
target
:
GraphNode
)
{
const
horizontalDistance
=
target
.
position
.
x
-
source
.
position
.
x
const
verticalDistance
=
target
.
position
.
y
-
source
.
position
.
y
if
(
Math
.
abs
(
horizontalDistance
)
>
Math
.
abs
(
verticalDistance
))
{
return
horizontalDistance
>
0
?
'right'
:
'left'
}
else
{
return
verticalDistance
>
0
?
'bottom'
:
'top'
}
}
onConnect
(
params
=>
{
const
map
:
any
=
{
'handle-yes'
:
{
label
:
'是'
,
style
:
{
stroke
:
'#81b337'
}
},
...
...
@@ -49,10 +61,16 @@ onConnect(params => {
stroke
:
'#5b6b73'
// strokeWidth: 2
}
const
sourceNode
=
findNode
(
params
.
source
)
const
targetNode
=
findNode
(
params
.
target
)
let
direction
=
'right'
if
(
sourceNode
&&
targetNode
)
{
direction
=
getDirection
(
sourceNode
,
targetNode
)
}
addEdges
([
{
...
params
,
sourceHandle
:
'handle-right'
,
sourceHandle
:
`handle-
${
direction
}
`
,
type
:
'custom'
,
markerEnd
:
MarkerType
.
ArrowClosed
,
style
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论