為了讓admin管理系統(tǒng)適應(yīng)手機(jī)版,決定對首頁及各個功能頁進(jìn)行升級。以前用admin antd design作為腳手架進(jìn)行開發(fā)發(fā)現(xiàn)對手機(jī)版支持不好。這次用ant design的pro版進(jìn)行開發(fā),從新搭建前端開發(fā)框架。
成都創(chuàng)新互聯(lián)成都網(wǎng)站建設(shè)定制網(wǎng)站制作,是成都營銷推廣公司,為玻璃隔斷提供網(wǎng)站建設(shè)服務(wù),有成熟的網(wǎng)站定制合作流程,提供網(wǎng)站定制設(shè)計服務(wù):原型圖制作、網(wǎng)站創(chuàng)意設(shè)計、前端HTML5制作、后臺程序開發(fā)等。成都網(wǎng)站設(shè)計熱線:13518219792
之前框架用axios作為請求網(wǎng)絡(luò)的基礎(chǔ)組件,碰到了一些跨域問題,在我的另一篇里面介紹了解決方案。這次用的是dva/fetch里面的fetch請求網(wǎng)絡(luò)數(shù)據(jù),碰到新的跨域問題如下:
The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:8000' is therefore not allowed access.
此時server設(shè)置是這樣
header('Access-Control-Allow-Origin: *');
修改之后:
header('Access-Control-Allow-Origin:' . $_SERVER['HTTP_ORIGIN']);
又出現(xiàn)了新的問題:
The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Origin 'http://localhost:8000' is therefore not allowed access.
于是在server端又增加了:
header('Access-Control-Allow-Credentials: true');
問題得到解決。