Subscribe on changes!

Using defineProps in a multiple-variable declaration causes compiler to produce invalid code.

avatar
May 7th 2021

Version

3.0.11

Reproduction link

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aDE+e3sgbXNnIH19PC9oMT5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQgc2V0dXA+XG4gIGltcG9ydCB7ZGVmaW5lUHJvcHMsIHJlZn0gZnJvbSAndnVlJztcblx0Y29uc3QgcHJvcHMgPSBkZWZpbmVQcm9wcyhbJ2l0ZW0nXSksXG4gICAgICAgIGN1cnJlbnRDb21wID0gcmVmKG51bGwpO1xuPC9zY3JpcHQ+IiwiQ29tcC52dWUiOiIifQ==

Steps to reproduce

declare props with other variables

What is expected?

No error.

What is actually happening?

When I declare props, if I declare it with other variables, it will be compiled with an extra comma, resulting in an error on the page. But not if I declare it separately. I made a video. 当声明props的时候,如果跟其他变量一起声明,在编译后会多一个逗号导致报错,但是分开声明就不会。

https://user-images.githubusercontent.com/3335540/117440088-34113500-af66-11eb-9175-47c59253eb05.mp4