ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
~~~ //构建页面 return $this->TBuilder('custom',$this) ->addTopBarMenus([ ['title' => '表头','href'=>url('',['step'=>1]) ], ['title' => '内容','is_active' => true], ['title' => '分析','href'=>url('',['step'=>3]) ], ['title' => '外观','href'=>url('',['step'=>4]) ], ['title' => '提交后','href'=>url('',['step'=>5]) ], ['title' => '全局设置','href'=>url('',['step'=>6]) ], ['title' => '发布','href'=>url('',['step'=>7]) ], ]) ->addTopBarButton([ 'type' => 'edit', 'title' => '上一步', 'item_class'=> '', 'attr' => ['target-form'=>'form-horizontal-topic'], 'icon_class'=> 'fa fa-arrow-left', 'href' => 'javascript:;', ]) ->addTopBarButton([ 'type' => 'edit', 'title' => '下一步', 'item_class'=> '', 'attr' => ['target-form'=>'form-horizontal-topic'], 'icon_class'=> 'fa fa-arrow-right', 'href' => 'javascript:;', ]) ->addTopBarButton([ 'type' => 'edit', 'title' => '保存', 'item_class'=> 'btn-primary ajax-post save_project_edit', 'attr' => ['target-form'=>'form-horizontal-topic'], 'icon_class'=> 'fa fa-floppy-o', 'href' => 'javascript:;', ]) ->setCustomView( $projectEditGroupInfo['custom_view'] ) ->recordWidgets([['art-template'],['mCustomScrollbar']]) ->hideFooter() ->assign( ['list'=>$list] ) ->fetch(); ~~~ **addTopBarMenus**方法用于设置topbar顶部菜单 ![](https://box.kancloud.cn/29772a1da886bb155d13fe641a289adf_1142x332.png) ### 高亮规则 一、控制器(CN)、方法(AN)匹配 ~~~ addTopBarMenus([ ['title' => '选择明细视图','href' => url('answer/showAnswerDetail',['answer_id'=>$answer_id] ),'active_rule'=>'AN','active_val'=>'showAnswerDetail' ], ['title' => '分值统计视图','href' => url('answer/showAnswerStatistics',['answer_id'=>$answer_id] ),'active_rule'=>'AN','active_val'=>'showAnswerStatistics' ], ]) ~~~ 二、url参数匹配 ~~~ addTopBarMenus([ ['title' => '表头','href'=>url('',['step'=>1]) ,'active_key'=>'step','active_val'=>'1' ], ['title' => '内容','href'=>url('',['step'=>2]) ,'active_key'=>'step','active_val'=>'2' ], ]) ~~~ 三、指定 ~~~ addTopBarMenus([ ['title' => '表头','href'=>url('',['step'=>1]) ], ['title' => '内容','is_active' => true], ]) ~~~ ### 设置topbar右侧按钮 **addTopBarButton**方法用于设置topbar右侧按钮 ~~~ ->addTopBarButton([ 'type' => 'edit', 'title' => '上一步', 'item_class'=> 'hide', 'attr' => ['target-form'=>'form-horizontal-topic'], 'icon_class'=> 'fa fa-arrow-left', 'href' => 'javascript:;', ]) ->addTopBarButton([ 'type' => 'edit', 'title' => '下一步', 'item_class'=> 'hide', 'attr' => ['target-form'=>'form-horizontal-topic'], 'icon_class'=> 'fa fa-arrow-right', 'href' => 'javascript:;', ]) ->addTopBarButton([ 'type' => 'edit', 'title' => '保存', 'item_class'=> 'btn-primary ajax-post save_project_edit no-refresh', 'attr' => ['target-form'=>'form-horizontal'], 'icon_class'=> 'fa fa-floppy-o', 'href' => 'javascript:;', ]) ~~~ ![](https://box.kancloud.cn/2e41ef3d47c330417ba8ca99100f0ad3_1676x265.png)