For more information, please kindly advise, when I use vue-resource for ajax requests, the response is always null, and JQuery requests can respond normally, {code ...}
For more information,
When I use vue-resource for ajax requests, the response is always null, while the JQuery request can respond normally,
Created: function () {var vm = this; $. get ('/A', function (data) {vm. list = data;}); // JQuery requests this. $ http. get ('/A', function (data) {vm. list = data;}); // Vue-resource Request },
Reply content:
For more information,
When I use vue-resource for ajax requests, the response is always null, while the JQuery request can respond normally,
Created: function () {var vm = this; $. get ('/A', function (data) {vm. list = data;}); // JQuery requests this. $ http. get ('/A', function (data) {vm. list = data;}); // Vue-resource Request },
Vue. http. options. emulateJSON = true
@ Alimama, but adding this sentence does not work ,,
After reading it, what it receives isResponse {url = "/a", OK = true, status = 200, more ...}Such an object.
In this way, I can access it normally.
`this.$http.get('/a').then(({data})=>{ vm.list = data; console.log(data); },(data)=>{ console.log(data); })`