Vue is famed for its ease of use and simplicity. It achieves these qualities, in part, by having a focused and small API without too many extraneous features.
That said, users and maintainers are always thinking about potentially useful new features. This article discusses five of the most requested features from Vue’s GitHub issue board.
- Support for iterable protocol with
- Multi-root templates (fragments)
- Reactive refs
- Package for custom renderers
It’s good to be aware of these feature requests, as some will make their way into coming versions of Vue, while the ones that don’t may help you better understand the design of Vue.
1. Support for iterable protocol with
What is it?
When you think of iteration, you’ll most likely think of arrays. ES2015 introduced the iterable protocol which, when implemented, allows for any kind of object to be iterated using
for...of. ES2015 also introduced new iterable data types like
v-for directive can iterate arrays and plain objects, but not other iterable objects or data types. If you’re using a
Map, for example, and you want to iterate it with
v-for, you’ll first have to convert it to an array or plain object.
Note: maps, sets, and other new iterable data types are not reactive, either.
Why do users want it?
If Vue is used as the UI layer for such an application, these objects and data types either can’t be iterated in the template or will need to pass through transformation functions.
Will it be added?
Maybe. The issue has been closed on GitHub, as the maintainers weren’t convinced that iterable objects and data types would commonly be used for UI state. Also, making iterable objects and data types reactive would take considerable work.
However, Vue’s observation system is to be refactored in version 2.x-next, which would be the ideal time to implement this feature.
Read more on GitHub.