Skip to content
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

Custom directive passed through a slot with v-else isn't unbound on vm.$destroy #2206

Closed
mzgajner opened this issue Jan 21, 2016 · 1 comment

Comments

Projects
None yet
3 participants
@mzgajner
Copy link

commented Jan 21, 2016

Apologies for the long title, here's a JSFiddle.

Here are the steps to reproduce it, JSFiddle references in brackets:

  • Create a component with a slot that has a v-else directive on it (MyWrapper).
  • Create another component that imports/uses the first one (MyComponent).
  • In the second component, create a custom directive with bind/unbind functions (myDirective).
  • In the template of the second component, use the first component (wrapper) and insert an element with the custom directive inside it so it gets rendered in place of the slot.
  • Call vm.$destroy() on your instance. This should call unbind on the custom directive, but it doesn't.

If you remove v-else from the slot in MyWrapper, everything works as expected. My current workaround is simply replacing

<div v-if="someExpression"></div>
<slot v-else></slot>

with

<div v-if="someExpression"></div>
<slot v-if="!someExpression"></slot>

Tested with latest (1.0.15) version.

@yyx990803 yyx990803 added the bug label Jan 24, 2016

@AnyGong

This comment has been minimized.

Copy link

commented Jan 26, 2016

+1

@yyx990803 yyx990803 closed this in 0fc2e96 Jan 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.