Skip to content

控件

¥Controls

控制面板包含放大、缩小、适合视图和锁定/解锁按钮。

¥The control panel contains a zoom-in, zoom-out, fit-view and a lock/unlock button.

安装

¥Installation

bash
yarn add @vue-flow/controls

# or
npm install @vue-flow/controls

用法

¥Usage

要使用控件,只需将 Controls 组件作为子组件传递给 VueFlow 组件即可。

¥To use the controls simply pass the Controls component as a child to the VueFlow component.

警告

请确保你也导入了这些样式,因为它们不再是默认主题的一部分。

¥Make sure you also import the styles as these are not part of the default theme anymore.

vue
<script setup>
import { VueFlow } from '@vue-flow/core'
import { Controls } from '@vue-flow/controls'

// import default controls styles
import '@vue-flow/controls/dist/style.css'
</script>

<template>
  

<VueFlow>
    <Controls />
  </VueFlow>


</template>

属性

¥Props

名称定义类型可选默认
showZoom显示缩放按钮booleantruetrue
showFitView显示适合视图按钮booleantruetrue
showInteractive显示锁定交互按钮booleantruetrue
showZoom显示缩放按钮booleantruetrue
fitViewParams点击适合视图按钮时使用的参数FitViewParamstrue*

触发

¥Emits

名称定义
zoom-in点击放大按钮
zoom-out点击缩小按钮
fit-view点击适合视图按钮
interaction-change交互锁定/解锁

插槽

¥Slots

控制按钮

¥Control Buttons

名称定义
top默认按钮上方的插槽
control-zoom-in放大按钮
control-zoom-out缩小按钮
control-fit-view适合视图按钮
control-interactive交互按钮
default默认按钮下方的插槽

图标

¥Icons

名称定义
icon-zoom-in放大图标
icon-zoom-out缩小图标
icon-fit-view适合视图图标
icon-lock交互锁定图标
icon-unlock交互解锁图标

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