初始化仓库
This commit is contained in:
48
admin/components/UI/Form/Tel.php
Normal file
48
admin/components/UI/Form/Tel.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace admin\components\UI\Form;
|
||||
|
||||
/**
|
||||
* Class Tel
|
||||
* @package backend\components\UI\Form
|
||||
*/
|
||||
class Tel extends Element implements Component
|
||||
{
|
||||
protected Text $object;
|
||||
protected string $mask = '19999999999';
|
||||
|
||||
/**
|
||||
* @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->object = new Text($this->name, $this->field, $this->has);
|
||||
$this->object->afterIcon('phone');
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置掩码
|
||||
* @param $value
|
||||
* @return $this
|
||||
*/
|
||||
public function mask($value): self
|
||||
{
|
||||
$this->mask = (string) $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function render(): array
|
||||
{
|
||||
$this->object->attrArray($this->attr);
|
||||
return $this->object->getRender();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user