hyperf-view/builder/View/Components/Antv/Pie.php

52 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace Builder\View\Components\Antv;
use Builder\View\Components\Component;
class Pie extends Component
{
protected $componentName = "AntvPie";
protected $canvasId;
protected $data;
protected $config;
public function __construct()
{
$this->canvasId = \Hyperf\Utils\Str::random();
}
public static function make()
{
return new Pie();
}
/**
* 设置数据
* @param mixed $data
* @return $this
*/
public function data($data)
{
if ($data instanceof \Closure) {
$this->data = call_user_func($data);
} else {
$this->data = $data;
}
return $this;
}
/**
* 设置配置信息
* @param mixed $config
* @return $this
*/
public function config($config)
{
if ($config instanceof \Closure) {
$this->config = call_user_func($config);
} else {
$this->config = $config;
}
return $this;
}
}