Skip to content
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

feat(steps): 多端适配 #2547

Closed
wants to merge 22 commits into from
Closed

feat(steps): 多端适配 #2547

wants to merge 22 commits into from

Conversation

Alex-huxiyang
Copy link
Collaborator

@Alex-huxiyang Alex-huxiyang commented Aug 21, 2024

🤔 这个变动的性质是?

  • 新特性提交
  • 功能增强
  • 重构
  • 代码风格优化

Summary by CodeRabbit

  • 新功能

    • 组件“Step”和“Steps”的版本号从“2.0.0”更新至“3.0.0”。
    • 新增lineWidth属性以增强Step组件的灵活性。
  • 样式改进

    • .nut-step组件的样式进行全面优化,提高了响应式设计与视觉层次。
    • 新增多个状态类以改善视觉表现。
  • 文档更新

    • 通过条件渲染提高组件的灵活性与用户体验。
  • 其他

    • 改善了多个组件的布局与适应性,确保在不同平台上表现一致。

@Alex-huxiyang Alex-huxiyang marked this pull request as ready for review August 21, 2024 08:13
Copy link

coderabbitai bot commented Aug 21, 2024

Walkthrough

此次更改引入了对步骤组件的增强,主要包括在 src/config.json 文件中将 StepSteps 组件的版本号从 2.0.0 升级到 3.0.0。同时,src/packages/step/step.scss 文件中的样式进行了调整,以改善 .nut-step 组件的布局和视觉表现。此外,src/packages/step/step.taro.tsxsrc/packages/steps/steps.taro.tsx 文件中也进行了功能增强,分别添加了新的 lineWidth 属性和改进了渲染逻辑,以提高与 Taro 框架的兼容性。

Changes

文件 更改摘要
src/config.json 更新 "Step" 和 "Steps" 组件的版本号从 "2.0.0" 到 "3.0.0"。
src/packages/step/step.scss 修改了 .nut-step 组件及其子元素的样式,优化了布局。
src/packages/step/step.taro.tsx 更新 StepProps 接口,新增 lineWidth 属性并设置默认值。
src/packages/steps/steps.taro.tsx 修改渲染逻辑,增强与 Taro 框架的兼容性。

Possibly related PRs

Suggested labels

size/XXL, 2.x

Poem

🐇
在步骤的舞台上,我欢快地跳,
新功能新样式,让我乐陶陶。
点击一步步,欢笑满天飞,
感谢每一个改动,真是心花怒放! 🌼✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

🧹 Outside diff range and nitpick comments (2)
src/config.json (2)

Line range hint 1059-1078: 建议更新文档和更新日志

鉴于 Step 和 Steps 组件都进行了主要版本更新,建议更新相关文档并在更新日志中详细说明这些变更。

请确保:

  1. 更新组件文档,反映 3.0.0 版本的新特性和可能的破坏性更改。
  2. 在项目的 CHANGELOG.md 文件中添加这些更改的详细说明。
  3. 如果有 API 变更,请更新相关的类型定义文件。

这将帮助使用这些组件的开发者了解变更并进行必要的适配。


Line range hint 1059-1078: 版本更新可能影响项目稳定性

Step 和 Steps 组件的版本更新反映了重要的改进,但也可能引入兼容性问题。

建议:

  1. 全面测试使用这些组件的所有功能,确保兼容性。
  2. 考虑提供迁移指南,帮助用户从 2.0.0 版本升级到 3.0.0 版本。
  3. 在发布新版本时,使用 semver 规范,确保版本号正确反映更改的性质。
  4. 考虑实施持续集成/持续部署(CI/CD)流程,自动化测试这些组件在不同场景下的表现。

这些措施将有助于确保版本更新的平稳过渡,并维护项目的整体稳定性。

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5dec6bc and 478b212.

📒 Files selected for processing (2)
  • scripts/rn/copy-file.js (1 hunks)
  • src/config.json (2 hunks)
🧰 Additional context used
🔇 Additional comments (3)
scripts/rn/copy-file.js (1)

35-35: 批准更改,但建议进一步验证

这个更改看起来是正确的,将 'step' 添加到 childAdaptedArray 中符合增强步骤组件以支持多平台的目标。

