fix(tab): 首屏tab无active高亮——Toolbar.createTools完成后从不dispatch('ready')(TabPanel的ready绑定是死绑定),show_first_tab走dispatch('command')绕过do_handle高亮逻辑;修法:createTools末尾广播ready+show_first_tab在按钮已建好时改走toolbar.click(2026-09-08,playwright实测首屏home tab高亮+全量回归过)
This commit is contained in:
parent
93c8cac5bc
commit
69a41fac54
@ -138,7 +138,18 @@ bricks.TabPanel = class extends bricks.Layout {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.toolbar.dispatch('command', this.opts.items[0]);
|
||||
var first = this.opts.items[0];
|
||||
if (!first) return;
|
||||
// 按钮已建好(Toolbar createTools 完成后的 ready 再入)→ click 走 do_handle:
|
||||
// 内容切换 + active 高亮一起更新;按钮还没建好(constructor 首次同步调用)→
|
||||
// dispatch command 先加载内容,高亮由 ready 后的 click 补上
|
||||
for (var i=0;i<this.toolbar.toolList.length;i++){
|
||||
if (this.toolbar.toolList[i].tool_opts.name === first.name){
|
||||
this.toolbar.click(first.name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.toolbar.dispatch('command', first);
|
||||
}
|
||||
createToolbar(){
|
||||
var desc = {
|
||||
|
||||
@ -55,6 +55,9 @@ bricks.Toolbar = class extends bricks.Layout {
|
||||
this.add_interval_box();
|
||||
}
|
||||
}
|
||||
// 全部 tool 建好后广播 ready(TabPanel 借此在按钮存在后补首 tab 高亮,
|
||||
// 2026-09-08:此前首屏 dispatch('command') 绕过 do_handle,首个 tab 从无 active 样式)
|
||||
this.dispatch('ready', {});
|
||||
}
|
||||
async createTool(desc){
|
||||
var options = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user