0.0.4 • Published 2 years ago
tc-util v0.0.4
tc-util
English | Update Log | Feedback bug | Gitee
0. 模块
- byte
- constant
- cookie
- datetime
- dom
- extend
- gbk
- is
- lib
- math
- polyfill
- storage
- tool
- event
- md5
1. 安装使用
1.1 npm
npm i tc-util
完整引用
import tcUtil from 'tc-util';
按需引入
import tcMath from 'tc-util/math';
import {formatDate} from 'tc-util/datetime';
1.2 cdn 引入
完整引用
<script src="https://cdn.jsdelivr.net/npm/tc-util/tc-util.min.js"></script>
<script>
console.log(tcUtil);
</script>
按需引入
<script src="https://cdn.jsdelivr.net/npm/tc-util/math.js"></script>
<script>
console.log(tcMath);
</script>
2. api
2.1. byte
- stringToBytes
- stringToGbkBytes
- bytesToString
- bytesToNumber
2.2. constant
- TYPE
- UINT_TYPE
- VERSION
- COMPARE_RESULT
2.3. cookie
- getCookie
- setCookie
- removeCookie
2.4. datetime
- getDaysInMonth
- getFirstDayWeekInMonth
- formatTime
- formatDate
- timeToJson
- dateToJson
- timeToDate
- dateToTime
- nowTime
- nowDate
- msToSecond
- secondToMs
- minuteToMs
- hourToMs
2.5. dom
- $: 请参考 easy-dom-util
- registDisableContextMenu
- disableDefaultEvent
- onPageShowHide
2.6. extend
- String
- Array
- Number
- Function
- Object
- Json
2.7. gbk
- encodeGBK
- decodeGBK
2.8. is
- isUndf
- isFunc
- isObject
- isJson
- isJsonOrArray
- isNumber
- isNull
- isBool
- isString
- isType
- isArray
- isPC
- isMobile
- isIOS
- isAndroid
- isWX
- isQQ
- isTenVideo
- isWxMiniProgram
- isIOSWx
- isIPAddress
- isInited
2.9. lib
- creatEventReady
- createDotAnimation
- createState
- createStatus
2.10. math
- countDistance
- countDistanceByDiff
- countSumOfSquare
- countValueByRateAndRange
- circleToRect
- isPointInRect
- isPointInCircle
- countPosDiffByStep
2.11. polyfill
- keys
- values
- assign
2.12. storage
- getStorage
- setStorage
- removeStorage
2.13. tool
tcUtil._
- getUrlParam
- parseUrlParam
- copy
- type
- random
- download
- execute
- importScript
- readFile
- mapArray
- mapJson
- parseJSON
- pick
- pickAttr
- pickTo
- removeRedundantAttrInObject
- getUUID
- boolPipe
- throttle
- countImgSize
- compareVersion
- versionToArray
2.14. event
请参考 tc-util
2.15 md5
- md5