在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML5  HTML/ vue+axios

vue+axios

第一種請求方式:

let customer_id = localStorage.getItem('customer_id')
this.$http.post('/health_record/health_status_list.do',customer_id)

使用這種方式從請求回來的數(shù)據(jù)是空的

clipboard.png

第二種請求方式:

let param = new URLSearchParams();
param.append('customer_id', customer_id);
this.$http({
    method: 'post',
    url: '/health_record/health_status_list.do',
    data: param
})

使用這種方式就有數(shù)據(jù)
clipboard.png

問題描述

問題出現(xiàn)的環(huán)境背景及自己嘗試過哪些方法

相關代碼

// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)

你期待的結果是什么?實際看到的錯誤信息又是什么?

回答
編輯回答
維他命

https://www.cnblogs.com/cooll...

這個是參數(shù)序列化的問題

如果我需要發(fā)送序列化參數(shù),我會引入qs

這樣做的效果就與URLSearchParams相同
(因為URLSearchParams有兼容性問題)

建議多看看http相關知識,學會用f12的network調試ajax請求
http://www.java1234.com/a/jav...

2017年12月9日 09:20
編輯回答
枕邊人
let param = new URLSearchParams();
param.append('customer_id', customer_id);
this.$http.post('/health_record/health_status_list.do',param)

Content-type

2018年9月23日 20:37