Skip to content

Commit d986328

Browse files
committed
doc(Template5): 更新脚本增加自动获得焦点功能
1 parent b6d1fee commit d986328

File tree

1 file changed

+9
-0
lines changed
  • src/BootstrapBlazor.Server/Components/Samples/Tutorials/LoginAndRegister

1 file changed

+9
-0
lines changed

src/BootstrapBlazor.Server/Components/Samples/Tutorials/LoginAndRegister/Template5.razor.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
const email = el.querySelector('.login-item-email');
55
if (email) {
66
email.classList.add('show');
7+
const input = email.querySelector('.input');
8+
input.focus();
9+
input.select();
710
}
811
}
912
}
@@ -23,6 +26,9 @@ export function go(id) {
2326
password.classList.add('show');
2427
password.classList.add('animate-fade-in')
2528
password.classList.remove('animate-fade-out')
29+
const input = password.querySelector('.input');
30+
input.focus();
31+
input.select();
2632
}
2733
}
2834
}
@@ -35,6 +41,9 @@ export function back(id) {
3541
email.classList.add('show');
3642
email.classList.remove('animate-fade-out');
3743
email.classList.add('animate-fade-in');
44+
const input = email.querySelector('.input');
45+
input.focus();
46+
input.select();
3847
}
3948

4049
const password = el.querySelector('.login-item-password');

0 commit comments

Comments
 (0)