这是我的代码,https://jsfiddle.net/0od4hwmh/2/
它可以在取出时运行,
但是当把它放在我的laravel 5.3项目中时,
有一个错误:
[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.
可能的问题是什么?
答案 0 :(得分:2)
此警告表示您应在chosenFruite
中初始化data
,如下所示:
var fruite = new Vue({
el: '#fruite',
data: {
chosenfruite: '',
items: [
{message: 'apple'},
{message: 'pear'},
{message: 'peach'}
]
},
methods: {
fillIn: function (item) {
this.chosenfruite = item.message;
}
}
});
您可以阅读更多here