2
我一直在爲這種方式掙扎太久了。 Vue引發錯誤,該名稱未定義。它不是從開始定義,而是在Vue創建時定義的。Vue.js 2.0 v-model對ajax提取的數據返回錯誤
clients.php
<input type="text" v-bind:value="customers[<? echo $this->client['id'];?>].name">
應用數據
var app = new Vue({
el: '#app',
data: {
customers: {},
}
})
app.js
created: function(){
// fetches clients via AJAX and places them in customer object
this.get_clients()
}
console error: TypeError: Cannot read property 'name' of undefined