初始化仓库
This commit is contained in:
53
admin/components/UI/Form/Time.php
Normal file
53
admin/components/UI/Form/Time.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace admin\components\UI\Form;
|
||||
|
||||
/**
|
||||
* Class Time
|
||||
* 时间选择器
|
||||
* @package backend\components\UI\Form
|
||||
*/
|
||||
class Time extends Element implements Component
|
||||
{
|
||||
protected string $string = 'HH:mm:ss';
|
||||
|
||||
/**
|
||||
* Text constructor.
|
||||
* @param string $name
|
||||
* @param string $field
|
||||
* @param string $has
|
||||
*/
|
||||
public function __construct(string $name, string $field, string $has = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->field = $field;
|
||||
$this->has = $has;
|
||||
$this->attr['placeholder'] = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间格式
|
||||
* @param string $format
|
||||
* @return $this
|
||||
*/
|
||||
public function string(string $format): self
|
||||
{
|
||||
$this->string = $format;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function render(): array
|
||||
{
|
||||
return [
|
||||
'nodeName' => 'a-time-picker',
|
||||
'allowClear' => true,
|
||||
'format' => $this->string,
|
||||
'placeholder' => $this->attr['placeholder'] ?: '请选择' . $this->name,
|
||||
'vModel:model-value' => $this->getModelField()
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user