摘要:搭建一個(gè)代理服務(wù)器里面找到添加請(qǐng)求地址相當(dāng)于一個(gè)代替的表示自定義請(qǐng)求成功
1.搭建一個(gè)代理服務(wù)器
config/index.js 里面找到proxyTable :{}
添加
proxyTable: { "/api": { target: "http://192.168.13.109/public/index.php/api/",//請(qǐng)求地址 changeOrigin: true, pathRewrite: { "^/api": "/" //相當(dāng)于一個(gè)代替的表示 自定義 } } },
const API = "/api/admin/login"; stream.fetch( { method: "POST", url: API, type: "json", headers: { "Content-Type": "application/x-www-form-urlencoded" }, mode:"cors", body:"admin_name=1&admin_password=2" }, function(ret) { console.log(ret); if (!ret.ok) { modal.toast({ message: "Network Error!", duration: 3 }); } else { modal.toast({ message: "請(qǐng)求成功!" + body, duration: 3 }); } } );
文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請(qǐng)注明本文地址:http://m.hztianpu.com/yun/102999.html
摘要:各種錯(cuò)誤處理錯(cuò)誤使用模塊發(fā)送請(qǐng)求時(shí)報(bào)錯(cuò)。不支持但靠后的元素層級(jí)更高支持四種偽類(lèi)所有組件都支持但只有組件和組件支持。篇不支持值僅支持和如果定位元素超過(guò)容器邊界,在下,超出部分將不可見(jiàn),原因在于端元素默認(rèn)值為,但目前暫不支持設(shè)置。 各種錯(cuò)誤處理 1.錯(cuò)誤:ReferenceError: global is not defined 使用stream模塊發(fā)送請(qǐng)求時(shí)報(bào)錯(cuò)。 showImg(htt...
閱讀 3569·2021-10-18 13:30
閱讀 3010·2021-10-09 09:44
閱讀 2035·2019-08-30 11:26
閱讀 2430·2019-08-29 13:17
閱讀 812·2019-08-29 12:17
閱讀 2312·2019-08-26 18:42
閱讀 576·2019-08-26 13:24
閱讀 3012·2019-08-26 11:39