fix(message): support closeBtn="" to render default close icon #5671
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.

Fixes an inconsistency between Alert and Message components. In Vue, when passing a boolean prop without a value (e.g.,
<Comp closeBtn />), it is treated ascloseBtn="", which is considered truthy. This behavior works in Alert, but not in Message due to use of||when reading props.Empty string was treated as falsy and caused the logic to fail. Now replaced
||with??inuseTNodeJSXto preserve"".Also updated the
-is-closableclass logic in Message to correctly reflectcloseBtn="". Open to further suggestions on improving the class condition.Notably, the following code snippet in
useTNodeJSX89-96:reflects an intention to align with Vue's boolean casting behavior.
However, due to the use of || when reading the prop value:
the empty string '' is treated as falsy and this intended behavior is not achieved.
Replacing || with ?? fixes this and brings useTNodeJSX in line with Vue's rules.
BREAKING CHANGE: Changed behavior in
useTNodeJSXwhen prop is passed as an empty string. Previously, empty string values (e.g.,closeBtn="") were treated as falsy. Now they are preserved and considered as explicitly set, which may affect rendering in some components.🤔 这个 PR 的性质是?
🔗 相关 Issue
closeBtn行为不一致引起。💡 需求背景和解决方案
<Comp closeBtn />等价于closeBtn="",其应视为真值。useTNodeJSX函数中,读取 prop 时使用||导致""被视为假值,无法触发关闭按钮渲染。||改为??,保持空字符串的显式性。closeBtn=""时添加可关闭样式。closeBtn=""时关闭按钮不显示的问题useTNodeJSX中 props 读取逻辑,正确处理空字符串值closeBtn语义行为📝 更新日志
tdesign-vue-next
@tdesign-vue-next/chat
☑️ 请求合并前的自查清单