name = $name; $this->field = $field; $this->has = $has; } /** * 文本类型 * @param $name * @return $this */ public function type($name): self { $this->type = $name; return $this; } /** * 前置图标 * @param $content * @return $this */ public function beforeIcon($content): self { $this->before = (new Icon($content))->attr('vSlot:prepend', '')->getRender(); return $this; } /** * 后置图标 * @param $content * @return $this */ public function afterIcon($content): self { $this->after = (new Icon($content))->attr('vSlot:append', '')->getRender(); return $this; } /** * 前置文本 * @param $content * @return $this */ public function beforeText($content): self { $this->before = [ 'vSlot:prepend' => '', 'nodeName' => 'span', 'child' => $content ]; return $this; } /** * 后置文本 * @param $content * @return $this */ public function afterText($content): self { $this->after = [ 'vSlot:append' => '', 'nodeName' => 'span', 'child' => $content ]; return $this; } /** * @return array */ public function render(): array { $child = []; if ($this->before || $this->after) { $child = [ $this->before, $this->after ]; } $data = [ 'nodeName' => 'a-input', 'vModel:modelValue' => $this->getModelField(), 'child' => $child, 'placeholder' => '请输入' . $this->name ]; if($this->replace != ''){ $data['vStringReplace'] = $this->replace; } return $data; } }