# 如何挂载Widget参数

**URL:** https://meta.discourse.org/t/how-to-mountwidget-args/249755
**Category:** Development
**Created:** [2022年十二月23日 15:15 UTC](https://meta.discourse.org/t/how-to-mountwidget-args/249755 "2022-12-23T15:15:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![misham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/misham/32/282796_2.png) [@misham](https://meta.discourse.org/u/misham)
#### Post date: [2022年十二月23日 15:15 UTC](https://meta.discourse.org/t/how-to-mountwidget-args/249755/1 "2022-12-23T15:15:59Z")

</div>

您好！我正在尝试在一个原始的 hbs 模板中挂载一个小部件

```plaintext
<MountWidget @widget="header-notifications" @args={{this.currentUser}} />

```

但是出现了一个错误。我认为这是因为我添加的参数不正确，但我不知道如何正确添加，您能帮我看看如何添加才能让小部件正常工作吗？

---

<div class="post-metadata">

### Author: ![misham](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/misham/32/282796_2.png) [@misham](https://meta.discourse.org/u/misham)
#### Post date: [2022年十二月23日 15:17 UTC](https://meta.discourse.org/t/how-to-mountwidget-args/249755/2 "2022-12-23T15:17:38Z")

</div>

照此操作

```plaintext
<MountWidget @widget="header-notifications" @args={{hash user=this.currentUser}}/>

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2023年一月22日 15:17 UTC](https://meta.discourse.org/t/how-to-mountwidget-args/249755/3 "2023-01-22T15:17:56Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
