# 我们可以在 discourse 插件中添加 ember 插件吗？（例如 ember power select）

**URL:** <https://meta.discourse.org/t/can-we-add-ember-add-ons-to-a-discourse-plugin-like-ember-power-select/184507>\
**Category:** Development\
**Created:** [2021 年3 月 26 日 16:17 UTC](https://meta.discourse.org/t/can-we-add-ember-add-ons-to-a-discourse-plugin-like-ember-power-select/184507 "2021-03-26T16:17:46Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![JQ331](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@JQ331](https://meta.discourse.org/u/JQ331)\
发布日期： [2021 年3 月 26 日 16:17 UTC](https://meta.discourse.org/t/can-we-add-ember-add-ons-to-a-discourse-plugin-like-ember-power-select/184507/1 "2021-03-26T16:17:46Z")

</div>

我想在一个插件中添加一些 Ember 插件。

举个例子：Ember 的 [Power Select](https://ember-power-select.com/docs/the-search)。

（这有助于处理下拉菜单。Discourse 使用的是 `select-kit`，我知道它也很强大，但我发现它很难自定义，因为它在代码库中被高度抽象了。所以我打算尝试使用 Power Select。）

在普通的 Rails/Ember 应用中，我想我可以直接使用以下命令安装插件：

```plaintext
$ ember install ember-power-select

```

然后我会添加类似以下内容：

hbs 模板：

```
<PowerSelect @options={{this.names}} @onChange={{this.foo}} as |name|>
  {{name}}
</PowerSelect>

```

与之配套的 JavaScript 文件：

```plaintext
    import Controller from '@ember/controller';
    export default class extends Controller {
      names = ['Stefan', 'Miguel', 'Tomster', 'Pluto']
      foo() { }
    }

```

但 Discourse 插件并不是标准的 Rails 应用。为了让它正常运行，我是否需要做一些特殊处理？

---

_[View the full topic](https://meta.discourse.org/t/can-we-add-ember-add-ons-to-a-discourse-plugin-like-ember-power-select/184507)._
