# 通过原始模板插件插槽传递属性的有趣策略

**URL:** https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054
**Category:** Development
**Created:** [2021 年11 月 24 日 11:23 UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054 "2021-11-24T11:23:32Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### 作者： ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)
#### 发布日期： [2022 年1 月 18 日 16:26 UTC](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054/5 "2022-01-18T16:26:06Z")

</div>

编辑：我意识到以下内容可能更适合单独的主题。我还意识到我遇到的主要问题是将组件的操作导入插件插槽。我在这里提出了一个相关问题：

> [@How to add a component's actions into a plugin-outlet?](https://meta.discourse.org/t/how-to-add-a-components-actions-into-a-plugin-outlet/215322):
>
> I’ve been trying to reference an existing component in a plugin-outlet, but I keep getting errors. And the main issue seems to be the actions associated with the component. Is there a proper way to reference the actions of another component in a plugin outlet? I would have thought that in a plugin-outlet, just referencing the component (ie, {{component-name action=(action "doSomething")...}}) would work to bring in all the relevant code of that component’s actions. But it seems like that is no…

* * *

是否有更简单/标准的方法可以将参数成功传递到插件插槽？

例如：

如果在模板中，有对 composer-action-title 组件的以下引用，如下所示：  
**composer.hbs:**

```plaintext
 {{composer-action-title
       model=model
        openComposer=(action "openComposer")
        closeComposer=(action "closeComposer")
        canWhisper=canWhisper
        tabindex=8
  }}

```

我想添加一个插件插槽，该插槽——在该插件插槽中——具有相同的代码，例如：  
**connectors/cool-outlet/cool-outlet.hbs:**

```plaintext
 {{composer-action-title
       model=model
        openComposer=(action "openComposer")
        closeComposer=(action "closeComposer")
        canWhisper=canWhisper
        tabindex=8
  }}

```

我需要做什么才能让我的 cool-outlet 插件插槽能够成功引用 composer-action-title 组件？

在 composer.hbs 中使用类似以下的引用：  
`{{plugin-outlet name="cool-outlet" args=(hash model=model)}}`  
似乎不起作用。

---

_[View the full topic](https://meta.discourse.org/t/an-interesting-strategy-for-passing-properties-via-raw-template-plugin-outlets/210054)._
