logo

X6

  • 文档
  • API
  • 图表示例
  • 常见问题
  • 更新日志
  • XFlow
  • 所有产品antv logo arrow
  • 2.x
  • 开始
    • 简介
    • 快速上手
  • 组件
    • XFlowGraph 画布
    • Background 背景
    • Grid 网格
    • Clipboard 复制粘贴
    • History 撤销重做
    • Minimap 小地图
    • Snapline 对齐线
    • Transform 图形变换
    • Control 控制器
  • Hook
    • useGraphInstance
    • useGraphStore
    • useGraphEvent
    • useDnd
    • useClipboard
    • useExport
    • useHistory
    • useKeyboard
  • Store

useClipboard

上一篇
useDnd
下一篇
useExport

Resources

Ant Design
Galacea Effects
Umi-React 应用开发框架
Dumi-组件/文档研发工具
ahooks-React Hooks 库

社区

体验科技专栏
seeconfSEE Conf-蚂蚁体验科技大会

帮助

GitHub
StackOverflow

more products更多产品

Ant DesignAnt Design-企业级 UI 设计语言
yuque语雀-知识创作与分享工具
EggEgg-企业级 Node 开发框架
kitchenKitchen-Sketch 工具集
GalaceanGalacean-互动图形解决方案
xtech蚂蚁体验科技
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

用于复制粘贴节点和边的 Hook

基础用法

const { copy, paste, cut } = useClipboard();

API

const {
copy: (ids, copyOptions) => void,
paste: (ids, cutOptions) => void,
cut: (pasteOptions) => void
} = useClipboard();

返回值

参数描述类型
copy复制元素(ids: string[], copyOptions?: CopyOptions) => void
paste渲染元素(ids: string[], cutOptions?: CopyOptions) => void
cut渲染元素(pasteOptions?: PasteOptions) => Cell[]

CopyOptions 参数如下

参数描述类型默认值
deep是否递归复制所有子节点/边。boolean-
useLocalStorage是否将复制的节点/边保存在 localStorage 中boolean-

PasteOptions 参数如下

参数描述类型默认值
offset粘贴到画布的节点/边的偏移量number | { dx: number; dy: number }20
useLocalStorage是否使用 localStorage 中的节点/边boolean-
nodeProps粘贴到画布的节点的额外属性Node.Properties-
edgeProps粘贴到画布的边的额外属性Edge.Properties-

参数

无