Comments (10)
Here's a version that works. It seems using identifier with objects causes problems...
Also, when you are iterating over an object of objects, those objects are used directly as the child vm's root $data
. In comparison, $value
is only available for primitive values.
Basically, v-repeat
doesn't play too well when doing nested loops of objects. If you have control over your data structure it might be better to use Arrays where appropriate.
from discussion.
Thanks. This solves the issue. It might worth adding the example to the "Displaying a List" guide on the Vue.js website.
from discussion.
this is golden! Thanks
from discussion.
An updated sample: http://jsfiddle.net/8WqxC/2/
On this data:
var playlists = {
"Favourite Songs": {
"2014": ['song a', 'song b'],
"2013": ['song c', 'song d', 'song e']
},
"Favourite Genres": {
"Pop": ['song a'],
"Rock": ['song b'],
"Hip Hop": ['song c', 'song d', 'song e']
}
}
With this markup:
from discussion.
@tiffon Thanks a lot 👍
from discussion.
Just started using vue-js, and I wonder if this method is deprecated in favor of v-for?
Is this how you should do it in 1.0?
from discussion.
@mattiasottosson yes, v-repeat
is deprecated in favor of v-for
. There's also syntax for manually specifying key: v-for="(key, value) in object"
and v-for="(index, value) in list"
.
We also don't use vuejs/Discussion anymore. You can find help on the forum or gitter chat.
from discussion.
@simplesmiler isn't it actually v-for="(value, key) in object
and v-for="(value, index) in list"
? That is to say, isn't the value the first parameter? (counterintuitive though it is)
https://vuejs.org/v2/api/#v-for
from discussion.
@DelightedD0D please note the date, this was before 2.0.
from discussion.
@simplesmiler fair enough :)
from discussion.
Related Issues (20)
- Use ||(or) in v-if (with nuxt js)
- Instantiate a copy of a component directly in that component HOT 1
- Call pre-defined javascript method on vue js event
- What about js-data.io?
- How to make vue bind to, or work with, html in properties
- Convert VueJS 1 to VueJS 2 HOT 2
- Third Party Libraries - Make non reactive?
- why v-switch not included in vuejs and what the alternative way HOT 1
- Use raw html inside v-bind
- iOS event bound using addEventListener is not triggering
- How to validate when blur a component.
- Google is not defined HOT 2
- vuejs can not find method or variable inside a callback function HOT 2
- Thousands of rows performance HOT 1
- how to pass Header + Body in POST api using Vue JS-axios HOT 4
- Conditional rendering and child component
- Fetch the value of element dynamically
- Vue breaks DataTables and Pace JS
- Bootstrap4 tag b-form-input has problem with @blur
- Invalid prop: Expected `Basic type`, got Nulll.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discussion.