fix(Avatar): fallback to text when image load fails#4570
Open
jay666mnj wants to merge 1 commit into
Open
Conversation
jay666mnj
requested review from
anlyyao,
betavs,
jarmywang,
jin0209,
novlan1 and
zydemail
as code owners
July 16, 2026 18:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 这个 PR 的性质是?
🔗 相关 Issue
Fixes #2468
💡 需求背景和解决方案
Avatar 组件在配置
image和alt时,图片加载失败后不会回退为字符头像展示,用户无法看到预期的替代文本。本 PR 在图片加载失败且未开启
hideOnLoadFailed时,将 Avatar 从图片态切换为字符头像态,并优先展示alt文本;当image地址变化时会重置加载失败状态,避免新图片仍停留在 fallback 状态。同时新增单测覆盖图片加载失败后显示
alt字符头像的行为。📝 更新日志
tdesign-miniprogram
@tdesign/uniapp
@tdesign/uniapp-chat
☑️ 请求合并前的自查清单