vue resource patch方法的传递数据 form data 为 [object Object]

今天在测试 iblog 登录时,传送过去的数据总是 [object Object],以至于后台识别不出来。

vue 使用了 vueResource 组件,登录方法为 patch。

经过探索,终于在官网的 document 上找到答案,就是传递数据时,需要加上 option 内容,值为'emulateJSON': true,如下:

this.$http.patch(url, data, {'emulateJSON': true})

这样 form data 就不会是  [object Object] 了。

posted @ 2019-04-18 09:13  lipohong  阅读(1854)  评论(0编辑  收藏  举报