我的测试文档

155 阅读1分钟

tab页签

tab的数据以数组存在state中, 通过 useAppState('globalTabs') 获取。

useTab.tsx

包含对页签的增删等操作

引入

import { useTab } = '@src/components/TabBar/useTab.tsx';

主要api介绍

  1. addTab(props) 新增tab
  • icon: 页签前缀图标
  • Component: 页签关联内容区组件名
  • title: 页签名
  • type: 页签类型, datadev/shell/editor,
  • path: 页签关联内容区path, datadev/shell/editor/20220124123139749106
  • params: 页签关联内容区参数, 如工作流{ workflowId: '2a5f1056-7e82-11ec-a860-525400f55a20' } 任务{ taskId: '20220124123139749106' }
  • status: 页签状态, normal 默认、active 选中
  1. deleteTabByPath(path) 根据path删除tab, 如果path为null, 则删除当前
  • path: 要删除的tab path

内容区

内容区数据以Map存在state中, 通过 useAppState('globalContents') 获取。

useContent.tsx