* zin: add buildItem.
This commit is contained in:
@@ -16,7 +16,7 @@ foreach(\customModel::getMainMenu() as $menuItem)
|
||||
|
||||
page
|
||||
(
|
||||
set ('title', $title),
|
||||
set('title', $title),
|
||||
pageheader
|
||||
(
|
||||
pageheading
|
||||
@@ -29,21 +29,18 @@ page
|
||||
(
|
||||
zuinav
|
||||
(
|
||||
set('js-render', true),
|
||||
set('js-render', false),
|
||||
set('items', $navItems),
|
||||
item(array('text' => 'text')),
|
||||
),
|
||||
),
|
||||
toolbar
|
||||
(
|
||||
setId('toolbar'),
|
||||
set('js-render', true),
|
||||
set('items', array
|
||||
(
|
||||
array('icon' => 'icon-plus'),
|
||||
array('icon' => 'icon-group'),
|
||||
array('text' => '研发综合界面'),
|
||||
)
|
||||
),
|
||||
item(array('icon' => 'icon-plus')),
|
||||
item(array('icon' => 'icon-group')),
|
||||
item(array('text' => '研发综合界面')),
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
+35
-1
@@ -3,14 +3,48 @@ namespace zin\wg;
|
||||
|
||||
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'wg.class.php';
|
||||
|
||||
use \zin\core\h5;
|
||||
|
||||
class toolbar extends \zin\core\wg
|
||||
{
|
||||
static $tag = 'div';
|
||||
|
||||
static $defaultProps = array('class' => 'toolbar', 'id' => 'toolbar');
|
||||
static $defaultProps = array('id' => 'toolbar');
|
||||
|
||||
static $customProps = 'wrap,gap,items,btnProps,itemRender,beforeRender,afterRender,firstRender';
|
||||
|
||||
protected function itemsWrapper()
|
||||
{
|
||||
return h5::nav()->addClass('toolbar');
|
||||
}
|
||||
|
||||
protected function buildItem($item)
|
||||
{
|
||||
if ($item['type'] === 'divider') return h5::div()->addClass('toolbar-divider');
|
||||
|
||||
$button = h5::button()->addClass('btn toolbar-item ghost');
|
||||
$a = h5::a();
|
||||
if ($item['active'])
|
||||
{
|
||||
$a->addClass('active');
|
||||
}
|
||||
$url = $item['url'];
|
||||
if (!empty($url))
|
||||
{
|
||||
$a->prop('href', "$url");
|
||||
}
|
||||
$button->append($a);
|
||||
$icon = $item['icon'];
|
||||
if (!empty($icon))
|
||||
{
|
||||
$i = h5::i()->addClass("icon icon-$icon");
|
||||
$a->append($i);
|
||||
}
|
||||
$span = h5::span($item['text'])->addClass('text');
|
||||
$a->append($span);
|
||||
return $button;
|
||||
}
|
||||
|
||||
protected function build($isPrint = false, $parent = null)
|
||||
{
|
||||
$builder = parent::build($isPrint, $parent);
|
||||
|
||||
@@ -5,6 +5,8 @@ require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'wg.class.php';
|
||||
require_once dirname(dirname(__DIR__)) . DS . 'core' . DS . 'h5.class.php';
|
||||
require_once dirname(__DIR__) . DS . 'icon' . DS . 'v1.php';
|
||||
|
||||
use \zin\core\h5;
|
||||
|
||||
class zuinav extends \zin\core\wg
|
||||
{
|
||||
static $tag = 'div';
|
||||
@@ -15,6 +17,38 @@ class zuinav extends \zin\core\wg
|
||||
|
||||
public $cssList = array(':root{--nav-active-color: white;}');
|
||||
|
||||
protected function itemsWrapper()
|
||||
{
|
||||
return h5::menu()->addClass('nav');
|
||||
}
|
||||
|
||||
protected function buildItem($item)
|
||||
{
|
||||
if ($item['type'] === 'divider') return h5::li()->addClass('nav-divider');
|
||||
|
||||
$li = h5::li()->addClass('nav-item');
|
||||
$a = h5::a();
|
||||
if ($item['active'])
|
||||
{
|
||||
$a->addClass('active');
|
||||
}
|
||||
$url = $item['url'];
|
||||
if (!empty($url))
|
||||
{
|
||||
$a->prop('href', "$url");
|
||||
}
|
||||
$li->append($a);
|
||||
$icon = $item['icon'];
|
||||
if (!empty($icon))
|
||||
{
|
||||
$i = h5::i()->addClass("icon icon-$icon");
|
||||
$a->append($i);
|
||||
}
|
||||
$span = h5::span($item['text'])->addClass('text');
|
||||
$a->append($span);
|
||||
return $li;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return builder
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user