然而,为了确保 'step' 组件的完全适配,建议运行以下脚本来验证:

请运行此脚本并检查输出,以确保 'step' 组件已完全适配多平台支持。

src/config.json (2)

Line range hint 1070-1078: Steps 组件版本更新至 3.0.0

Steps 组件的版本也已从 2.0.0 更新到 3.0.0。这同样是一个主要版本更新,可能包含破坏性更改。

请运行以下脚本以验证 Steps 组件的使用是否与新版本兼容:

#!/bin/bash
# 描述:检查 Steps 组件的使用情况,确保与 3.0.0 版本兼容

# 测试:搜索 Steps 组件的使用。预期:只有新版本的使用方式。
rg --type typescript --type javascript -e 'import.*Steps.*from' -e 'Steps.*=' -A 5

Line range hint 1059-1065: Step 组件版本更新至 3.0.0

Step 组件的版本已从 2.0.0 更新到 3.0.0。这是一个主要版本更新,可能包含破坏性更改。

请运行以下脚本以验证 Step 组件的使用是否与新版本兼容:

@Alex-huxiyang Alex-huxiyang changed the base branch from dev-harmony to V3.0 October 25, 2024 10:15
Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.95%. Comparing base (7515810) to head (969fd19).
Report is 6 commits behind head on V3.0.

Additional details and impacted files
@@           Coverage Diff           @@
##             V3.0    #2547   +/-   ##
=======================================
  Coverage   83.95%   83.95%           
=======================================
  Files         221      221           
  Lines       17849    17849           
  Branches     2679     2679           
=======================================
  Hits        14986    14986           
  Misses       2858     2858           
  Partials        5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oasis-cloud oasis-cloud added the 3.x Target branch 3.x label Nov 1, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Outside diff range and nitpick comments (2)
src/packages/step/step.scss (2)

8-10: 布局结构优化建议

建议考虑使用 align-items: flex-start 替代 align-items: center,这样可以在内容高度不一致时获得更好的对齐效果。

 flex-direction: row;
 justify-content: center;
-align-items: center;
+align-items: flex-start;

150-152: 条件编译注释建议

/* #ifndef harmony*/ 的条件编译注释建议添加相关说明,以便其他开发者理解这段代码的用途。

-/* #ifndef harmony*/
+/* #ifndef harmony - 处理鸿蒙系统上的transform兼容性问题 */
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 478b212 and 969fd19.

📒 Files selected for processing (4)
  • src/config.json (2 hunks)
  • src/packages/step/step.scss (3 hunks)
  • src/packages/step/step.taro.tsx (4 hunks)
  • src/packages/steps/steps.taro.tsx (2 hunks)
🔇 Additional comments (6)
src/packages/steps/steps.taro.tsx (3)

3-3: 新增的导入声明符合多端适配需求

新增的 View 组件和 harmonyAndRn 工具函数的导入,有效支持了组件的多端渲染需求。

Also applies to: 6-6


45-45: 类名条件判断得到优化

!!dot 简化为 dot 是个好的改进,因为 dot 本身就是 boolean 类型,无需双重否定。


69-69: 验证空标签包裹的必要性

使用空标签 <> 包裹 renderContent() 的调用可能是不必要的,因为 renderContent 已经返回了完整的 JSX 结构。

建议直接返回 renderContent():

- return <>{renderContent()}</>
+ return renderContent()
src/packages/step/step.scss (1)

18-19: 线条定位计算可能存在问题

当前的线条定位计算 calc(100% - $steps-base-line-width / 2) 在某些边界情况下可能会导致对齐问题。建议使用更稳健的计算方式。

✅ Verification successful

Let me gather more context about the step component's styling to better understand the line positioning calculation.


Let me check the variables used in the line positioning calculation.


线条定位计算是合理的,无需修改

经过分析,当前的线条定位计算 calc(100% - $steps-base-line-width / 2) 是合理且稳健的:

  • $steps-base-line-width 被定义为 70%,这是一个合适的默认值
  • 该计算方式确保了线条能够正确连接相邻步骤的中心点
  • 在 RTL(从右到左)布局中也有对应的正确处理
  • 组件中的垂直模式也采用了类似的居中计算方式,证明这种计算模式是可靠的
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 检查是否存在其他使用类似计算方式的样式
rg "calc\(100%.*\)" -g "*.scss"

