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.

警告

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

¥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 { 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使用 Minimap 进行拖动平移booleantruefalse
zoomable使用 Minimap 进行滚轮缩放booleantruefalse

插槽

¥Slots

名称定义属性默认
node-${node.type}迷你地图节点槽位MiniMapNodePropsMiniMapNode

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