# 将“新主题”按钮转换为具有子菜单

**URL:** <https://meta.discourse.org/t/convert-the-new-topic-button-to-a-have-a-sub-menu/212300>\
**Category:** Development\
**Created:** [2021年十二月16日 13:09 UTC](https://meta.discourse.org/t/convert-the-new-topic-button-to-a-have-a-sub-menu/212300 "2021-12-16T13:09:13Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Fma965](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fma965/32/259795_2.png) [@Fma965](https://meta.discourse.org/u/Fma965)\
**Post date:** [2021年十二月16日 15:04 UTC](https://meta.discourse.org/t/convert-the-new-topic-button-to-a-have-a-sub-menu/212300/6 "2021-12-16T15:04:42Z")

</div>

哈哈 🙂 我找到了这个，但我的 JavaScript 技能不太好 😆 所以不确定它是否有用

> [@api.decorateWidget - how can I find the template's names?](https://meta.discourse.org/t/api-decoratewidget-how-can-i-find-the-templates-names/172907/4?u=fma965):
>
> You aren’t going to be able to use decorateWidget() on a plugin outlet. Try something like this: \<script type="text/discourse-plugin" version="0.8.42"\> const h = require("virtual-dom").h; api.createWidget("user-card-custom-field", { html(attrs) { const userCustomFields = attrs.user.custom\_fields; if (userCustomFields.user\_field\_4) { return h('span.poster-user-field', userCustomFields.user\_field\_4); } } }); \</script\> \<script type="text…

不过到目前为止做得很好 🙂

---

_[View the full topic](https://meta.discourse.org/t/convert-the-new-topic-button-to-a-have-a-sub-menu/212300)._
