javascript - atNavButton 将按钮文本更改为 meteor 用户帐户中的图标

标签 javascript meteor meteor-accounts

我刚刚开始使用 Meteor 框架并基于这些 boilerplaters 创建了一个登录/注册表单.

我想将 navSignIn 按钮上的文本从文本更改为图标。我试过:

AccountsTemplates.configure({
    texts: {
        navSignIn: "fa fa-rocket"
    }
});

然而,这不会显示图标,我不确定在配置文件中还有什么地方可以更改它。这可以在哪里完成?

最佳答案

我认为您不能在 meteor-useraccounts 中用图标替换文本目前(参见 GitHub issue #233)。

但是,您可以创建自定义模板并使用 aldeed:template-extension包替换对应模板:

  1. 运行 meteor add aldeed:template-extension
  2. 创建以下模板:

<template name="atNavButtonFa">
    <button type="button" id="at-nav-button" class="btn btn-default navbar-btn"><i class="fa fa-rocket"></i></button>
</template>
  1. 添加以下代码以替换 atNavButton 模板:

if (Meteor.isClient) {
    Template.atNavButtonFa.replaces("atNavButton");
}

关于javascript - atNavButton 将按钮文本更改为 meteor 用户帐户中的图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33305332/

相关文章:

javascript - 为什么要使用命名函数表达式?

Javascript 函数作用域问题

meteor - 部署到 Meteor.com 有哪些限制?

javascript - 关于更改 View 和将数组放入集合中的问题 Meteor

javascript - Meteor 1.8.1 SSL 双连接

javascript - 使用数组数组对键值对对象数组进行排序

javascript - 在 React Native 中迭代 JSON

meteor - 在 Meteor 上使用 Velocity 和 jasmine 进行客户端集成测试

javascript - 使用meteor js用户注册成功后发送电子邮件

meteor - 我如何在 typescript 中导入 meteor 角色?