'boolean', 'labelPosition' => 'string', 'labelWidth' => 'number', 'showMessage' => 'boolean', ]; /** * FormStyle constructor. * * @param bool $inline * @param string $labelPosition * @param int $labelWidth * @param bool $showMessage * @param string $autocomplete */ public function __construct($inline = false, $labelPosition = 'right', $labelWidth = 125, $showMessage = true, $autocomplete = 'off') { $this->props = compact('inline', 'labelPosition', 'labelWidth', 'showMessage'); $this->autocomplete($autocomplete); } /** * 原生的 autocomplete 属性,可选值为 true = off 或 false = on * * @param bool $bool * @return $this */ public function autocomplete($bool = false) { $this->props['autocomplete'] = $bool === false ? 'on' : 'off'; return $this; } /** * @return array */ public function build() { return $this->props; } }