# 在连接器模板中传递属性

**URL:** <https://meta.discourse.org/t/pass-property-in-connector-template/223761>\
**Category:** Development\
**Created:** [2022年四月8日 22:15 UTC](https://meta.discourse.org/t/pass-property-in-connector-template/223761 "2022-04-08T22:15:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![j3ang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j3ang/32/251087_2.png) [@j3ang](https://meta.discourse.org/u/j3ang)\
**Post date:** [2022年四月8日 22:15 UTC](https://meta.discourse.org/t/pass-property-in-connector-template/223761/1 "2022-04-08T22:15:02Z")

</div>

如何使用插件 API 将属性传递到 Handlebars 模板？

我试图根据当前主题是否公开来显示不同的文本。我正在使用 `topic-above-post-stream` 连接器出口。

我尝试扩展 `api.modifyClass("component:topic-category", {})` 并在 `init()` 方法中设置属性，它会在控制台中显示，但实际上并未显示在 `this` 中。

 ![CleanShot 2022-04-08 at 15.11.37](https://global.discourse-cdn.com/meta/original/4X/2/9/1/29110e70e08c3329f68f61d7df738f93380bcb1a.jpeg)

 ![CleanShot 2022-04-08 at 15.10.23](https://global.discourse-cdn.com/meta/original/4X/1/5/7/157d1d6c77f48005f244809fca678589109a2ee5.jpeg)

---

<div class="post-metadata">

**Author:** ![j3ang](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j3ang/32/251087_2.png) [@j3ang](https://meta.discourse.org/u/j3ang)\
**Post date:** [2022年四月9日 02:01 UTC](https://meta.discourse.org/t/pass-property-in-connector-template/223761/2 "2022-04-09T02:01:11Z")

</div>

ah, 根据这个找到了：[Adding a form to a plugin - #3 by Johani](https://meta.discourse.org/t/adding-a-form-to-a-plugin/215203/3?u=j3ang)

不得不使用 setupComponent()
