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
Labels

Comments

@mzgajner
Copy link

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
Copy link

AnyGong commented Jan 26, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants