UNPKG

js-wrench

Version:

JS函数库

600 lines (166 loc) 9.82 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Format</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Class: Format</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>Format<span class="signature">()</span><span class="type-signature"></span></h2> </header> <article> <div class="container-overview"> <h4 class="name" id="Format"><span class="type-signature"></span>new Format<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> 格式化类 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="format.js.html">format.js</a>, <a href="format.js.html#line1">line 1</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="date"><span class="type-signature"></span>date<span class="signature">(date, format<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 简单的日期格式化 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>date</code></td> <td class="type"> <span class="param-type">Date</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last">Data 日期</td> </tr> <tr> <td class="name"><code>format</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> "-" </td> <td class="description last">string 默认-</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="format.js.html">format.js</a>, <a href="format.js.html#line29">line 29</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {string} 返回格式化后的日期 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>date(new Date()) => 2019-6-12 13:43:23</code></pre> <h4 class="name" id="money"><span class="type-signature"></span>money<span class="signature">(str, radix<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 对金额进行千位分隔 </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>str</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last">需要格式化的金额</td> </tr> <tr> <td class="name"><code>radix</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">如果有小数位 保留[radix]位数</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="format.js.html">format.js</a>, <a href="format.js.html#line52">line 52</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> {string} 返回格式化后的金额 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>money("1223547.68") => 1,223,547.68</code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="CheckRegExp.html">CheckRegExp</a></li><li><a href="Format.html">Format</a></li></ul><h3>Global</h3><ul><li><a href="global.html#bind">bind</a></li><li><a href="global.html#debounce">debounce</a></li><li><a href="global.html#deepCopy">deepCopy</a></li><li><a href="global.html#each">each</a></li><li><a href="global.html#empty">empty</a></li><li><a href="global.html#extend">extend</a></li><li><a href="global.html#getBrowserType">getBrowserType</a></li><li><a href="global.html#getUID">getUID</a></li><li><a href="global.html#getVerifyCode">getVerifyCode</a></li><li><a href="global.html#has">has</a></li><li><a href="global.html#includes">includes</a></li><li><a href="global.html#indexOf">indexOf</a></li><li><a href="global.html#isAndroid">isAndroid</a></li><li><a href="global.html#isArray">isArray</a></li><li><a href="global.html#isBool">isBool</a></li><li><a href="global.html#isDate">isDate</a></li><li><a href="global.html#isFn">isFn</a></li><li><a href="global.html#isIOS">isIOS</a></li><li><a href="global.html#isiPad">isiPad</a></li><li><a href="global.html#isMap">isMap</a></li><li><a href="global.html#isNaN">isNaN</a></li><li><a href="global.html#isNull">isNull</a></li><li><a href="global.html#isNumber">isNumber</a></li><li><a href="global.html#isObj">isObj</a></li><li><a href="global.html#isPC">isPC</a></li><li><a href="global.html#isPrimitive">isPrimitive</a></li><li><a href="global.html#isPromise">isPromise</a></li><li><a href="global.html#isRegExp">isRegExp</a></li><li><a href="global.html#isSet">isSet</a></li><li><a href="global.html#isString">isString</a></li><li><a href="global.html#isSymbol">isSymbol</a></li><li><a href="global.html#isUndefined">isUndefined</a></li><li><a href="global.html#isWPhone">isWPhone</a></li><li><a href="global.html#ltrim">ltrim</a></li><li><a href="global.html#noop">noop</a></li><li><a href="global.html#random">random</a></li><li><a href="global.html#remove">remove</a></li><li><a href="global.html#reverse">reverse</a></li><li><a href="global.html#rtrim">rtrim</a></li><li><a href="global.html#throttle">throttle</a></li><li><a href="global.html#toFirstLower">toFirstLower</a></li><li><a href="global.html#toFirstUpper">toFirstUpper</a></li><li><a href="global.html#toKeys">toKeys</a></li><li><a href="global.html#toLowerCase">toLowerCase</a></li><li><a href="global.html#toParam">toParam</a></li><li><a href="global.html#toQuery">toQuery</a></li><li><a href="global.html#toUpperCase">toUpperCase</a></li><li><a href="global.html#toValues">toValues</a></li><li><a href="global.html#trim">trim</a></li><li><a href="global.html#typeOf">typeOf</a></li><li><a href="global.html#unique">unique</a></li><li><a href="global.html#uniqueToArray">uniqueToArray</a></li><li><a href="global.html#uniqueToNumber">uniqueToNumber</a></li><li><a href="global.html#uniqueToSizzArray">uniqueToSizzArray</a></li><li><a href="global.html#uniqueToSttring">uniqueToSttring</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Wed Dec 16 2020 10:48:43 GMT+0800 (GMT+08:00) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>