# 将用户头像插入小部件的自定义位置时出错

**URL:** https://meta.discourse.org/t/inserting-user-avatar-in-custom-place-as-widget-throws-error/248635
**Category:** Development
**Created:** [2022年十二月12日 08:40 UTC](https://meta.discourse.org/t/inserting-user-avatar-in-custom-place-as-widget-throws-error/248635 "2022-12-12T08:40:30Z")
**Posts on this page:** 1
**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年十二月12日 08:40 UTC](https://meta.discourse.org/t/inserting-user-avatar-in-custom-place-as-widget-throws-error/248635/1 "2022-12-12T08:40:30Z")

</div>

您好。我想在自定义菜单中添加带有个人资料链接的头像照片，并在模板或小部件中完成此操作。但是，当我创建自己的小部件时

 ![2022-12-12 10_35_57-NVIDIA GeForce Overlay DT](https://global.discourse-cdn.com/meta/original/4X/1/6/8/1681ab0a29f3d295cd85b87b0702937d067b37f3.png)  
并使用 `this.attach` 时，会引发错误  
 ![2022-12-12 10_39_14-NVIDIA GeForce Overlay DT](https://global.discourse-cdn.com/meta/original/4X/b/6/1/b61ec176733d0beea6324b3040eb5103adbe3f42.png)  
我认为没有这样的数据，但有没有办法解决这个问题，或者我插入头像的方式是错误的？
