在我的应用程序中,我的登陆页面上有loginButtons。我希望用户在成功登录后被自动重定向到/home路由。
这段代码似乎实现了这一点:
// Redirect to /home after logging in
Accounts.onLogin(function() {
Router.go("/home");
});
// Make sure the user is logged in when accessing other routes
Router.onBeforeAction((function() {
if (!Meteor.userId() &
考虑以下JS代码:
<script type="text/javascript">
$(function() {
// Check if landing on the page with a hash
if (window.location.hash.length) {
$('html,body').animate({scrollTop: 200}, 100);
return false;
}
// Same-page anchors
$('a[href*=#]