demo环境:版本VUE2,html和test.json在同一个目录下
为甚不能set数据?
click{{gridData}}{{apiUrl}}
var demo = new Vue({
el: '#app',
data: {
gridData: "",
apiUrl: 'test.json'
},
created: function() {
this.getCustomers()
},
methods: {
getCustomers: function() {
this.$http.get(this.apiUrl)
.then((response) => {
console.log(response.success)
this.$set('gridData', response.success)
})
.catch(function(response) {
console.log(response)
})
}
}
})
test.json 就这样一个字段{success:1}
刚刚开始学VUE,请大家的多多指教