From 9d7970f58bbbab7aa84d02e0199f9b3f257404b3 Mon Sep 17 00:00:00 2001 From: wanghaigang Date: Thu, 7 Mar 2019 13:42:26 +0800 Subject: [PATCH] =?UTF-8?q?Formbuilder=E5=A2=9E=E5=8A=A0Slider=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/fast/Form.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/extend/fast/Form.php b/extend/fast/Form.php index 74cc43c75..0b25f3913 100644 --- a/extend/fast/Form.php +++ b/extend/fast/Form.php @@ -367,6 +367,23 @@ class FormBuilder return array_merge($options, array('cols' => $segments[0], 'rows' => $segments[1])); } + /** + * 生成滑块 + * + * @param string $name + * @param string $min + * @param string $max + * @param string $step + * @param string $value + * @param array $options + * @return string + */ + public function slider($name, $min, $max, $step, $value = null, $options = []) + { + $options = array_merge($options, ['data-slider-min' => $min, 'data-slider-max' => $max, 'data-slider-step' => $step,'data-slider-value' => $value ? $value : '']); + $options['class'] = isset($options['class']) ? $options['class'] . (stripos($options['class'], 'form-control') !== false ? '' : ' slider form-control') : 'slider form-control'; + return $this->input('text', $name, $value, $options); + } /** * 生成下拉列表框 * @@ -1277,4 +1294,4 @@ if (!function_exists('array_except')) { return Arr::except($array, $keys); } -} +} \ No newline at end of file -- Gitee