Skip to content

Commit ec6d42b

Browse files
committed
refactor: 精简代码
1 parent 41a7328 commit ec6d42b

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/BootstrapBlazor/Components/Popover/Popover.razor.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ export function show(id, delay) {
1414
if (el) {
1515
const pop = bootstrap.Popover.getInstance(el);
1616
if (pop) {
17-
const handler = setTimeout(() => {
18-
clearTimeout(handler);
17+
setTimeout(() => {
1918
pop.show();
2019
}, delay || 0);
2120
}
@@ -27,8 +26,7 @@ export function hide(id, delay) {
2726
if (el) {
2827
const pop = bootstrap.Popover.getInstance(el);
2928
if (pop) {
30-
const handler = setTimeout(() => {
31-
clearTimeout(handler);
29+
setTimeout(() => {
3230
pop.hide();
3331
}, delay || 0);
3432
}
@@ -40,8 +38,7 @@ export function toggle(id, delay) {
4038
if (el) {
4139
const pop = bootstrap.Popover.getInstance(el);
4240
if (pop) {
43-
const handler = setTimeout(() => {
44-
clearTimeout(handler);
41+
setTimeout(() => {
4542
pop.toggle();
4643
}, delay || 0);
4744
}

src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ export function show(id, delay) {
2424
const tip = Data.get(id)
2525
const { tooltip } = tip;
2626

27-
const handler = setTimeout(() => {
28-
clearTimeout(handler);
27+
setTimeout(() => {
2928
tooltip.show();
3029
}, delay || 0);
3130
}
@@ -34,8 +33,7 @@ export function hide(id, delay) {
3433
const tip = Data.get(id)
3534
const { tooltip } = tip;
3635

37-
const handler = setTimeout(() => {
38-
clearTimeout(handler);
36+
setTimeout(() => {
3937
tooltip.hide();
4038
}, delay || 0);
4139
}
@@ -44,8 +42,7 @@ export function toggle(id, delay) {
4442
const tip = Data.get(id)
4543
const { tooltip } = tip;
4644

47-
const handler = setTimeout(() => {
48-
clearTimeout(handler);
45+
setTimeout(() => {
4946
tooltip.toggle();
5047
}, delay || 0);
5148
}

0 commit comments

Comments
 (0)