fix(comp:spin): compatible with the resize of target, when useSpin is… #1273
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.
… used
PR Checklist
Please check if your PR fulfills the following requirements:
What is the current behavior?
What is the new behavior?
解决方案为: 当存在滚动条时动态设置spin的宽高为整个target的宽高,从而实现遮住滚动区域的效果,反之利用css的absolute解决;
tips:
还有一个解决方案为不设置宽高,而是动态设置spin的偏移 (transform: translate),只遮住可视区域,但是此方案需要同时处理scroll和resize两个事件,而且当滚动条滚得太快时,视觉上会有晃动的,所以放弃。此解决方案有一个难点在于当target产生resize事件时,由于spin拥有了宽高且位于target内部,所以无法准确获取当前target产生resize之后的宽高从而判断是否还存在滚动条,所以此难点解决办法为,当产生resize时,将spin宽高置为0,在nextTick中再进行判断
Other information