name = $name; $this->field = $field; $this->has = $has; $this->attr['placeholder'] = null; } /** * 最大值 * @param int|float $default * @return $this */ public function max($default = 0): self { $this->max = $default; return $this; } /** * 最小值 * @param int|float $default * @return $this */ public function min($default = 0): self { $this->min = $default; return $this; } /** * 步进数值 * @param int|float $default * @param int|null $precision * @return $this */ public function step($default = 1, ?int $precision = null): self { $this->step = $default; $this->precision = $precision; return $this; } /** * @return array */ public function render(): array { $data = [ 'nodeName' => 'a-input-number', 'placeholder' => $this->attr['placeholder'] ?: '请输入' . $this->name, 'vModel:modelValue' => $this->getModelField(), 'step' => $this->step, 'min' => $this->min, 'mode' => 'button' ]; if ($this->max) { $data['max'] = $this->max; } if ($this->precision) { $data['precision'] = $this->precision; } if($this->replace != ''){ $data['vStringReplace'] = $this->replace; } return $data; } }