-
Notifications
You must be signed in to change notification settings - Fork 273
fix(image): 修复内联样式不生效 #3254
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
base: feat_v3.x
Are you sure you want to change the base?
fix(image): 修复内联样式不生效 #3254
Conversation
Walkthrough本次变更调整了 Changes
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## feat_v3.x #3254 +/- ##
=============================================
+ Coverage 87.59% 87.75% +0.16%
=============================================
Files 290 290
Lines 19102 19111 +9
Branches 2930 2938 +8
=============================================
+ Hits 16732 16771 +39
+ Misses 2365 2335 -30
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/packages/image/image.taro.tsx (3)
2-2
: 使用import type
优化类型导入
当前直接从react
导入了CSSProperties
,会在运行时保留无用的导入。建议改为:-import React, { - CSSProperties, +import React, { + FunctionComponent, + useCallback, + useState, -} from 'react' +} from 'react' +import type { CSSProperties } from 'react'这样能让编译器在产物中移除类型导入,减少包体积。
61-71
: 明确style
与内置尺寸样式的覆盖顺序
这里将用户传入的style
放在最前面,后续的 height/width/radius 配置会覆盖用户的同名属性;反之,用户若要完全接管尺寸则需在style
中手动重写。
建议要么将...(style)
放到最后以保证用户优先级,要么在文档中强调属性覆盖规则。
73-77
: 统一imgStyle
的类型并剥离多余合并
imgStyle
当前类型为any
且又重复合并了style
,会导致容器和图片元素同时应用同一份样式,引发潜在冲突。
- 建议改为
CSSProperties
类型:const imgStyle: CSSProperties = { width: pxCheck(width), height: pxCheck(height), }- 如确实需单独自定义图片样式,可新增
imageStyle
属性;否则移除对style
的二次合并。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/packages/image/image.taro.tsx
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: build
- GitHub Check: test
🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
☑️ 请求合并前的自查清单
Summary by CodeRabbit