fix: 修复 TabPanel.add_tab 的 add_removeable bug

This commit is contained in:
p 2026-08-14 17:00:02 +08:00
parent 7b7d76f4aa
commit a7f39d9ea0

View File

@ -5,6 +5,12 @@
if (bricks.TabPanel.prototype._dyn_patched) return;
bricks.TabPanel.prototype._dyn_patched = true;
// 修复原生 add_tab 的 bugthis.add_removeable 不存在(应为 toolbar.add_removable
// 且 createTool 内部已调用 add_removable这里只需创建 tool 按钮
bricks.TabPanel.prototype.add_tab = function(desc){
this.toolbar.createTool(desc);
};
// 动态打开 tab已存在opts.items 同名)则切换,不存在则新增
bricks.TabPanel.prototype.open_tab = async function(desc){
// 1. 已存在判断opts.items 里找同名(不用 content_buffer因 content 可能构建失败)