Function wiring breaks for components that show/hide slot content using v-if
See original GitHub issueVue.js version
2.0.0-rc.3
Reproduction Link
http://codepen.io/analog-nico/pen/dXBRBG
Steps to reproduce
- Click the link “Open popup using v-if”
- A badly designed popup opens
- Click the “Close” link
- For this first time the popup closes successfully
- Click the link “Open popup using v-if” again
- The popup opens again
- Click the “Close” link
What is Expected?
- Again, the popup closes successfully
What is actually happening?
- Vue fails to call an internal function that got missing.
- The
closePopupUsingVIf
function attached to the “Close” link’s click event never gets called. - The popup does not close.
For reference the codepen contains the exact same implementation of the popup with the only difference that it uses v-show
instead of v-if
to show/hide the popup. v-show
works perfectly.
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Function wiring breaks for components that show/hide slot ...
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >Untitled
#il Welded wire fence panels toronto, Australian postie bike for sale, Enfermedades repentinas, Oflu kadir, Aloha marketing international?
Read more >Untitled
93 ford explorer radio wiring diagram, Aldea global concepto pdf, Busby british ... Toledo public library harvest, Adilene idalie break up with luis, ......
Read more >liquid-fire - UNPKG
isArray) {\n _isArray = function (x) {\n return Object.prototype. ... */\r\n/* Browser support: Using this shim instead of jQuery proper removes support for ......
Read more >Democracy Suite Use Procedures - Verified Voting
Table of Contents ... 4.5 Logic and Accuracy Testing of System and Components . ... each having a different role in the period...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using
$refs
for this won’t work, as explained by @fnlctrl due to issue #3455, but I would say this is not a recommended pattern anyway.I would rather: a) pass a
is-shown
prop to the component, (https://jsfiddle.net/Linusborg/rwa5cfdm/) or b) usev-if
on the component itself (https://jsfiddle.net/Linusborg/rwa5cfdm/1/)if the popup component will have its own controls, i.e. a close button,
$emit()
an event from it and let the parent listen with@event="handler"
on the component - then the parent can change the state value.This has several advantages:
$ref
in you JS code.@prog-rajkamal That is a valid point which @fnlctrl also mentioned in his first response. However, the bug still occurs if I move
v-if
to a child div. See my updated codepen.