Skip to content

节点调整器

¥Node Resizer

这是一个 Vue Flow 的调整器组件。它可用于调整节点大小。

¥This is a resizer component for Vue Flow. It can be used to resize your nodes.

安装

¥Installation

bash
yarn add @vue-flow/node-resizer
  
# or
npm install @vue-flow/node-resizer

用法

¥Usage

vue
<script setup>
import { ref } from 'vue'  
import { VueFlow } from '@vue-flow/core'
import initialNodes from './initialNodes'

// some nodes and edges
const nodes = ref(initialNodes)
</script>

<template>
  

<VueFlow :nodes="nodes">
    <template #node-custom="nodeProps">
      <CustomNode :data="nodeProps.data"  />
    </template>
  </VueFlow>


</template>
vue
<script lang="ts" setup>
import { Handle, Position } from '@vue-flow/core'
import { NodeResizer } from '@vue-flow/node-resizer'

// make sure to include the necessary styles!
import '@vue-flow/node-resizer/dist/style.css'

defineProps(['data'])
</script>

<template>
  <NodeResizer min-width="100" min-height="30" />

  <Handle type="target" :position="Position.Left" />
  <Handle type="source" :position="Position.Right" />
</template>

启用后,这些属性允许你使用迷你地图在拖动时平移,在滚动时缩放。

¥When enabled, these props allow you to pan on drag and zoom on scroll using the MiniMap.

属性

¥Props

名称定义类型可选默认
nodeId要将调整器附加到的节点stringtrue来自上下文的节点 ID
color缩放线的颜色stringtrue*
handleClassName用于调整大小句柄的额外类stringtrue*
handleStyle用于调整大小句柄的附加样式CSSPropertiestrue*
lineClassName用于调整大小线条的额外类numbertrue*
lineStyle用于调整大小线条的附加样式stringtrue*
isVisible强制显示调整器booleantruetrue
minWidth调整器的最小宽度(无法调整到低于此值)numbertrue*
minHeight调整器的最小高度(无法调整到低于此值)numbertrue*

触发

¥Emits

名称
resizeStart
resize
resizeEnd

VueFlow v1.42 中文网 - 粤ICP备13048890号