Skip to content

MiniMap

安装

🌐 Installation

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

用法

🌐 Usage

要使用迷你地图,只需将 MiniMap 组件作为子组件传递给 VueFlow 组件即可。

🌐 To use the minimap simply pass the MiniMap component as a child to the VueFlow component.

WARNING

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

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

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

<template>
  <VueFlow>
    <MiniMap />
  </VueFlow>
</template>

交互式迷你地图

🌐 Interactive MiniMap

可以通过使用 pannablezoomable 属性使迷你地图具有交互性。

🌐 The minimap can be made interactive by using the pannable and zoomable props.

vue
<template>
  <VueFlow>
    <MiniMap pannable zoomable />
  </VueFlow>
</template>

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

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

属性

🌐 Props

名称定义类型可选默认
nodeColor节点背景颜色字符串,MiniMapNodeFunctrue#fff
nodeStrokeColor边框颜色字符串,MiniMapNodeFunctrue#555
nodeClassName额外类字符串,MiniMapNodeFunctrue-
nodeBorderRadius边框圆角numbertrue5
nodeStrokeWidth笔画宽度numbertrue2
maskColor小地图背景颜色stringtruergb(240, 242, 243, 0.7)
pannable使用小地图拖动进行平移booleantruefalse
zoomable使用小地图滚轮缩放booleantruefalse

插槽

🌐 Slots

名称定义属性默认
node-${node.type}小地图节点槽MiniMapNodeProps小地图节点

VueFlow 中文网 - 粤ICP备13048890号