首先切到项目中安装
npm i flyio -S
然后就是使用:
<script>
//引入
import Fly from "flyio/dist/npm/wx";
export default {......
mounted(){let fly = new Fly;
let HostUrl = "http://xxxxxx/buildsx/api/isFaceImg";
let paras = {
"id":"xxx",
"type":"0"};
//发起请求
fly.post(HostUrl,paras)
.then(function(response){
/*
data:后边是我们要的结果
*/
console.log(response.data)
}).catch(function(error){
console.log(error)});
},
}</script>
如果出现合法域名校验出错,不在以下合法域名列表中,请看另一篇文章
POST:https://blog.csdn.net/dangbai01_/article/details/85703739