跳至主要内容

set-edit

描述

在切换编辑器时触发

用法

"set-edit": ({ cardId: string | number, eventSource?: "select-card" } | null) => void;

参数

set-edit 事件的回调函数可以接受 null 值,或者包含以下参数的对象:

  • cardId - (必需)要编辑的卡片 ID
  • eventSource - (可选)触发 set-edit 事件的 "select-card" 操作
注释

当关闭编辑器时,使用 null

信息

处理内部事件时,您可以使用事件总线方法

示例

// 创建看板
const board = new kanban.Kanban("#root", {
columns,
cards
});
// 当用户单击卡片时,阻止编辑
board.api.intercept("set-edit", (ev) => {
return ev?.eventSource != "select-card";
});

更新日志:

  • 该事件在 v1.2 版本中添加
  • eventSource 参数在 v1.6 版本中添加

相关示例: Kanban. 通过双击任务打开编辑器