錯誤:Failed to load http://zmn_mn_erp.com/index/activity.Activitymanage/sendCode: Req Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.html
解決辦法:ios
在請求時候,,設置了header的content-type屬性axios
this.axios({ method: 'post', url: '/index/activity.Activitymanage/sendCode', headers:{ 'Content-Type':'application/x-www-form-urlencoded' }, data:{ phone:18201458175 } }).then(fucntion(res){})
或app
this.axios.post('/index/activity.Activitymanage/sendCode',getcode,{ headers:{ 'Content-Type':'application/x-www-form-urlencoded' } }).then(fucntion(res){})
,但這樣傳值的時候,須要這樣
post
var getcode = new URLSearchParams(); getcode.append('phone',me.params.leads_phone)