fix: 将无值的属性在输出RN时视为true#2486
Open
mackwang112 wants to merge 1 commit into
Open
Conversation
When compiling templates for React/RN, attributes written without a
value (e.g. <scroll-view scroll-y>) had their value parsed as
undefined, which JSON.stringify silently drops. Now such attributes
correctly emit `true` in the generated render function, matching
miniprogram boolean-attribute semantics.
Attributes with an explicit value (e.g. scroll-y="{{undefined}}") are
unchanged.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
在输出RN编译模板时,未指定值的属性(例如
<scroll-view scroll-y>)其值被解析为{"scroll-y": undefined}。现在,此类属性在生成的渲染函数中正确地处理为
{"scroll-y": true}(等价于<scroll-view scroll-y="{{ true}}">),与小程序布尔属性语义对齐。具有显式值的属性(例如scroll-y="{{undefined}}")保持不变。