设置单个tab内容

setTabCon('tab名', 'tab内容')

  1. $tab_list = [
  2. 'tabs-1' => '<i class="fa fa-fw fa-coffee"></i> Tab1',
  3. 'tabs-2' => '<i class="fa fa-fw fa-line-chart"></i> Tab2'
  4. ];
  5. $recent_list = [
  6. [
  7. 'title' => '最近编辑文件',
  8. 'link' => [
  9. 'title' => '<i class="fa fa-file-text-o"></i> Documentation.doc',
  10. 'url' => url('index')
  11. ],
  12. 'tips' => '15 分钟前',
  13. 'icon' => 'si si-pencil text-info'
  14. ],
  15. [
  16. 'title' => '最近删除文件',
  17. 'link' => [
  18. 'title' => '<i class="fa fa-file-text-o"></i> Documentation2.doc',
  19. 'url' => url('index')
  20. ],
  21. 'tips' => '4 小时前',
  22. 'icon' => 'si si-close text-danger'
  23. ]
  24. ];
  25. $settings = [
  26. [
  27. 'title' => '站点开关',
  28. 'tips' => '站点关闭后将不能访问',
  29. 'checked' => Db::name('admin_config')->where('id', 1)->value('value'),
  30. 'table' => 'admin_config',
  31. 'id' => 1,
  32. 'field' => 'value'
  33. ]
  34. ];
  35. ZBuilder::make('aside')
  36. ->setTabNav($tab_list, 'tabs-1')
  37. ->setTabCon('tabs-1', [
  38. ['recent', '最近事项', $recent_list]
  39. ])
  40. ->setTabCon('tabs-2', [
  41. ['switch', '系统设置', $settings]
  42. ]);

这样就可以切换不同的tab,显示不同的内容。

设置单个tab内容 - 图1

设置单个tab内容 - 图2

一个tab内容可设置多项内容

  1. ZBuilder::make('aside')
  2. ->setTabNav($tab_list, 'tabs-1')
  3. ->setTabCon('tabs-1', [
  4. ['recent', '最近事项', $recent_list],
  5. ['switch', '系统设置', $settings]
  6. ]);