Skip to content

Commit 5c08e72

Browse files
committed
refactor: 移除 ?. 表达式
1 parent c546bfb commit 5c08e72

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

src/BootstrapBlazor/Components/DateTimePicker/DateTimePicker.razor.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export function init(id, invoke, options) {
1313
return el.classList.contains('disabled');
1414
},
1515
hideCallback: () => {
16-
invoke?.invokeMethodAsync(options.triggerHideCallback);
16+
if (invoke) {
17+
invoke.invokeMethodAsync(options.triggerHideCallback);
18+
}
1719
}
1820
});
1921
const dateTimePicker = {

src/BootstrapBlazor/Components/Table/Table.razor.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -425,18 +425,22 @@ const setExcelKeyboardListener = table => {
425425
}
426426
}
427427
else if (keyCode === KeyCodes.UP_ARROW) {
428-
cells = tr.previousElementSibling?.children;
429-
while (index < cells.length) {
430-
if (activeCell(cells, index)) {
431-
break;
428+
cells = tr.previousElementSibling && tr.previousElementSibling.children;
429+
if (cells) {
430+
while (index < cells.length) {
431+
if (activeCell(cells, index)) {
432+
break;
433+
}
432434
}
433435
}
434436
}
435437
else if (keyCode === KeyCodes.DOWN_ARROW) {
436-
cells = tr.nextElementSibling?.children;
437-
while (index < cells.length) {
438-
if (activeCell(cells, index)) {
439-
break;
438+
cells = tr.nextElementSibling && tr.nextElementSibling.children;
439+
if (cells) {
440+
while (index < cells.length) {
441+
if (activeCell(cells, index)) {
442+
break;
443+
}
440444
}
441445
}
442446
}

src/BootstrapBlazor/wwwroot/modules/fullscreen.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
export async function toggle(options) {
44
let el = null;
5-
if (options?.id) {
5+
options = options || {};
6+
if (options.id) {
67
el = document.getElementById(options.id);
78
}
8-
else if (options?.element && isElement(options.element)) {
9+
else if (options.element && isElement(options.element)) {
910
el = options.element;
1011
}
1112
else {

0 commit comments

Comments
 (0)