self::TYPE_TIME, 'editable' => false, 'confirm' => true ]; /** * @var array */ protected static $propsRule = [ 'type' => 'string', 'format' => 'string', 'placement' => 'string', 'placeholder' => 'string', 'size' => 'string', 'confirm' => 'boolean', 'disabled' => 'boolean', 'clearable' => 'boolean', 'readonly' => 'boolean', 'editable' => 'boolean', 'transfer' => 'boolean', ]; /** * */ protected function init() { $this->placeholder('请选择' . $this->title); } /** * 下拉列表的时间间隔,数组的三项分别对应小时、分钟、秒。 * 例如设置为 [1, 15] 时,分钟会显示:00、15、30、45。 * @param $h * @param int $i * @param int $s * @return $this */ public function steps($h, $i = 0, $s = 0) { $this->props['steps'] = [$h, $i, $s]; return $this; } /** * @param $value * @return $this */ public function value($value) { if (is_array($value)) { foreach ($value as $k => $v) { $value[$k] = Helper::getDate($v); } } else { $value = Helper::getDate($value); } $this->value = $value; return $this; } /** * @return array */ public function build() { $value = $this->value; if (is_array($value) && count(array_filter($value)) == 0) $value = ['', '']; return [ 'type' => $this->name, 'field' => $this->field, 'title' => $this->title, 'value' => $value, 'props' => (object)$this->props, 'validate' => $this->validate, 'col' => $this->col ]; } }