this.$http vueJs not set

后端 未结 1 1223
梦毁少年i
梦毁少年i 2021-02-13 11:42

I\'m playing with vueJS and trying to grab some data from an ajax request.

Heres my code:

new Vue({
el: \'#recipeList\',

ready: function () {
    this.f         


        
1条回答
  •  花落未央
    2021-02-13 12:36

    $http.get is for Vue Resource. Make sure you are pulling that in properly. i.e., add vue-resource to your package.json, then npm install, then...

    var Vue = require('vue');
    
    Vue.use(require('vue-resource'));
    

    Also, make sure your root path is set up properly.

    Vue.http.options.root = '/your-root-path';
    

    Hope it helps! :-)

    0 讨论(0)
提交回复
热议问题