fix(components): 修复 Check 和 Radio 组件中隐藏输入值
- 在 Check 和 Radio 组件中,将 hidden 输入框的值从布尔型改为字符串 - 确保表单提交时,值为 'true' 或 'false',而不是 true 或 false - 这个修改提高了与某些表单处理库的兼容性
This commit is contained in:
@@ -53,7 +53,7 @@ const Check: ParentComponent<CheckBoxProps> = (props) => {
|
|||||||
<Dynamic component={CheckIcon[internalChecked() ? 1 : 0]} />
|
<Dynamic component={CheckIcon[internalChecked() ? 1 : 0]} />
|
||||||
<div>{mProps.children}</div>
|
<div>{mProps.children}</div>
|
||||||
<Show when={isNotNil(mProps.name)}>
|
<Show when={isNotNil(mProps.name)}>
|
||||||
<input type="hidden" name={mProps.name} value={internalChecked()} />
|
<input type="hidden" name={mProps.name} value={internalChecked() ? 'true' : 'false'} />
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -53,7 +53,7 @@ const Radio: ParentComponent<RadioProps> = (props) => {
|
|||||||
<Dynamic component={RadioIcon[internalChecked() ? 1 : 0]} />
|
<Dynamic component={RadioIcon[internalChecked() ? 1 : 0]} />
|
||||||
<div>{mProps.children}</div>
|
<div>{mProps.children}</div>
|
||||||
<Show when={isNotNil(mProps.name)}>
|
<Show when={isNotNil(mProps.name)}>
|
||||||
<input type="hidden" name={mProps.name} value={internalChecked()} />
|
<input type="hidden" name={mProps.name} value={internalChecked() ? 'true' : 'false'} />
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user