## setTabNav('tab列表', '当前tab') 先来个例子 ~~~ public function index($group = 'tab1') { $list_tab = [ 'tab1' => ['title' => '标题1', 'url' => url('index', ['group' => 'tab1'])], 'tab2' => ['title' => '标题2', 'url' => url('index', ['group' => 'tab2'])], ]; return ZBuilder::make('form') ->setTabNav($list_tab, $group) ->fetch(); } ~~~ 效果: ![](https://box.kancloud.cn/d386e45e11e4f625a4601de92d1a2f96_432x226.png) >[danger] 注意:此tab切换并非动态切换,而是跳转页面。 这样可以根据不同的接收到的group参数来分别显示不同的内容,比如: ~~~ public function index($group = 'tab1') { $list_tab = [ 'tab1' => ['title' => '标题1', 'url' => url('index', ['group' => 'tab1'])], 'tab2' => ['title' => '标题2', 'url' => url('index', ['group' => 'tab2'])], ]; switch ($group) { case 'tab1': return ZBuilder::make('form') ->setTabNav($list_tab, $group) ->addText('name', '名称') ->fetch(); break; case 'tab2': return ZBuilder::make('form') ->setTabNav($list_tab, $group) ->addTextarea('summary', '摘要') ->fetch(); break; } } ~~~ 两个页面如下: ### tab1页面 ![](https://box.kancloud.cn/fd11811e60606b628e82309a3c03ed7d_1239x177.png) ### tab2页面 ![](https://box.kancloud.cn/b55f6fed3c9fb1cb5e69d23cdedb02c6_1267x277.png)