atNavButton 将按钮文本更改为流星用户帐户中的图标

atNavButton change button text to icon in meteor-useraccounts

我刚刚开始使用 Meteor 框架,并且正在基于这些 boilerplaters.

创建一个符号 in/register 表单

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

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

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

我认为你不能用 meteor-useraccounts at the moment (see 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");
}