初始化仓库
This commit is contained in:
62
admin/components/UI/Form/Textarea.php
Normal file
62
admin/components/UI/Form/Textarea.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace admin\components\UI\Form;
|
||||
|
||||
/**
|
||||
* Class Textarea
|
||||
* 多行输入框
|
||||
* @package backend\components\UI\Form
|
||||
*/
|
||||
class Textarea extends Element implements Component
|
||||
{
|
||||
protected int $limit = 0;
|
||||
|
||||
/**
|
||||
* 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 $num
|
||||
* @return $this
|
||||
*/
|
||||
public function limit($num): self
|
||||
{
|
||||
$this->limit = $num;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function render(): array
|
||||
{
|
||||
$data = [
|
||||
'nodeName' => 'a-textarea',
|
||||
'vModel:modelValue' => $this->getModelField(),
|
||||
'placeholder' => $this->attr['placeholder'] ?: '请输入' . $this->name,
|
||||
'allowClear' => true,
|
||||
'showWordLimit' => true
|
||||
];
|
||||
if ($this->limit) {
|
||||
$data['maxLength'] = $this->limit;
|
||||
}
|
||||
|
||||
if($this->replace != ''){
|
||||
$data['vStringReplace'] = $this->replace;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user