-
Notifications
You must be signed in to change notification settings - Fork 4.9k
feat: Image 支持 lego:// 渲染并新增 lang 属性、Button 新增 onClick,禁用态下阻止点击。 #18381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
这个 PR 做了什么? (简要描述所做更改)
这个 PR 是什么类型? (至少选择一个)
这个 PR 涉及以下平台:
Summary by CodeRabbit