chore(docs): cleanup layouting example

This commit is contained in:
braks
2024-02-07 22:42:42 +01:00
parent a99c620b18
commit dc8faecd8c
3 changed files with 11 additions and 7 deletions

View File

@@ -1,5 +1,5 @@
<script setup>
import { computed, ref, toRef, watch } from 'vue'
import { computed, nextTick, ref, toRef, watch } from 'vue'
import { BaseEdge, EdgeLabelRenderer, Position, getSmoothStepPath, useNodesData } from '@vue-flow/core'
import { TransitionPresets, executeTransition } from '@vueuse/core'
@@ -94,9 +94,11 @@ watch(isFinished, async (isFinished) => {
if (isFinished) {
await runAnimation()
edgePoint.value = 0
currentLength.value = 0
labelPosition.value = { x: 0, y: 0 }
nextTick(() => {
edgePoint.value = 0
currentLength.value = 0
labelPosition.value = { x: 0, y: 0 }
})
}
})
@@ -107,7 +109,9 @@ async function runAnimation() {
return
}
isAnimating.value = true
nextTick(() => {
isAnimating.value = true
})
const totalLength = pathEl.getTotalLength()

View File

@@ -77,7 +77,7 @@ const processLabel = toRef(() => {
<Handle v-if="!isSender" type="target" :position="targetPosition" />
<Handle v-if="!isReceiver" type="source" :position="sourcePosition" />
<div v-if="data.isRunning" class="spinner" />
<div v-if="!isSender && data.isRunning" class="spinner" />
<span v-else>
{{ processLabel }}
</span>

View File

@@ -37,7 +37,7 @@ export function useRunProcess(dagreGraph) {
// Randomly decide whether the node will throw an error
const willThrowError = Math.random() < 0.15
if (willThrowError) {
if (!isStart && willThrowError) {
updateNodeData(node.id, { isRunning: false, hasError: true })
await skipDescendants(node.id)