Discussion icon indicating copy to clipboard operation
Discussion copied to clipboard

Consider pre-initializing the property with the "data" option for more reliable reactivity and better performance

Open zwl1619 opened this issue 9 years ago • 3 comments
trafficstars

this is my code, https://jsfiddle.net/0od4hwmh/2/ it can be running when pick it out, but when put it in my project of laravel 5.3, there is an error:

[Vue warn]: You are setting a non-existent path "chosenFruite" on a vm instance. Consider pre-initializing the property with the "data" option for more reliable reactivity and better performance.

What is the probable problem?

zwl1619 avatar Aug 13 '16 18:08 zwl1619

chosenfruite was outside of the data property. It should be initialized in the data, like the items array.

Example: https://jsfiddle.net/0od4hwmh/3/

LinusBorg avatar Aug 13 '16 20:08 LinusBorg

@LinusBorg
it doesn't work.

zwl1619 avatar Aug 13 '16 20:08 zwl1619

Well, my provided example does work: it sets chosenfruite correctly, and no warning is displayed.

What does not work for you?

LinusBorg avatar Aug 13 '16 20:08 LinusBorg