Vue-cli: TypeError: Invalid attempt to spread non-iterable instance

Created on 16 May 2018  ·  3Comments  ·  Source: vuejs/vue-cli

Version

3.0.0-beta.10

Reproduction link

http://null

Steps to reproduce

I upgraded from beta.9 to beta.10.

1.use es6 ...array ,TypeError: Invalid attempt to spread non-iterable instance.

2.v-for object ,Will show "default " the property.

What is expected?

Project normal operation.

What is actually happening?

Project error.


中文描述:

从beta9升级到beta10之后,

1.使用 ...array 这种方式展开一个数组会报错:TypeError: Invalid attempt to spread non-iterable instance.

2.项目中使用v-for迭代一个对象的时候会将 default 这个保留字也作为一般属性进行了渲染,

初步怀疑可能与 @vue/[email protected] 升级有关.但不确定.重写了一个例子也可以复现这个问题.

内部项目没有在线部署过无法提供重现链接.抱歉.

如果可以,请使用中文回复.谢谢.

Most helpful comment

... 不要将 object 的内容扩展到一个数组,也不要将数组的内容扩展到 object

All 3 comments

请遵循要求提供重现。内部项目不是理由,重现本来就应该是单独的。

... 不要将 object 的内容扩展到一个数组,也不要将数组的内容扩展到 object

@ CodeApePro 目测是你在使用"..."扩展运算符的时候,没有用“[]”包住造成的(猜测你直接这样用的:...array ),正确的写法是:[...array];如果是对象则正确的写法是:{...props};

Was this page helpful?
0 / 5 - 0 ratings