# \[已解决\] 如何在\<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:** 1

<div class="post-metadata">

作者： ![rbrlortie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rbrlortie/32/166740_2.png) [@rbrlortie](https://meta.discourse.org/u/rbrlortie)\
发布日期： [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/1 "2018-12-18T18:50:30Z")

</div>

Hi,

I’m attempting to override the main header-dropdown html tags via my custom theme.

My proof on concept was this:

```plaintext
<script type="text/discourse-plugin" version="0.8.23">
api.reopenWidget("header-dropdown", {
  html(attrs) {
    if (attrs.icon == 'bars') {
        return 'TEXT TO RETURN INSTEAD OF HAMBURGER';
    } else {
        return this._super(attrs);
    }
  }
});
</script>

```

In this example, ‘`TEXT TO RETURN INSTEAD OF HAMBURGER`’ displays correctly.

Now, I want to wrap this text with a tag.

The solution seems to use the `h` helper like so:

```plaintext
 return h('b', "TEXT TO RETURN INSTEAD OF HAMBURGER");

```

However, this returns `ReferenceError: h is not defined`.

Attempting to add `import { h } from "virtual-dom";` doesn’t work, which makes sense because I’m in the custom theme head override. (`/admin/customize/themes/7/common/head_tag/edit`)

What would be the correct way to do this without creating a plugin?

---

_[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)._
