* zin: support for setting active of first tabPane automatically.
This commit is contained in:
@@ -115,25 +115,27 @@ class tabs extends wg
|
||||
|
||||
$this->filterChildren();
|
||||
|
||||
$titleViews = array();
|
||||
$contentViews = array();
|
||||
$titleViews = array();
|
||||
$tabPanes = array();
|
||||
$hasActived = false;
|
||||
foreach($this->tabPanes as $tabPane)
|
||||
{
|
||||
$titleViews[] = $this->buildTitleView($tabPane);
|
||||
if($tabPane->prop('divider')) $titleViews[] = div(set::className('divider'));
|
||||
if($tabPane->prop('active')) $hasActived = true;
|
||||
|
||||
$divider = $tabPane->block('divider');
|
||||
if($divider) $titleViews[] = div(set::className('divider'));
|
||||
|
||||
$contentViews[] = $tabPane;
|
||||
$tabPanes[] = $tabPane;
|
||||
}
|
||||
|
||||
if(!$hasActived && !empty($tabPanes)) $tabPanes[0]->setProp('active', true);
|
||||
|
||||
return div
|
||||
(
|
||||
setClass('tabs', $isVertical ? 'flex' : null),
|
||||
set($this->getRestProps()),
|
||||
|
||||
$this->buildTabHeader($titleViews),
|
||||
$this->buildTabBody($contentViews),
|
||||
$this->buildTabBody($tabPanes),
|
||||
$this->children
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user