Skip to content

Commit 52393be

Browse files
authored
Update FormHelper.php
1 parent b6befe4 commit 52393be

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/helper/FormHelper.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,23 @@ public function password(string $name, array $options = [])
9090
*/
9191
public function range($name, $options = [], $value = null)
9292
{
93-
return $this->input($name,'range', $options,$value);
93+
$label = $options['label'] ?? $name;
94+
$tips = $options['tips'] ?? $label;
95+
$placeholder = $options['placeholder'] ?? $tips;
96+
$value = !is_null($value) ? 'value="' . $value . '"' : '';
97+
$disorread = $this->readonlyOrdisabled($options) ? $this->readonlyOrdisabled($options) : $this->readonlyOrdisabled($options);
98+
$disorread = $disorread ? 'layui-disabled' : '';
99+
return ' <div class="layui-form-item"> '.$this->label($label, $options).'
100+
<div class="layui-input-block">
101+
<div class="layui-input-inline" style="width: 100px;">
102+
<input '. $this->verify($options) . $this->filter($options) . $this->readonlyOrdisabled($options) .' type="text" name="'.$name.'_min" placeholder="'.lang($placeholder).'" autocomplete="off" class="layui-input ' . $this->addClass($options) . ' ' . $disorread . '" ' . $value . '/>
103+
</div>
104+
<div class="layui-form-mid">-</div>
105+
<div class="layui-input-inline" style="width: 100px;">
106+
<input '. $this->verify($options) . $this->filter($options) . $this->readonlyOrdisabled($options) .' type="text" name="'.$name.'_max" placeholder="'.lang($placeholder).'" autocomplete="off" class="layui-input ' . $this->addClass($options) . ' ' . $disorread . '" ' . $value . '/>
107+
</div>
108+
</div>
109+
</div>';
94110
}
95111

96112
/**

0 commit comments

Comments
 (0)