0
虽然与vue.js玩弄我注意到在试图显示从一个API页面的数据,但在这里是很奇怪的一些奇怪的行为:Vue公司和REST API数据
- 使用VUE 2.0.0 ,我可以看到“标题”,但我有一个错误在开发控制台[见printscreen]
- 使用最新的vue版本,我看不到“标题”[和我在打印屏幕上有同样的错误]
这是正常的吗?
的源代码:
template:
'<div>'+
'Form with id = {{id}}'+
'<br/>'+
'has title = {{item.details.Title}}'+
'</div>',
data: function(){
return {
id: '',
item: {}
}
},
created: function() {
this.get()
},
methods: {
get: function() {
var self = this
id = window.location.hash
id = id.replace('#/whatever/','')
axiosInstance.get('/thebackendresource/'+id) // <--- make http calls etc
.then(function (response) {
self.id = id
self.item = response.data
console.log(self.item)
}).catch(function (error) {
console.log(error)
}
);
}
}
我希望我能调整从组件的生命周期这种行为,它的工作 –