feat: customWrapper 支持 class 和 style 属性#19432
Conversation
Walkthrough自定义包装器生成的第三方组件标签新增 Changes第三方模板更新
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
#19242 修复解决了这个问题 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/shared/src/template.ts (1)
480-480: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value建议统一使用
Shortcuts.Class/Shortcuts.Style。 这里直接写i.cl/i.st,和buildThirdPartyAttr的生成方式不一致,后续映射变更时容易漏改。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/shared/src/template.ts` at line 480, Update the component template generation in the relevant template-building function to use the shared Shortcuts.Class and Shortcuts.Style mappings instead of directly referencing i.cl and i.st, matching buildThirdPartyAttr and keeping attribute mappings consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/shared/src/template.ts`:
- Line 480: Update the component template generation in the relevant
template-building function to use the shared Shortcuts.Class and Shortcuts.Style
mappings instead of directly referencing i.cl and i.st, matching
buildThirdPartyAttr and keeping attribute mappings consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 45a10ffd-34ab-4d5c-a5d0-6306da332ad4
📒 Files selected for processing (1)
packages/shared/src/template.ts
背景微信小程序原生自定义组件支持在宿主节点上直接设置 class、style、动画以及 Flex 布局等属性,开发者可以像使用普通 view 一样进行布局,无需额外增加包装节点。 相比之下,当前 CustomWrapper 不支持 class、style 属性,与微信原生自定义组件的行为存在差异,无法作为一个普通的布局节点使用。 存在的问题由于无法给 CustomWrapper 宿主节点设置布局样式,会带来一些实际使用上的限制:
方案为 CustomWrapper 增加 class、style 属性支持,并透传到实际渲染节点,使其能够像微信原生自定义组件一样参与页面布局计算。 |
|
@Single-Dancer 帮忙 Review 一下? |
这个 PR 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit