chore(docs): cleanup layouting example
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user