Length of output: 700


Script:

#!/bin/bash
# Check the step component's SCSS file for context around the line positioning
cat src/packages/step/step.scss

Length of output: 4936


Script:

#!/bin/bash
# Search for the definition of steps-base-line-width variable
rg "steps-base-line-width" -g "*.scss"

Length of output: 579

src/config.json (1)

1059-1062: 请注意版本升级的兼容性影响

Step 和 Steps 组件从 2.0.0 升级到 3.0.0 版本,这是一个主版本升级,可能包含破坏性更改。建议:

  1. 确保更新相关文档以反映新版本的变化
  2. 在发布说明中明确记录任何破坏性更改
  3. 为使用这些组件的用户提供迁移指南

Also applies to: 1070-1077

src/packages/step/step.taro.tsx (1)

121-125: 验证 icondot 的逻辑处理

在渲染图标部分时,对 icondot 的判断影响渲染结果。请确保当 icondot 都不存在时,组件能够正确显示步骤编号或默认内容。

您可以运行以下脚本以查找代码库中 Step 组件的使用情况,确认渲染逻辑是否正确:

✅ Verification successful

Let me gather more information about the Step component's implementation to verify the icon and dot logic.


Let me try a different approach to check the Step component's implementation.


Let me try one more search with a different pattern to locate the Step component implementation.


icondot 的渲染逻辑已正确实现

经过代码验证,Step 组件对 icondot 的处理逻辑是完善的:

  1. 当存在 icon 时,优先渲染 icon
  2. 当没有 icondot 为 false 时,渲染步骤数字
  3. dot 为 true 时,渲染圆点样式

这个实现通过以下代码保证:

{icon || (!dot && (
  <Text className={`${classPrefix}-${getCurrentStatus()}-inner`}>
    {value}
  </Text>
))}

组件的渲染优先级和默认显示行为都符合预期,不需要额外修改。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:查找使用 `<Step>` 组件的文件并显示上下文
rg -A 5 '<Step' src/

Length of output: 21693


Script:

#!/bin/bash
# Check the Step component implementation for icon and dot rendering logic
ast-grep --pattern $'const Step = (props) => {
  $$$
  return (
    $$$
  )
}'

Length of output: 79


Script:

#!/bin/bash
# Check the Step component's source code
rg -A 30 "const Step = \(props\)" src/packages/step/

Length of output: 54


Script:

#!/bin/bash
# Search for the Step component implementation
cat src/packages/step/step.taro.tsx

Length of output: 4341

