0.1.1 • Published 3 years ago
xbot-fe-utils v0.1.1
xybot-front-utils
影刀前端方法库
使用方法
npm intsall xybot-front-utilssetCookie
设置cookie
参数
name(string): cookie的name值value(string) cookie的value值
返回
例子
import { setCookie } from 'xybot-front-utils'
setCookie(name, value)getCookie
获取cookie
参数
name(string): cookie的name值
返回
(sting):返回cookie值
例子
import { getCookie } from 'xybot-front-utils'
getCookie(name)delCookie
删除cookie
参数
name(string): cookie的name值
返回
例子
import { delCookie } from 'xybot-front-utils'
delCookie(name)formatNumber
格式化时间 +0
参数
number(string|number) 待处理时间
返回
(string | number): 返回处理之后的时间
例子
import { formatNumber } from 'xybot-front-utils'
formatNumber(9)
// => 09
formatNumber(10)
// => 10formatDate
格式化时间 2022-01-01 12:12:12
参数
timestamp(number) 待处理时间戳beforeSeparate(string) 年月日分隔符 默认 -afterSeparate(string) 时分秒分隔符 默认 :
返回
(string): 返回处理之后的时间
例子
import { formatDate } from 'xybot-front-utils'
formatDate(1641784747332)
// => 2022-01-10 11:19:07getFormatTime
格式化时间 1641799837000 => 2分钟前
参数
timestamp(number) 待处理时间戳
返回
(string): 返回处理之后的时间
例子
import { getFormatTime } from 'xybot-front-utils'
getFormatTime(1641784747332)
// => 2分钟前0.1.1
3 years ago