-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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(transition-group): not add class v-move to v-show element #7906
base: dev
Are you sure you want to change the base?
fix(transition-group): not add class v-move to v-show element #7906
Conversation
@@ -77,6 +77,7 @@ export default { | |||
for (let i = 0; i < prevChildren.length; i++) { | |||
const c: VNode = prevChildren[i] | |||
c.data.transition = transitionData | |||
c.data.isDisplayNone = c.elm.style.display === 'none' |
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.
Accessing element.style here in a loop will probably cause serious perf issues due to forced layouts. More info: https://developers.google.com/web/fundamentals/performance/rendering/avoid-large-complex-layouts-and-layout-thrashing
It's probably better to just check for empty rects ( { x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 }
) below
@@ -175,7 +176,7 @@ function applyTranslation (c: VNode) { | |||
const newPos = c.data.newPos | |||
const dx = oldPos.left - newPos.left | |||
const dy = oldPos.top - newPos.top | |||
if (dx || dy) { | |||
if (!c.data.isDisplayNone && (dx || dy)) { |
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.
Here you can check if oldPos
is empty rect by comparing every field to { x: 0, y: 0, width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0 }
.
f73b857
to
54586ca
Compare
What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
dev
branch for v2.x (or to a previous version branch), not themaster
branchfix #xxx[,#xxx]
, where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
fix #7879