# \[已解决\] 如何在\<head\>中使用 virtual-dom 的"h"辅助函数来覆盖 header-dropdown 汉堡菜单小部件？+ 如何覆盖 @computed 方法？

**URL:** <https://meta.discourse.org/t/solved-how-to-use-virtual-doms-h-helper-in-head-for-header-dropdown-hamburger-widget-override-how-to-override-computed-method/104583>\
**Category:** Development\
**Created:** [2018 年12 月 18 日 18:50 UTC](https://meta.discourse.org/t/solved-how-to-use-virtual-doms-h-helper-in-head-for-header-dropdown-hamburger-widget-override-how-to-override-computed-method/104583 "2018-12-18T18:50:30Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

作者： ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
发布日期： [2018 年12 月 18 日 20:53 UTC](https://meta.discourse.org/t/solved-how-to-use-virtual-doms-h-helper-in-head-for-header-dropdown-hamburger-widget-override-how-to-override-computed-method/104583/6 "2018-12-18T20:53:24Z")

</div>

If you want to use the decorator syntax, you can do this

```plaintext
const computed = require("ember-addons/ember-computed-decorators").default;

```

Then you can do

```plaintext
api.modifyClass('component:edit-category-settings', {
    @computed("model.categoryId", "lastValidatedAt")
    availableSorts(categoryId, lastValidatedAt){
        let sorts = this._super();
        let voteSort = {};
        voteSort["name"] = "Votes";
        voteSort["value"] = "votes";
        sorts.push(voteSort);
        return sorts;
    }
  });

```

Notice that these lines are just a re-arranging of the `import` lines that you see in Discourse’s codebase. So anything you can import, you should be able to `require` in a theme.

---

_[View the full topic](https://meta.discourse.org/t/solved-how-to-use-virtual-doms-h-helper-in-head-for-header-dropdown-hamburger-widget-override-how-to-override-computed-method/104583)._
