初始化仓库
This commit is contained in:
51
admin/components/UI/Widget/Alert.php
Normal file
51
admin/components/UI/Widget/Alert.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace admin\components\UI\Widget;
|
||||
|
||||
/**
|
||||
* 警告信息
|
||||
* @package backend\components\UI\Widget
|
||||
*/
|
||||
class Alert extends Widget
|
||||
{
|
||||
|
||||
protected string $type = 'info';
|
||||
private ?string $title;
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @param string|array $content
|
||||
* @param string|null $title
|
||||
* @param callable|null $callback
|
||||
*/
|
||||
public function __construct($content, string $title = null, callable $callback = NULL)
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->content = $content;
|
||||
$this->callback = $callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文本类型
|
||||
* @param $name
|
||||
* @return $this
|
||||
*/
|
||||
public function type($name): self
|
||||
{
|
||||
$this->type = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function render(): array
|
||||
{
|
||||
return [
|
||||
'nodeName' => 'a-alert',
|
||||
'title' => $this->title,
|
||||
'type' => $this->type,
|
||||
'child' => $this->content
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user