使用<image>无法显示头像?

小程序 文章 2022-02-19 16:20 347 0 全屏看文

AI助手支持GPT4.0

使用无法显示头像?Can't display avatar using ?

使用无法显示头像?

头像的链接是通过wx.getUserInfo获取的,wxml中代码是这样的:

<image style="width: 72rpx; height: 72rpx; border-radius: 50%;src="https://wx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132"></image>

显示的是一个下面图片中的灰色头像,不是微信头像:

请问有什么解决办法吗?

The avatar link is through Wx The code in wxml obtained by getUserInfo is as follows: < image style = "width: 72rpx; height: 72rpx; border radius: 50%;" src="/uploads/cj/article/2022/02/19/a91797efdf5c0e44575625208de2d6b5.jpg"> < / Image > shows a gray avatar in the following picture, not a wechat Avatar: is there any solution?

回答:

小黎:

如果只是用于显示可以使用标签<open-data type="userAvatarUrl"></open-data>

https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html

Larry:

wx.getUserInfo弃用了,现在返回的是匿名数据,应该用wx.getUserProfile

https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801

江文静:

你这个图片就是这样的

null:谢谢了,可能是我本地环境的问题,但是奇怪的是在模拟器正常,真机就不行,清了缓存还是这样

-EOF-

AI助手支持GPT4.0