修复开关组件失效的问题

Signed-off-by: 七彩枫叶 <424235748@qq.com>
This commit is contained in:
七彩枫叶
2023-07-18 03:14:54 +00:00
committed by Gitee
parent 918a5253b2
commit 864f1afc95

View File

@@ -394,12 +394,11 @@ class FormBuilder
*/ */
public function switch(array $data = []): string public function switch(array $data = []): string
{ {
$value = $this->formtype ? '{$data.' . $data['name'] . '}' : '';
$param = '$data.' . $data['name']; $param = '$data.' . $data['name'];
if ($this->formtype) { if ($this->formtype) {
return <<<Eof return <<<Eof
<input type="hidden" type="checkbox" name="{$data['name']}" value="0" /> <input type="hidden" type="checkbox" name="{$data['name']}" value="0" />
<input type="checkbox" name="{$data['name']}" value="$value" <eq name="{$param}" value="1" > checked </eq> lay-skin="switch" /> <input type="checkbox" name="{$data['name']}" value="1" <eq name="{$param}" value="1" > checked </eq> lay-skin="switch" />
Eof; Eof;
} }
return <<<Eof return <<<Eof