Javascript 使用用户帐户设置页面标题:flow router
我刚刚开始真正深入研究Meteor并开始一些个人项目,但我偶然发现了一些我还没有找到答案的东西。我正在尝试设置用于登录、注册等的页面标题。是否有解决方案?我在文档中没有看到可以在这些配置语句中添加选项的地方 这是我的Javascript 使用用户帐户设置页面标题:flow router,javascript,meteor,meteor-accounts,flow-router,Javascript,Meteor,Meteor Accounts,Flow Router,我刚刚开始真正深入研究Meteor并开始一些个人项目,但我偶然发现了一些我还没有找到答案的东西。我正在尝试设置用于登录、注册等的页面标题。是否有解决方案?我在文档中没有看到可以在这些配置语句中添加选项的地方 这是我的routes.jsx文件: AccountsTemplates.configureRoute("changePwd"); AccountsTemplates.configureRoute("forgotPwd"); AccountsTemplates.configureRoute("
routes.jsx
文件:
AccountsTemplates.configureRoute("changePwd");
AccountsTemplates.configureRoute("forgotPwd");
AccountsTemplates.configureRoute("resetPwd");
AccountsTemplates.configureRoute("signIn");
AccountsTemplates.configureRoute("signUp");
AccountsTemplates.configureRoute("verifyEmail");
谢谢 您应该能够通过以下方式完成此任务:
FlowRouter.triggers.enter([function(){
document.title = FlowRouter.current().path;
]);
这将设置页面标题=所有路由的路由路径。如果需要特定于路线的标题,则可以在每条路线上分别添加触发器 这是可行的,我尝试对其进行调整,以便
document.title=FlowRouter.current().name代码>但它总是返回未定义的
。我还更新了AccountsTemplates.configureRoute(“signIn”)
toAccountsTemplates.configureRoute(“signIn”,{name:'Sign-In'})代码>我现在开始工作了name
是route
的子级,因此我使用的代码是FlowRouter.triggers.enter([function(){document.title=FlowRouter.current().route.name;}])代码>