-
-
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
v-show triggers transition every time value changes irrespective of the value's truthiness #7523
Labels
Comments
But should v-show bind to a none boolean value? |
It's definitely something you do for convenience, exactly like using |
yyx990803
pushed a commit
that referenced
this issue
Mar 8, 2018
This was referenced Mar 14, 2018
f2009
pushed a commit
to f2009/vue
that referenced
this issue
Jan 25, 2019
aJean
pushed a commit
to aJean/vue
that referenced
this issue
Aug 19, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
2.5.13
Reproduction link
http://jsfiddle.net/df4Lnuw6/173/
Steps to reproduce
v-show
to a non-boolean truthy value (such as a number or string).v-show
triggers the enter transition every time the value changes.What is expected?
v-show
should not do anything. The element's classes should not change.What is actually happening?
v-show
triggers the enter transition every time the value changes even though the value remains truthy.This causes the element to momentarily have the
v-enter
andv-enter-active
classes which triggers the CSS transition very briefly. This is especially noticeable in Safari.v-show
should check if!oldValue === !newValue
(orBoolean(oldValue) === Boolean(newValue)
) instead ofoldValue === newValue
to see if a transition should not occur.See src/platforms/web/runtime/directives/show.js#L30.
A workaround is to bind only boolean values to
v-show
.The text was updated successfully, but these errors were encountered: