-
Notifications
You must be signed in to change notification settings - Fork 272
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
fix(empty): 修复 harmonycpp 部分未适配问题 #2676
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
import React from 'react' | ||
import { Empty } from '@nutui/nutui-react-taro' | ||
import pxTransform from '@/utils/px-transform' | ||
|
||
const Demo3 = () => { | ||
return <Empty description="无数据" imageSize={80} /> | ||
return <Empty description="无数据" imageSize={pxTransform(80)} /> | ||
} | ||
export default Demo3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import React from 'react' | ||
import { Empty, Button } from '@nutui/nutui-react-taro' | ||
import { View } from '@tarojs/components' | ||
import pxTransform from '@/utils/px-transform' | ||
|
||
const Demo6 = () => { | ||
return ( | ||
<Empty status="error" description="加载失败"> | ||
<View style={{ marginTop: '10px' }}> | ||
<View style={{ marginTop: pxTransform(10) }}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification 需要统一 H5 和 Taro 端的样式单位处理 根据搜索结果,发现在同一组件的不同端(H5和Taro)中存在不一致的样式单位使用方式:
建议:
🔗 Analysis chain样式修改符合响应式设计要求! 使用 验证其他文件中的一致性: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# 描述:检查其他 Empty 组件相关文件中的 pxTransform 使用情况
rg -g '*.tsx' -g '*.ts' "marginTop.*px" "src/packages/empty"
Length of output: 610 Script: #!/bin/bash
# 检查 Empty 组件的配置文件,了解是否有关于样式单位的规范说明
fd -e md -e tsx -e ts "config|readme|style" "src/packages/empty" -x cat {}
Length of output: 76 |
||
<Button type="primary" size="small"> | ||
重试 | ||
</Button> | ||
|
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.
💡 Codebase verification
需要统一 Empty 组件的像素值处理方式
经过验证,发现在 Taro 环境下的 Empty 组件使用存在不一致:
demo3.tsx
中正确使用了pxTransform(80)
demo1.tsx
中的 marginTop 使用了pxTransform(10)
同时在 H5 环境下:
demo3.tsx
中直接使用了硬编码值imageSize={80}
demo1.tsx
中直接使用了硬编码值marginTop: '10px'
建议:
pxTransform
进行转换🔗 Analysis chain
建议验证其他 Empty 组件的一致性
使用
pxTransform
替换硬编码像素值的修改是正确的,这将提高组件的适配性。建议验证其他 Empty 组件是否都进行了类似的适配。Let me gather more information about Empty component usage across the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 239
Script:
Length of output: 10061