简体   繁体   中英

Vuejs:Consider pre-initializing the property with the “data” option for more reliable reactivity and better performance

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?

This warning means you should init chosenFruite in your data like this:

var fruite = new Vue({
    el: '#fruite',
    data: {
        chosenfruite: '',
        items: [
            {message: 'apple'},
            {message: 'pear'},
            {message: 'peach'}
        ]
    },
    methods: {
        fillIn: function (item) {
            this.chosenfruite = item.message;
        }
    }
});

You can read more here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM