初始化仓库
This commit is contained in:
39
admin/components/UI/Widget.php
Normal file
39
admin/components/UI/Widget.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace admin\components\UI;
|
||||
|
||||
/**
|
||||
* 通用部件
|
||||
* Class Composite
|
||||
* @package backend\components\UI
|
||||
* @method static \backend\components\UI\Widget\Alert alert(string $content, string $title = null, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Badge badge($content, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Images images($list, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Form form($data, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Icon icon($content, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Link link($data, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Menu menu(string $name, string $type = 'default', callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Table table($data, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Text text($content, callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\Row row(callable $callback = NULL)
|
||||
* @method static \backend\components\UI\Widget\StatsCard statsCard(callable $callback = NULL)
|
||||
*/
|
||||
class Widget
|
||||
{
|
||||
|
||||
private static $extend;
|
||||
|
||||
public static function __callStatic($method, $arguments)
|
||||
{
|
||||
$class = 'backend\\components\\UI\\Widget\\' . ucfirst($method);
|
||||
if (!class_exists($class)) {
|
||||
if (!self::$extend[$method]) {
|
||||
throw new \RuntimeException('There is no widget method "' . $method . '"');
|
||||
} else {
|
||||
$class = self::$extend[$method];
|
||||
}
|
||||
}
|
||||
$object = new $class(...$arguments);
|
||||
return $object->next()->getRender();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user