# 增强的分类框显示组件

**URL:** https://meta.discourse.org/t/enhanced-category-box-display-component/156954
**Category:** Theme component
**Tags:** broken
**Created:** [2020年七月6日 20:05 UTC](https://meta.discourse.org/t/enhanced-category-box-display-component/156954 "2020-07-06T20:05:00Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![oca](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/oca/32/156060_2.png) [@oca](https://meta.discourse.org/u/oca)
#### Post date: [2020年十二月18日 21:59 UTC](https://meta.discourse.org/t/enhanced-category-box-display-component/156954/6 "2020-12-18T21:59:54Z")

</div>

[我曾遇到过困难](https://meta.discourse.org/t/can-parameters-be-injected-from-the-template-to-a-widget-action/155275/3)，但发现其实并不难。

在主题组件中，将你的 Handlebars 组件修改为包含以下代码：

```plaintext
{{#each categories as |c|}}
  
  ...铃铛之前的一些内容...

  {{category-notifications-button
    value=c.notification_level
    onChange=(action "changeCategoryNotificationLevel" c)
  }}

  ...铃铛之后的一些内容...

{{/each}}

```

如果你不知道如何实现，[Johani 的教程](https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648)是完美的“首选参考”。

如果你发现如何在标签上实现相同功能，请告诉我！[我找不到实现的方法](https://meta.discourse.org/t/add-a-tag-notification-level-button-with-ember/166194)。

---

_[View the full topic](https://meta.discourse.org/t/enhanced-category-box-display-component/156954)._