Comment on lines +49 to +68
const renderContent = () => {
if (harmonyAndRn()) {
return (
<View>
<DataContext.Provider value={parentSteps}>
<View className={classes} {...(restProps as any)}>
{children}
</View>
</DataContext.Provider>
</View>
)
}
return (
<DataContext.Provider value={parentSteps}>
<View className={classes} {...(restProps as any)}>
{children}
</View>
</DataContext.Provider>
)
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

建议优化条件渲染逻辑以提高代码可维护性

当前实现中存在重复的 JSX 结构,建议提取共同部分以减少代码重复。

建议如下重构:

  const renderContent = () => {
+   const content = (
+     <DataContext.Provider value={parentSteps}>
+       <View className={classes} {...(restProps as any)}>
+         {children}
+       </View>
+     </DataContext.Provider>
+   )
+
    if (harmonyAndRn()) {
-     return (
-       <View>
-         <DataContext.Provider value={parentSteps}>
-           <View className={classes} {...(restProps as any)}>
-             {children}
-           </View>
-         </DataContext.Provider>
-       </View>
-     )
+     return <View>{content}</View>
    }
-   return (
-     <DataContext.Provider value={parentSteps}>
-       <View className={classes} {...(restProps as any)}>
-         {children}
-       </View>
-     </DataContext.Provider>
-   )
+   return content
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const renderContent = () => {
if (harmonyAndRn()) {
return (
<View>
<DataContext.Provider value={parentSteps}>
<View className={classes} {...(restProps as any)}>
{children}
</View>
</DataContext.Provider>
</View>
)
}
return (
<DataContext.Provider value={parentSteps}>
<View className={classes} {...(restProps as any)}>
{children}
</View>
</DataContext.Provider>
)
}
const renderContent = () => {
const content = (
<DataContext.Provider value={parentSteps}>
<View className={classes} {...(restProps as any)}>
{children}
</View>
</DataContext.Provider>
)
if (harmonyAndRn()) {
return <View>{content}</View>
}
return content
}

Comment on lines +71 to +72
display: flex;
flex-wrap: wrap;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

描述区域布局改进

将 description 改为 flex 布局是个好的改进,但建议添加 word-break: break-word 属性以更好地处理长文本。

 display: flex;
 flex-wrap: wrap;
+word-break: break-word;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
display: flex;
flex-wrap: wrap;
display: flex;
flex-wrap: wrap;
word-break: break-word;

Comment on lines +76 to +124
// 3种状态
&-process {
&-icon {
background-color: $steps-process-icon-bg-color;
border-color: $steps-process-icon-bg-color;
color: $steps-process-icon-color;
}

.nut-step-title {
&-title {
color: $steps-process-title-color;
font-size: $steps-process-title-font-size;
font-weight: $steps-process-title-font-weight;
}

.nut-step-description {
&-inner {
color: $steps-process-icon-color;
}
&-description {
color: $steps-process-description-color;
}
}

&.nut-step-wait {
.nut-step-title {
color: $steps-wait-title-color;
&-finish {
&-description {
color: $steps-process-description-color;
}

.nut-step-description {
color: $steps-wait-description-color;
&-description {
color: $steps-finish-description-color;
}
}

&.nut-step-finish {
.nut-step-icon {
&-title {
color: $steps-finish-icon-color;
}
&-icon {
border-width: 1px;
background-color: $steps-finish-icon-bg-color;
border-color: $steps-finish-icon-border-color;
color: $steps-finish-icon-color;
}

.nut-step-line {
background: $steps-finish-line-background;
}

.nut-step-title {
color: $steps-finish-title-color;
&-line {
background-color: $steps-finish-line-background;
}

.nut-step-description {
color: $steps-finish-description-color;
&-inner {
color: $steps-finish-icon-color;
}
}
}

.nut-steps-dot {
.nut-step-head {
margin: $steps-dot-head-margin;
}

.nut-step-line {
top: 7px;
}

.nut-step-icon {
width: $steps-dot-icon-width;
height: $steps-dot-icon-height;
border: $steps-dot-icon-border;
border-radius: 50%;
box-sizing: content-box;
&-wait {
&-inner {
color: $steps-wait-icon-color;
}
&-description {
color: $steps-wait-description-color;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

状态样式结构优化

状态相关的样式组织结构清晰,但建议将颜色值抽取为变量,便于主题定制。另外,建议添加状态切换动画以提升用户体验。

 &-process {
   &-icon {
     background-color: $steps-process-icon-bg-color;
     border-color: $steps-process-icon-bg-color;
     color: $steps-process-icon-color;
+    transition: all 0.3s ease-in-out;
   }

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +161 to +184
// 垂直模式
&-vertical {
display: flex;
height: 33.34%;
}

.nut-step-line {
position: absolute;
display: inline-block;
width: 1px;
height: $steps-base-line-width;
background: $steps-base-line-background;
top: calc(
$steps-base-icon-height +
(100% - $steps-base-line-width - $steps-base-icon-margin-bottom) / 2
);
left: calc(50% - 1px);
}

&.nut-steps-dot {
.nut-step-line {
top: calc($steps-dot-icon-height + (100% - $steps-base-line-width) / 2);
flex-direction: row;
align-items: start;
position: relative;
&-line {
position: absolute;
top: 150%;
width: 1px;
height: 50px;
background: $steps-base-line-background;
left: calc(50% - 1px);
}

&-main {
display: flex;
flex-direction: column;
align-items: start;
padding-left: 6%;
text-align: start;
position: relative;
bottom: 5px;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

垂直模式布局建议

垂直模式的实现存在以下问题:

  1. bottom: 5px 使用固定值可能导致不同尺寸下的对齐问题
  2. 建议使用 CSS 变量来控制间距,便于响应式调整
 &-vertical {
   &-main {
     display: flex;
     flex-direction: column;
     align-items: start;
-    padding-left: 6%;
+    padding-left: var(--nut-step-vertical-padding, 6%);
     text-align: start;
     position: relative;
-    bottom: 5px;
+    bottom: var(--nut-step-vertical-offset, 5px);
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// 垂直模式
&-vertical {
display: flex;
height: 33.34%;
}
.nut-step-line {
position: absolute;
display: inline-block;
width: 1px;
height: $steps-base-line-width;
background: $steps-base-line-background;
top: calc(
$steps-base-icon-height +
(100% - $steps-base-line-width - $steps-base-icon-margin-bottom) / 2
);
left: calc(50% - 1px);
}
&.nut-steps-dot {
.nut-step-line {
top: calc($steps-dot-icon-height + (100% - $steps-base-line-width) / 2);
flex-direction: row;
align-items: start;
position: relative;
&-line {
position: absolute;
top: 150%;
width: 1px;
height: 50px;
background: $steps-base-line-background;
left: calc(50% - 1px);
}
&-main {
display: flex;
flex-direction: column;
align-items: start;
padding-left: 6%;
text-align: start;
position: relative;
bottom: 5px;
}
// 垂直模式
&-vertical {
display: flex;
flex-direction: row;
align-items: start;
position: relative;
&-line {
position: absolute;
top: 150%;
width: 1px;
height: 50px;
background: $steps-base-line-background;
left: calc(50% - 1px);
}
&-main {
display: flex;
flex-direction: column;
align-items: start;
padding-left: var(--nut-step-vertical-padding, 6%);
text-align: start;
position: relative;
bottom: var(--nut-step-vertical-offset, 5px);
}

Comment on lines +75 to +77
const isLastItem =
parent.propSteps.children[parent.propSteps.children.length - 1].props
.value === value
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

注意添加空值检查以防止运行时错误

在确定 isLastItem 时,如果 parent.propSteps.children 未定义或为空数组,访问 parent.propSteps.children[parent.propSteps.children.length - 1] 可能会导致运行时错误。建议在访问前添加检查,确保 parent.propSteps.children 存在且长度大于 0。

Comment on lines +74 to 107
const renderLineStyle = () => {
const isLastItem =
parent.propSteps.children[parent.propSteps.children.length - 1].props
.value === value
const leftPosition = 100 - lineWidth / 2
if (isLastItem) {
return { display: 'none' }
}
if (harmony()) {
if (direction === 'vertical') {
return dot
? {
left: pxTransform(2),
}
: {
left: '50%',
}
}
return {
left: `${leftPosition}%`,
top: pxTransform(dot ? 3 : 12.5),
}
}
if (rn()) {
return direction === 'vertical'
? {
left: '50%',
top: dot ? '30%' : '40%',
}
: {
left: `${leftPosition}%`,
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

简化 renderLineStyle 函数的嵌套条件

renderLineStyle 函数中包含较多嵌套的条件判断,可能影响代码的可读性和维护性。建议重构此函数,简化条件逻辑,例如合并相似的条件或使用策略模式,提高代码清晰度。

const parent: any = useContext(DataContext)

const dot = parent.propSteps.dot
const { dot, direction } = parent.propSteps
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

确保从 parent.propSteps 获取的属性安全

在解构 parent.propSteps 时,直接获取了 dotdirection 属性。请确保 parent.propSteps 存在且包含这些属性,以避免出现 undefined 错误。

@oasis-cloud
Copy link
Collaborator

image 纯 H5 布局错误。

@oasis-cloud
Copy link
Collaborator

鸿蒙构建再检查一下

@Alex-huxiyang
Copy link
Collaborator Author

收到。

@Alex-huxiyang Alex-huxiyang deleted the hxy/steps/0816 branch November 11, 2024 09:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Target branch 3.x size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants