Support more collection data types in v-for
See original GitHub issueAt some situations, plain object isn’t the best choise. I tried to render a Map
object by v-for
, but seems Vue
does not support it currently. (Here’s a post I created in the Help thread on the forum.)
Hope Vue
can provide the for ... of
syntax in v-for
to iterate over data types like Map
and Set
.
For example:
const map = new Map();
map.set('key1', 'val1');
map.set('key2', 'val2');
and we can render map
in this way:
<ul>
<li v-for="[key, val] of map">{{key}} - {{val}}</li>
</ul>
Issue Analytics
- State:
- Created 8 years ago
- Reactions:255
- Comments:47 (6 by maintainers)
Top Results From Across the Web
5 Support for Collection Data Types - Oracle Help Center
Oracle supports the varray and nested table collection data types. A varray is an ordered collection of elements. A nested table can have...
Read more >Collection Data Types in Python - Medium
Python has 4 built-in data structures that can be used to hold a collection of objects, they are list, tuple, set, and dictionary....
Read more >Data Type Summary - Visual Basic | Microsoft Learn
The following table shows the Visual Basic data types, their supporting common language runtime types, their nominal storage allocation, ...
Read more >What Are Data Types and Why Are They Important? - Amplitude
Learn about common data types—booleans, integers, strings, and more—and their importance in the context of gathering data.
Read more >JavaScript data types and data structures - MDN Web Docs
Check the typed array page for more information. Typed arrays are often used in conjunction with ArrayBuffer and DataView . Keyed collections: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s important to be able to iterate over iterators in loops. That seems plainly obvious. It’s a fundamental feature of the language.
The reasons for supporting it are:
People wanting to use a feature is not, only by itself, an argument that can justify the need of having such feature, it’s necessary to weigh the cost and benefits (what problem is being solved) of adding such feature