add:okFly(ajax网络请求)
parent
aae4c59e7e
commit
aaa03fa2fa
|
|
@ -7,6 +7,12 @@
|
||||||
"spread": true,
|
"spread": true,
|
||||||
"isCheck": true
|
"isCheck": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"title": "测试",
|
||||||
|
"href": "pages/help/test.html",
|
||||||
|
"fontFamily": "ok-icon",
|
||||||
|
"icon": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "控制台示例",
|
"title": "控制台示例",
|
||||||
"href": "",
|
"href": "",
|
||||||
|
|
@ -67,7 +73,14 @@
|
||||||
"href": "pages/help/okLayer.html",
|
"href": "pages/help/okLayer.html",
|
||||||
"icon": "",
|
"icon": "",
|
||||||
"spread": false
|
"spread": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "okFly",
|
||||||
|
"href": "pages/help/okFly.html",
|
||||||
|
"icon": "",
|
||||||
|
"spread": false
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -29,6 +29,7 @@ if (!Object.assign) {
|
||||||
"okTab": "okmodules/okTab",
|
"okTab": "okmodules/okTab",
|
||||||
"okCountUp": "okmodules/okCountUp",
|
"okCountUp": "okmodules/okCountUp",
|
||||||
"okUtils": "okmodules/okUtils",
|
"okUtils": "okmodules/okUtils",
|
||||||
|
"okFly": "okmodules/okFly",
|
||||||
"okGVerify": "okmodules/okGVerify",
|
"okGVerify": "okmodules/okGVerify",
|
||||||
"qrcode": "okmodules/qrcode",
|
"qrcode": "okmodules/qrcode",
|
||||||
"okQrcode": "okmodules/okQrcode",
|
"okQrcode": "okmodules/okQrcode",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,132 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>okFly</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<link rel="stylesheet" href="../../css/oksub.css">
|
||||||
|
<style>
|
||||||
|
.ok-body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="ok-body">
|
||||||
|
<!--########################okLayer.confirm()########################-->
|
||||||
|
<blockquote class="layui-elem-quote">
|
||||||
|
<p>okFly(网络请求)</p>
|
||||||
|
</blockquote>
|
||||||
|
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||||
|
okFly.get(url, params, options).then(function(res){
|
||||||
|
console.log(res);
|
||||||
|
});
|
||||||
|
</blockquote>
|
||||||
|
<pre>
|
||||||
|
/**get请求*/
|
||||||
|
okFly.get("/test", {a:1,b:2});
|
||||||
|
|
||||||
|
/**post请求*/
|
||||||
|
okFly.post("/test", {a:1,b:2}).then(function(res){
|
||||||
|
console.log(res);
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
</pre>
|
||||||
|
<table class="layui-table">
|
||||||
|
<colgroup>
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>参数</th>
|
||||||
|
<th>类型</th>
|
||||||
|
<th>描述</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>url</td>
|
||||||
|
<td>String</td>
|
||||||
|
<td>请求地址</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>params</td>
|
||||||
|
<td>JSON</td>
|
||||||
|
<td>请求参数</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>options</td>
|
||||||
|
<td>JSON</td>
|
||||||
|
<td>配置项</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<blockquote class="layui-elem-quote layui-quote-nm">
|
||||||
|
options: 配置说明
|
||||||
|
</blockquote>
|
||||||
|
<table class="layui-table">
|
||||||
|
<colgroup>
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
<col>
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>参数</th>
|
||||||
|
<th>类型</th>
|
||||||
|
<th>描述</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>headers</td>
|
||||||
|
<td>JSON</td>
|
||||||
|
<td>配置请求头</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<script src="../../lib/layui/layui.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
layui.use(["util", "code", "okFly"], function () {
|
||||||
|
let util = layui.util;
|
||||||
|
let code = layui.code;
|
||||||
|
let okFly = layui.okFly;
|
||||||
|
|
||||||
|
util.fixbar({});
|
||||||
|
|
||||||
|
code({
|
||||||
|
elem: 'pre',
|
||||||
|
title: "代码示例"
|
||||||
|
});
|
||||||
|
okFly.get("api/music/listmusic", {
|
||||||
|
id: 8,
|
||||||
|
a: "1",
|
||||||
|
b: 2
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
"adfasd": 456465
|
||||||
|
}
|
||||||
|
}).then(function (res) {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
|
||||||
|
okFly.post("api/music/listmusic", {
|
||||||
|
id: 8,
|
||||||
|
a: "1",
|
||||||
|
b: 2
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
"hello": 456465
|
||||||
|
}
|
||||||
|
}).then(function (res) {
|
||||||
|
console.log(res);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
@ -4,8 +4,6 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Title</title>
|
<title>Title</title>
|
||||||
<link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
|
||||||
<link rel="stylesheet" href="../../lib/loading/okLoading.css"/>
|
|
||||||
<script type="text/javascript" src="../../lib/loading/okLoading.js"></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
@ -14,8 +12,26 @@ dsafasdf
|
||||||
</html>
|
</html>
|
||||||
<script src="../../lib/layui/layui.js"></script>
|
<script src="../../lib/layui/layui.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
layui.use(["jquery"], function () {
|
layui.use(["jquery","okFly"], function () {
|
||||||
let $ = layui.jquery;
|
let $ = layui.jquery,
|
||||||
okLoading.close($);
|
okFly = layui.okFly;
|
||||||
|
|
||||||
|
okFly.post("/test", {
|
||||||
|
a: "as",
|
||||||
|
b: 125
|
||||||
|
}).then(function (res) {
|
||||||
|
console.log(res);
|
||||||
|
}).catch(function (err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
okFly.get("/test", {
|
||||||
|
a: "as",
|
||||||
|
b: 125
|
||||||
|
}).then(function (res) {
|
||||||
|
console.log(res);
|
||||||
|
}).catch(function (err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue