Repository navigation
feat(Popup): 小程序与 UniApp 新增可选 maxWidth 属性 - #4742
Open
Huuyii-sleeping wants to merge 1 commit into
Open
Huuyii-sleeping wants to merge 1 commit into
Huuyii-sleeping wants to merge 1 commit into
Conversation
Huuyii-sleeping
requested review from
anlyyao,
betavs,
jarmywang,
jin0209,
novlan1 and
zydemail
as code owners
November 23, 2026 13:53
This was referenced Nov 23, 2026
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 的性质是?
🔗 相关 Issue
关联 Tencent/tdesign-common#2743,按维护者确认的方案提供可选 maxWidth,仅顶部和底部生效,无需新增 Popup 示例。
配套 PR:
💡 需求背景和解决方案
顶部、底部 Popup 在宽屏下可通过可选
maxWidth限宽并水平居中。数字单位为 px,也支持600px、70vw、none等字符串。未传参数时保留原有全宽及已有自定义宽度;移除参数恢复原布局。左右和居中弹层忽略该属性。参数无默认值。API 描述统一为:弹出层最大宽度,仅顶部和底部弹出场景有效。
同一 PR 补齐小程序和 UniApp:样式计算仅在顶部/底部且显式传参时写入 max-width,添加条件类通过自动外边距居中。保留原有导航栏偏移、动画与自定义样式。支持动态更新、移除和方向切换,数值 0 可用,UniApp 字符串也支持 rpx。
同步 tdesign-api 生成的 maxWidth 类型、props 和中英文文档。UniApp 原有 zIndex 默认值与 visible-change 事件契约保持不变;未同步生成器中这些无关差异。按维护者意见无需新增示例。
小程序:
UniApp:
共享视觉行为参考 common PR 中的 Vue 组件截图;这些截图为 Chrome 模拟视口,不作为小程序或 UniApp 真机截图。本 PR 的样式独立维护,无需等待 common 样式同步。
✅ 验证
node node_modules/gulp/bin/gulp.js --gulpfile script/gulpfile.dist.js --cwd ./完整小程序分发构建通过,无 TypeScript 错误。_style规则警告。修改源码 Prettier、git diff --check通过,生成文档保持生成器格式。📝 更新日志
tdesign-miniprogram
maxWidth,支持顶部和底部弹层限宽并水平居中,默认保留原有布局。@tdesign/uniapp
maxWidth,与其他移动端框架保持一致。@tdesign/uniapp-chat
无独立修改。
☑️ 请求合并前的自查清单