Skip to content

Commit 1d0f3c8

Browse files
committed
fix: 修复 Checkbox 回传 state 值始终有值问题
1 parent a4084e7 commit 1d0f3c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/BootstrapBlazor/Components/Checkbox/Checkbox.razor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ export function init(id, invoke, method) {
1414
}
1515

1616
const state = el.getAttribute("data-bb-state");
17+
let val = null;
1718
if (state) {
19+
val = state == "1" ? 0 : 1;
1820
el.removeAttribute('data-bb-state');
1921

2022
if (state === "1") {
@@ -24,7 +26,7 @@ export function init(id, invoke, method) {
2426
el.parentElement.classList.add('is-checked');
2527
}
2628
}
27-
const result = await invoke.invokeMethodAsync(method, state == "1" ? 0 : 1);
29+
const result = await invoke.invokeMethodAsync(method, val);
2830
if (result === false) {
2931
e.preventDefault();
3032
}

0 commit comments

Comments
 (0)