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(slider): fix slider inputNumber render twice during init step bug #982

Merged

Conversation

ChrisLee0211
Copy link
Contributor

@ChrisLee0211 ChrisLee0211 commented Jun 12, 2022

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

问题: 使用inputNumberProp触发渲染数字输入框时,会导致两次触发渲染才完成传入props的最终展示
原因:在composition api风格重构之后,只要存在inputNumberProp属性即马上先挂载一次inputNumber组件,随后才触发onMounted钩子中的init方法去格式化Slider所有的初始值,导致第一次挂载inputNumber组件时实际上并未拿到真正可用的初始值,等init执行完后因为传入inputNumber的prop被更新导致第二次渲染才完成了最终效果的呈现。
解决办法: 增加一个初始化标识,在onMounted中做标记,用此标记配合inputNumberProp一起判断是否渲染inputNumber组件

📝 更新日志

  • fix(Slider): 修复 slider 数字输入框初始化重复渲染问题

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

完成

@PengYYYYY PengYYYYY merged commit c56663b into Tencent:develop Jun 13, 2022
@github-actions github-actions bot mentioned this pull request Jun 13, 2022
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants