feat(slider): fix slider inputNumber render twice during init step bug #982
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
💡 需求背景和解决方案
问题: 使用inputNumberProp触发渲染数字输入框时,会导致两次触发渲染才完成传入props的最终展示
原因:在composition api风格重构之后,只要存在inputNumberProp属性即马上先挂载一次inputNumber组件,随后才触发onMounted钩子中的init方法去格式化Slider所有的初始值,导致第一次挂载inputNumber组件时实际上并未拿到真正可用的初始值,等init执行完后因为传入inputNumber的prop被更新导致第二次渲染才完成了最终效果的呈现。
解决办法: 增加一个初始化标识,在onMounted中做标记,用此标记配合inputNumberProp一起判断是否渲染inputNumber组件
📝 更新日志
slider
数字输入框初始化重复渲染问题☑️ 请求合并前的自查清单