我正在嘗試在 Framework7 Vue 中創(chuàng)建一個(gè)簡(jiǎn)單的應(yīng)用程序。我正在使用最新版本。我有一個(gè)小的 api,我正在嘗試啟動(dòng)并運(yùn)行,但由于某種原因我無(wú)法測(cè)試我想要的代碼。當(dāng)我使用 promise.post、promise.get、promise.getJSON 連接時(shí),它工作正常,但如果我嘗試使用 promise.postJSON,它會(huì)失敗。我不明白為什么 CORS 只會(huì)拒絕 postJSON。不工作self.$f7.request.promise.postJSON( self.webapi.login, { email: self.email, password: self.password } );這些工作self.$f7.request.promise.getJSON( self.webapi.login, { email: self.email, password: self.password } );self.$f7.request.promise.get( self.webapi.login, { email: self.email, password: self.password } );self.$f7.request.promise.post( self.webapi.login, { email: self.email, password: self.password } );我的 API 中的 PHP 標(biāo)頭header("Access-Control-Allow-Origin: *");header("Access-Control-Allow-Methods: *");header("Access-Control-Allow-Headers: *");header("Access-Control-Max-Age: 1728000");API 返回樣本{"reply":"1","id":2,"token":";lk3984hq347y0q34h;q34kjhiq98u987oi4h","code":"123456"}
Framework7 Vue promise postJson CORS問(wèn)題
慕尼黑8549860
2022-11-12 13:25:21