I have following code
<div id="vue-instance">
</div>
JS
var vm = new Vue({
el: '#vue-instance',
data: {
},
ready:function(){
this.loadCountries();
},
methods:{
loadCountries(){
this.$http.get('https://restcountries.eu/rest/v1/all',function(data){
console.log(data);
})
}
}
});
When I run the above code it gives me following error
Uncaught TypeError: Cannot read property 'get' of undefined
I have a fiddle
JsFiddle
Help would be much appreciated
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…