83 lines
2.1 KiB
HTML
83 lines
2.1 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html>
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<title>okUtils</title>
|
||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||
|
|
<link rel="stylesheet" href="../../lib/layui/css/layui.css">
|
||
|
|
<style>
|
||
|
|
.ok-body {
|
||
|
|
padding: 20px;
|
||
|
|
}
|
||
|
|
</style>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div class="ok-body">
|
||
|
|
<blockquote class="layui-elem-quote">
|
||
|
|
<p>主要讲述如何okUtils封装的工具类使用方法。</p>
|
||
|
|
</blockquote>
|
||
|
|
<!--1、okUtils.ajax-->
|
||
|
|
<blockquote class="layui-elem-quote layui-quote-nm">
|
||
|
|
okUtils.ajax(url, type, params, load);
|
||
|
|
</blockquote>
|
||
|
|
<pre>
|
||
|
|
okUtils.ajax("/permission/tree", "get", null, true).done(function (response) {
|
||
|
|
console.log(response);
|
||
|
|
}).fail(function (error) {
|
||
|
|
console.log(error);
|
||
|
|
});
|
||
|
|
</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>type</td>
|
||
|
|
<td>String</td>
|
||
|
|
<td>请求类型</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>params</td>
|
||
|
|
<td>String</td>
|
||
|
|
<td>请求参数</td>
|
||
|
|
</tr>
|
||
|
|
<tr>
|
||
|
|
<td>load</td>
|
||
|
|
<td>Boolean</td>
|
||
|
|
<td>是否显示loading</td>
|
||
|
|
</tr>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
</div>
|
||
|
|
</body>
|
||
|
|
</html>
|
||
|
|
<script src="../../lib/layui/layui.js"></script>
|
||
|
|
<script type="text/javascript">
|
||
|
|
layui.use(["util", "code"], function () {
|
||
|
|
let util = layui.util;
|
||
|
|
let code = layui.code;
|
||
|
|
|
||
|
|
util.fixbar({});
|
||
|
|
|
||
|
|
code({
|
||
|
|
elem: 'pre',
|
||
|
|
title: "代码示例"
|
||
|
|
});
|
||
|
|
});
|
||
|
|
</script>
|