add:新增table组件

This commit is contained in:
JaguarJack
2021-03-29 19:52:01 +08:00
parent 2f25a0892e
commit d4020b93a3
9 changed files with 1217 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace catcher\library\table\components;
class Button extends Component
{
protected $el = 'button';
public function icon(string $icon): Button
{
$this->attributes['icon'] = $icon;
return $this;
}
public function text(string $text): Button
{
$this->attributes['label'] = $text;
return $this;
}
public function style(string $style): Button
{
$this->attributes['class'] = $style;
return $this;
}
public function click(string $click): Button
{
$this->attributes['click'] = $click;
return $this;
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace catcher\library\table\components;
class Component
{
/**
* @var array
*/
protected $attributes = [];
protected $el;
public function __construct()
{
$this->attributes['el'] = $this->el;
}
/**
* 魔术方法
*
* @time 2021年03月21日
* @param $method
* @param $params
* @return $this
*/
public function __call($method, $params): Component
{
$this->attributes[$method] = $params[0];
return $this;
}
/**
* 输出
*
* @time 2021年03月23日
* @return array
*/
public function render()
{
return $this->attributes;
}
}