When vue-resource $http.get requests, the value of res is undefined and catch can get the request value?

there are js/cart.js, cart.html and cartdata.json, files on the same layer in the root directory. Use

in cart.js.
this.$http.get("cartData.json").then(function (res) {
     this.productList = res.body.result.list;
}).catch(function (res) {
     this.productList = res.data.result.list
     console.log("catch:", res);
})

however, the value of res cannot be taken

Jun.22,2021

should I quote the path?


has been resolved because cross-domain requests are not allowed within chrome

Menu