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

Doesn't work with vuejs v-for #125

Closed
santigarcor opened this issue Jul 13, 2017 · 5 comments
Closed

Doesn't work with vuejs v-for #125

santigarcor opened this issue Jul 13, 2017 · 5 comments

Comments

@santigarcor
Copy link

First thanks for this package, it's like using laravel collections.

I tried to use one of your collections in a v-for in vue and it doesn't iterate over the collection items, instead it iterates over the collection Object properties.

I have the latest version of your package.

@ecrmnn
Copy link
Owner

ecrmnn commented Jul 14, 2017

Hi

Yes, a normal for in ... have that behaviour. It's possible to iterate through Collection using for of ... but I don't know if that's possible in v-for. I'll check it out.

In the meanwhile I'd recommend something like this:

<ul>
    <li v-for="post in posts.all()">
        {{ post.title }}
    </li>
</ul>

@santigarcor
Copy link
Author

Ok thanks!

@tlgreg
Copy link

tlgreg commented Jul 14, 2017

Currently vue supports only actual arrays with v-for.
Most likely iterator support will only come in vue3, though the issue is still open.

@ecrmnn
Copy link
Owner

ecrmnn commented Jul 14, 2017

Ah. Thanks for clearing that up, @tlgreg. I tweeted Evan You about it but havn't got an answer yet.

@ecrmnn ecrmnn closed this as completed Jul 14, 2017
@alfredocodekit
Copy link

<li class="b-task" v-for="task in sortedTasks" @click="completeTask(task)">
computed: { sortedTasks: function() { return collect(this.tasks).sortBy('title').toArray() } },

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

4 participants