跳到主要内容

api.detach()

描述​

用于移除/解绑事件处理程序

用法​

api.detach( tag: string ): void;

参数​

  • tag - (必填)操作标签的名称

事件​

信息

RichText 内部事件的完整列表可在此处查看

示例​

// 初始化 RichText
const editor = new richtext.Richtext("#root", {
// 配置属性
});

editor.api.on("set-font-size", (obj) => {
console.log(obj.fontSize);
}, { tag: "track" });

editor.api.detach("track");

更新日志: 该方法已在 v2.0 中更新。name 和 context 参数已被移除