如何在hbr文件中使用user字段?

我曾尝试让用户根据以下链接选择是否在桌面/移动设备页面上显示点赞数:

并想知道如何在 .hbr 文件中使用用户自定义字段,如下所示:

或者是否可以根据用户字段应用条件 CSS?

经过一些调查,我认为这是不可能的,因为 hbr 文件只知道传递到模板中的值,而我们无法将计算出的值传递给它?


  version="0.8">
  const testComponent = require('discourse/app/raw-views/list/posts-count-column').default;
  testComponent.reopen({
    user:  function() {
        return  Discourse.User.current()
    }.property()
  });
</script>

我尝试使用 repoen() 来修改 posts-count-column 组件以传递 currentUser 值,如下面的示例所示,但遇到了错误。我认为也许只有特定类型的组件支持此方法?

我找到了另一种方法,通过从上到下覆盖来将 currentUser 值传递到嵌套的 hbr 中,通过添加 {{raw "list/posts-count-column" topic=topic tagName="div" **user=user**}} 来插入值


        data-template-name='mobile/list/topic-list-item.raw’>
        data-template-name='list/post-count-or-badges.hbr'
        data-template-name="list/posts-count-column.hbr"

emberjs 是否有像 vue 那样的 provide/inject 函数来将值传递到嵌套模板?我搜索了一下,但没有找到太多信息。对此有什么建议吗?