I would like to use a spread operator in a destructured v-for
loop in Vue.js 2 working with vue-template-babel-compiler
. I need the latter in the first place to compile the optional chaining operator in templates. But then I noticed, after using that compiler, that the following example stopped working:
<div
v-for="{a, b, ...others} in [{a:1, b:2, c:3, d:3}, {a:4, b:5, e:6, f:7}]"
:key="a"
>
<div>
a: {{ a }}
b: {{ b }}
others: {{ others }}
</div>
</div>
As I get this error message:
ReferenceError: _objectWithoutProperties is not defined
.
I tried installing vue-template-babel-compiler
v1.2.0 and v2.0.0 with the plugins (among others): plugin-proposal-object-rest-spread
, plugin-transform-spread
and plugin-transform-destructuring
.
Am I missing something? Is there a better alternative in VueJs 2 to be able to compile these operators in templates (optional chaining, spread, destructuring, etc.) without all the babel-compiler thing?