Global

Members

VERSION

Description:
  • util-helpers 版本号

Source:
Since:
  • 4.18.0

util-helpers 版本号

Type Definitions

AjaxOptions

Description:
  • ajax 配置项

Source:
See:
Properties:
Name Type Attributes Default Description
method string <optional>
"get"

创建请求时使用的方法

async boolean <optional>
true

是否异步执行操作

user string | null <optional>
null

用户名,用于认证用途

password string | null <optional>
null

密码,用于认证用途

headers Object <optional>

自定义请求头

responseType string <optional>

响应类型

timeout number <optional>

请求超时的毫秒数

withCredentials boolean <optional>
false

跨域请求时是否需要使用凭证

data * <optional>
null

请求体被发送的数据

options.onReadyStateChange function <optional>

当 readyState 属性发生变化时触发

onLoadStart function <optional>

接收到响应数据时触发

onProgress function <optional>

请求接收到更多数据时,周期性地触发

onAbort function <optional>

当 request 被停止时触发,例如当程序调用 XMLHttpRequest.abort() 时

onTimeout function <optional>

在预设时间内没有接收到响应时触发

onError function <optional>

当 request 遭遇错误时触发

onLoad function <optional>

请求成功完成时触发

onLoadEnd function <optional>

请求结束时触发,无论请求成功 (load) 还是失败 (abort 或 error)

ajax 配置项

Type:
  • Object

CacheOptions

Description:
  • 缓存配置

Source:
Properties:
Name Type Attributes Default Description
useCache boolean <optional>
true

是否使用缓存

autoRevokeOnDel boolean <optional>
true

删除时自动释放缓存

缓存配置

Type:
  • Object

DownloadOptions

Description:
  • 下载配置项

Source:
Properties:
Name Type Attributes Description
options.fileName string <optional>

文件名称

options.type string <optional>

MIME 类型

options.dataType 'url' | 'text' <optional>

手动设置数据类型,默认会根据传入的数据判断类型,主要是为了区分 url 和 text 。
如果你要下载的文本是 url ,请设置 'text' ;如果你要下载的 url 是绝对/相对路径,请设置 'url' 。

options.transformRequest TransformRequest <optional>

请求前触发,XHR 对象或配置调整

options.transformResponse TransformResponse <optional>

请求成功后触发,在传递给 then/catch 前,允许修改响应数据

下载配置项

Type:
  • Object

ImageInfo

Description:
  • 图片信息

Source:
Properties:
Name Type Description
width number

宽度

height number

高度

contrast string

宽高比

measure string

尺寸

size string

大小

bytes number

大小,单位字节

image HTMLImageElement

HTML图片元素

blob Blob

图片 Blob 对象

图片信息

Type:
  • Object

ImageWithBlob

Description:
  • HTML图片元素和 blob 对象

Source:
Properties:
Name Type Description
image HTMLImageElement

HTML图片元素

blob Blob

blob 对象

HTML图片元素和 blob 对象

Type:
  • Object

PasswordContaines

Description:
  • 验证密码的包含内容

Source:
Properties:
Name Type Description
number boolean

包含数字

lowerCaseLetter boolean

包含小写字母

upperCaseLetter boolean

包含大写字母

specialCharacter boolean

包含特殊字符

unallowableCharacter boolean

包含非法字符

验证密码的包含内容

Type:
  • Object

TransformRequest(options) → {AjaxOptions|Promise.<AjaxOptions>}

Source:
Parameters:
Name Type Description
options AjaxOptions

ajax 配置项

Returns:
Type
AjaxOptions | Promise.<AjaxOptions>

TransformResponse(res) → {Blob|Promise.<Blob>}

Source:
Parameters:
Name Type Description
res Blob

响应的Blob对象。如果你通过 transformRequest 修改了 responseType ,该参数将是该类型响应值。

Returns:
Type
Blob | Promise.<Blob>

ValidatePasswordReturn

Description:
  • 验证结果

Source:
Properties:
Name Type Description
validated boolean

验证结果,根据密码强度、是否包含非法字符得出

level number

强度级别,包含数字/大小写字母/特殊字符

containes PasswordContaines

包含内容

验证结果

Type:
  • Object