如下items.group9写法 自定义了两个按钮
- key应当唯一
- 更多控件写法,参考demo 。例如:ThinkEditor.editBar.js
- groupX其中X是可以自定义的,但需要和当前工具栏不重复
var thinkEditorEditBar = new ThinkEditorEditBar({
container: toolBarEditRef.value,
editorInstance: editorInstance1,
items: {
group9: [
[
{
name: "元素",
key: "用户自定义",
type: "btnText",
}, {
name: "元素1",
key: "用户自定义1",
type: "btnText",
},
],
],
group10: [
[
{
name: "元素",
key: "用户自定义3",
type: "btnText",
}
],
]
},
});
thinkEditorEditBar.onComponentAction = function (thinkEditor, args) {
console.log(args);
};
处理事件监听
未被内部消费的事件,将通过onComponentAction回调抛出,应用可以在该函数中,处理自己的业务
thinkEditorEditBar.onComponentAction = function (thinkEditor, args) {
console.log(args);
};
文档更新时间: 2025-09-07 22:35 作者:admin