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

Dynamic components, ready, activate and v-for strange behaviour #2445

Closed
straps opened this issue Mar 11, 2016 · 5 comments
Closed

Dynamic components, ready, activate and v-for strange behaviour #2445

straps opened this issue Mar 11, 2016 · 5 comments

Comments

@straps
Copy link

straps commented Mar 11, 2016

Vue.js version

1.0.17

Reproduction Link

https://jsbin.com/lagucugemu/12/edit?html,js,output

Steps to reproduce

Create 2 components, one that reference the other, and use it in a v-for loop

What is Expected?

Component ready callback should always be be called

What is actually happening?

I have a component that references another component.

Everything works well until I use it in a v-for loop

Outside v-for it renders ok
<component :is="compB"></component> ==> Component B containing "component A"

Inside v-for component-a ready callback gets never called
<component v-for="n in 1" :is="compB"></component> ==> Component B containing "component ???"

Is there a valid reason for this or is it a bug?

Thanks

@straps straps changed the title Dynamic components, activate hook and v-for strange behaviour Dynamic components, ready, activate and v-for strange behaviour Mar 11, 2016
@ryan-shaw
Copy link

It appears that the ready event is only called once per component, using 'created' seems to work https://jsbin.com/fukosaqosu/edit?html,js,output

I don't know if this is intentional or not.

@straps
Copy link
Author

straps commented Mar 11, 2016

@ryanshawty I've commented out the component outside v-for, but ready and attached hooks are still not called

https://jsbin.com/qazukexuxa/1/edit?html,js,console,output

I can't use the created callback because I need to be sure $el is attached to the DOM

@straps
Copy link
Author

straps commented Mar 11, 2016

@prog-rajkamal See here: http://vuejs.org/guide/components.html#activate_Hook

On Fri, Mar 11, 2016 at 5:34 PM, prog-rajkamal notifications@github.com
wrote:

@straps https://github.com/straps I can't find any docs related to
activate hook. can you tell me where you found it?


Reply to this email directly or view it on GitHub
#2445 (comment).

@prog-rajkamal
Copy link

@straps sorry, i found it right after commenting and deleted my comment, so others won't have to bother . guess i should have just edited instead of deleting.

@straps
Copy link
Author

straps commented Mar 16, 2016

Thank you @yyx990803

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

No branches or pull requests

3 participants