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

v-for should iterate object iterator (if one exists) #8443

Closed
plehnen opened this issue Jul 2, 2018 · 2 comments
Closed

v-for should iterate object iterator (if one exists) #8443

plehnen opened this issue Jul 2, 2018 · 2 comments

Comments

@plehnen
Copy link

plehnen commented Jul 2, 2018

What problem does this feature solve?

Please see here:
https://jsfiddle.net/tys426eq/

If a class has its own iterator, v-for should iterate over this, instead of the object properties

What does the proposed API look like?

class Items {
  [Symbol.iterator]() {
    return this.all.values();
  }
}

...
<div v-for="item of items"> (or "in")

@posva
Copy link
Member

posva commented Jul 2, 2018

If I recall correctly this is planned for v3 and may be added in v2
Other issues #5893, #6079
PR: #7171, #8179

@plehnen
Copy link
Author

plehnen commented Mar 13, 2019

This is working since vue 2.6.x

core/v-for: support iterables in v-for (#8179) d40eb9c, closes #8179

@plehnen plehnen closed this as completed Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants