feat: Image 支持 lego:// 渲染并新增 lang 属性、Button 新增 onClick,禁用态下阻止点击。#18381
Merged
Single-Dancer merged 33 commits intomainfrom Sep 22, 2025
Merged
feat: Image 支持 lego:// 渲染并新增 lang 属性、Button 新增 onClick,禁用态下阻止点击。#18381Single-Dancer merged 33 commits intomainfrom
Single-Dancer merged 33 commits intomainfrom
Conversation
- 支持 size 属性,提供多种尺寸选项 - 支持 type 属性,提供不同按钮类型 - 支持 plain 属性,实现朴素按钮样式 - 支持 disabled 属性,控制按钮禁用状态 - 支持 onClick 事件处理
[Feature request]新增 Button 组件对 TD 端的支持
Walkthrough在根与 React 子包中更新依赖与构建配置;新增 Rollup 原始构建流程与 SCSS 合并/修复逻辑;Button 增加 onClick 与禁用处理;Image 在 React 与组件源包中引入 lego:// 渲染模式与 lang 属性;多组件样式从 CSS 迁移到 SCSS;类型声明与 Vite Runner 样式处理微调。 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as App(调用方)
participant Img as Image Component (React/Core)
participant Util as parseLegoUrl()
participant DOM as Document
participant CDN as LEGO CDN (ossin.jd.com)
App->>Img: render({ src, lang, ... })
Img->>Util: parseLegoUrl(src)
Util-->>Img: { tagId, text } | null
alt lego 模式
Img->>DOM: 检测是否已加载 lego 脚本
opt 未加载
Img->>DOM: 动态插入 <script src=LEGO_CDN_URL>
DOM->>CDN: 请求 tag.js
CDN-->>DOM: 返回脚本
end
Img-->>App: 渲染 <canvas-tag {tagId,text,lang,...}>
else 普通模式
Img-->>App: 渲染 <img ...>(含 lazyLoad 等)
end
sequenceDiagram
autonumber
participant Rollup as Rollup
participant Cfg as rollup.config.mjs
participant Plug as getPlugins(isOriginal)
participant Mgr as mergeScssFiles/fixStyleImports
participant FS as FS
Rollup->>Cfg: 读取配置
Cfg-->>Rollup: 导出 [original, react, solid]
Rollup->>Plug: 请求 plugins (isOriginal = true)
Plug-->>Rollup: 返回 custom styles 插件 集合
Rollup->>Mgr: 执行 mergeScssFiles
Mgr->>FS: 读取/解析组件 SCSS @import
FS-->>Mgr: 返回内容
Mgr->>FS: 写入合并后的 dist/original/components/*/style/index.scss
Rollup->>Mgr: 执行 fixStyleImports(重写引用、清理 .scss.js)
Mgr->>FS: 写入/删除 文件
Rollup-->>Rollup: 产出 dist/original
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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 |
Merged
This was referenced Sep 27, 2025
27 tasks
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 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit