Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
G8866
unidocs-zh
提交
9ea4d89b
unidocs-zh
项目概览
G8866
/
unidocs-zh
与 Fork 源项目一致
Fork自
DCloud / unidocs-zh
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9ea4d89b
编写于
9月 01, 2023
作者:
G
git_robot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新 utsApiJson.json
上级
780d870e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
docs/.vuepress/utils/utsApiJson.json
docs/.vuepress/utils/utsApiJson.json
+1
-1
未找到文件。
docs/.vuepress/utils/utsApiJson.json
浏览文件 @
9ea4d89b
{
"exit"
:{
"name"
:
"## uni.exit(options?) @exit"
,
"description"
:
"
\n
退出当前应用"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ExitOptions](#exitoptions) | 否 | - |
\n
#### ExitOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([ExitSuccess](#exitsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ExitSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | - |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | x | x | x |
\n
"
,
"tutorial"
:
""
},
"previewImage"
:{
"name"
:
"## uni.previewImage(options) @previewimage"
,
"description"
:
"预览图片"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [PreviewImageOptions](#previewimageoptions) | 是 | - |
\n
#### PreviewImageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| count | string | 否 | 当前显示图片的链接,不填则默认为 urls 的第一张 |
\n
| current | any | 否 | current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。App平台在 1.9.5至1.9.8之间,current为必填。不填会报错 |
\n
| urls | Array
\\
<string
\\
> | 是 | 需要预览的图片链接列表 |
\n
| indicator | string | 否 | 图片指示器样式 - default: 底部圆点指示器 - number: 顶部数字指示器 - none: 不显示指示器 |
\n
| loop | boolean | 否 | 是否可循环预览 |
\n
| longPressActions | [LongPressActionsOptions](#longpressactionsoptions) | 否 | 长按图片显示操作菜单,如不填默认为保存相册,1.9.5 起支持。 |
\n
| success | ([PreviewImageSuccessCallback](#previewimagesuccesscallback)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([PreviewImageFailCallback](#previewimagefailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### LongPressActionsOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| itemList | Array
\\
<string
\\
> | 是 | 按钮的文字数组 |
\n
| itemColor | string | 否 | 按钮的文字颜色,字符串格式,默认为
\"
#000000
\"
|
\n
| success | ([LongPressActionsSuccessData](#longpressactionssuccessdata)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | (any) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
###### LongPressActionsSuccessData
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| tapIndex | number | 是 | 接口调用失败的回调函数 |
\n
| index | number | 是 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### PreviewImageSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errSubject | string | 是 | - |
\n
| errMsg | string | 是 | - |
\n\n
##### PreviewImageFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[previewImage](http://uniapp.dcloud.io/api/media/image?id=previewimage)
\n
"
},
"closePreviewImage"
:{
"name"
:
"## uni.closePreviewImage(options) @closepreviewimage"
,
"description"
:
"关闭图片预览"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ClosePreviewImageOptions](#closepreviewimageoptions) | 是 | - |
\n
#### ClosePreviewImageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([ClosePreviewImageSuccessCallback](#closepreviewimagesuccesscallback)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ClosePreviewImageFailCallback](#closepreviewimagefailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ClosePreviewImageSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n\n
##### ClosePreviewImageFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[closePreviewImage](http://uniapp.dcloud.io/api/media/image?id=closepreviewimage)
\n
"
},
"showToast"
:{
"name"
:
"## uni.showToast(options) @showtoast"
,
"description"
:
"
\r\n
uni.showToast函数定义
\r\n
弹出toast
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowToastOptions](#showtoastoptions) | 是 | uni.showToast参数定义 |
\n
#### ShowToastOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 是 | 提示的内容,长度与 icon 取值有关。 |
\n
| icon | string | 否 | icon值说明 success: 显示成功图标,error: 显示错误图标; fail: 显示错误图标,此时title文本无长度显示; exception: 显示异常图标,此时title文本无长度显示; loading: 显示加载图标;none: 不显示图标。 |
\n
| image | string | 否 | 自定义图标的本地路径(app端暂不支持gif) |
\n
| mask | boolean | 否 | 是否显示透明蒙层,防止触摸穿透,默认:false |
\n
| duration | number | 否 | 提示的延迟时间,单位毫秒,默认:1500 |
\n
| position | string | 否 | position值说明(仅App生效) top: 居上显示; center: 居中显示;bottom: 居底显示 |
\n
| success | ([ShowToastSuccess](#showtoastsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowToastFail](#showtoastfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ShowToastFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 1001:title is null |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showToast](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast)
\n
"
},
"hideToast"
:{
"name"
:
"## uni.hideToast() @hidetoast"
,
"description"
:
"
\r\n
uni.hideToast函数定义
\r\n
隐藏toast
\r\n
"
,
"param"
:
""
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[hideToast](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hidetoast)
\n
"
},
"showLoading"
:{
"name"
:
"## uni.showLoading(options) @showloading"
,
"description"
:
"
\r\n
uni.showLoading函数定义
\r\n
弹出loading
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowLoadingOptions](#showloadingoptions) | 是 | uni.showLoading参数定义 |
\n
#### ShowLoadingOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 是 | 提示的内容,长度与 icon 取值有关。 |
\n
| mask | boolean | 否 | 是否显示透明蒙层,防止触摸穿透,默认:false |
\n
| success | ([ShowLoadingSuccess](#showloadingsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowLoadingFail](#showloadingfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ShowLoadingFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 1001:title is null |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showLoading](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading)
\n
"
},
"hideLoading"
:{
"name"
:
"## uni.hideLoading() @hideloading"
,
"description"
:
"
\r\n
uni.hideLoading函数定义
\r\n
隐藏loading
\r\n
"
,
"param"
:
""
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[hideLoading](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hideloading)
\n
"
},
"showModal"
:{
"name"
:
"## uni.showModal(options) @showmodal"
,
"description"
:
"
\r\n
uni.showModal 函数定义
\r\n\r\n
弹出modal
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowModalOptions](#showmodaloptions) | 是 | uni.showModal 参数定义 |
\n
#### ShowModalOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 否 | 提示的标题 |
\n
| content | string | 否 | 提示的内容 |
\n
| showCancel | boolean | 否 | |
\n
| cancelText | string | 否 | 取消按钮的文字,默认为
\"
取消
\"
|
\n
| cancelColor | string | 否 | 取消按钮的文字颜色,默认为
\"
#000000
\"
|
\n
| confirmText | string | 否 | 确定按钮的文字,默认为
\"
确定
\"
|
\n
| confirmColor | string | 否 | 确定按钮的文字颜色 |
\n
| editable | boolean | 否 | |
\n
| placeholderText | string | 否 | 显示输入框时的提示文本 |
\n
| success | ([ShowModalSuccess](#showmodalsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowModalFail](#showmodalfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ShowModalSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| confirm | boolean | 是 | 为 true 时,表示用户点击了确定按钮 |
\n
| cancel | boolean | 是 | 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) |
\n
| content | string | 否 | editable 为 true 时,用户输入的文本 |
\n\n
##### ShowModalFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showModal](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal)
\n
"
},
"showActionSheet"
:{
"name"
:
"## uni.showActionSheet(options) @showactionsheet"
,
"description"
:
"
\r\n
uni.showActionSheet函数定义
\r\n\r\n
弹出actionSheet
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowActionSheetOptions](#showactionsheetoptions) | 是 | uni.showActionSheet函数参数定义 |
\n
#### ShowActionSheetOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 否 | 菜单标题 |
\n
| alertText | string | 否 | 警示文案(同菜单标题, app无效) |
\n
| itemList | Array
\\
<string
\\
> | 是 | 按钮的文字数组 |
\n
| itemColor | string | 否 | 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色) |
\n
| popover | [Popover](#popover) | 否 | 大屏设备弹出原生选择按钮框的指示区域,默认居中显示 |
\n
| success | ([ShowActionSheetSuccess](#showactionsheetsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowActionSheetFail](#showactionsheetfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### Popover
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| top | number | 是 | 指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度 |
\n
| left | number | 是 | 指示区域坐标 |
\n
| width | number | 是 | 指示区域宽度 |
\n
| height | number | 是 | 指示区域高度 |
\n\n
##### ShowActionSheetSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| tapIndex | number | 否 | 用户点击的按钮,从上到下的顺序,从0开始 |
\n\n
##### ShowActionSheetFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 1001:parameter.itemList should have at least 1 item 1002:cancel |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showActionSheet](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet)
\n
"
},
"getNetworkType"
:{
"name"
:
"## uni.getNetworkType(options) @getnetworktype"
,
"description"
:
"获取网络类型"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetNetworkTypeOptions](#getnetworktypeoptions) | 是 | - |
\n
#### GetNetworkTypeOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([GetNetworkTypeSuccess](#getnetworktypesuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetNetworkTypeSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| networkType | string | 是 | 网络类型 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getNetworkType](http://uniapp.dcloud.io/api/system/network?id=getnetworktype)
\n
"
},
"request"
:{
"name"
:
"## uni.request(param) @request"
,
"description"
:
"发起网络请求。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| param | [RequestOptions](#requestoptions) | 是 | 网络请求参数 |
\n
#### RequestOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| url | string | 是 | 开发者服务器接口地址 |
\n
| data | any | 否 | 请求的参数 Object|String类型 |
\n
| header | any | 否 | 设置请求的 header,header 中不能设置 Referer |
\n
| method | string | 否 | 请求类型 默认值GET
\t
GET|POST|PUT|DELETE|HEAD|OPTIONS |
\n
| timeout | number | 否 | 超时时间,单位 ms |
\n
| dataType | string | 否 | 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse |
\n
| responseType | string | 否 | 设置响应的数据类型。 |
\n
| sslVerify | boolean | 否 | 验证 ssl 证书 |
\n
| withCredentials | boolean | 否 | 跨域请求时是否携带凭证(cookies) |
\n
| firstIpv4 | boolean | 否 | DNS解析时优先使用ipv4 |
\n
| success | ([RequestSuccess](#requestsuccess)) => void | 否 | 网络请求成功回调。 |
\n
| fail | ([RequestFail](#requestfail)) => void | 否 | 网络请求失败回调。 |
\n
| complete | (any) => void | 否 | 网络请求完成回调,成功或者失败都会调用。 |
\n\n
##### RequestSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 否 | 开发者服务器返回的数据 |
\n
| statusCode | number | 是 | 开发者服务器返回的 HTTP 状态码 |
\n
| header | any | 是 | 开发者服务器返回的 HTTP Response Header |
\n
| cookies | Array
\\
<string
\\
> | 是 | 开发者服务器返回的 cookies,格式为字符串数组 |
\n\n
##### RequestFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [RequestTask](#requesttask) |
\n\n
#### RequestTask
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| abort | () => void | 是 | 中断网络请求。 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[request](https://uniapp.dcloud.net.cn/api/request/request.html)
\n
"
},
"downloadFile"
:{
"name"
:
"## uni.downloadFile(options) @downloadfile"
,
"description"
:
"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [DownloadFileOptions](#downloadfileoptions) | 是 | - |
\n
#### DownloadFileOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| url | string | 是 | 下载资源的 url |
\n
| header | any | 否 | HTTP 请求 Header,header 中不能设置 Referer |
\n
| timeout | number | 否 | 超时时间,单位 ms |
\n
| success | ([DownloadFileSuccess](#downloadfilesuccess)) => void | 否 | 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} |
\n
| fail | ([DownloadFileFail](#downloadfilefail)) => void | 否 | 失败的回调函数 |
\n
| complete | (any) => void | 否 | 结束的回调函数(调用成功、失败都会执行) |
\n\n
##### DownloadFileSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| tempFilePath | string | 是 | 临时文件路径,下载后的文件会存储到一个临时文件 |
\n
| statusCode | number | 是 | 开发者服务器返回的 HTTP 状态码 |
\n\n
##### DownloadFileFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errSubject | string | 是 | - |
\n
| errCode | number | 是 | - |
\n
| errMsg | string | 是 | - |
\n
| data | any | 否 | - |
\n
| cause | any | 否 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [DownloadTask](#downloadtask) |
\n\n
#### DownloadTask
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| abort | () => void | 是 | 中断下载任务。 |
\n
| onProgressUpdate | (([OnProgressDownloadResult](#onprogressdownloadresult)) => void) => void | 是 | 监听下载进度变化。 |
\n\n
##### OnProgressDownloadResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| progress | number | 是 | 下载进度百分比 |
\n
| totalBytesWritten | number | 是 | 已经下载的数据长度,单位 Bytes |
\n
| totalBytesExpectedToWrite | number | 是 | 预期需要下载的数据总长度,单位 Bytes |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[downloadFile](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)
\n
"
},
"connectSocket"
:{
"name"
:
"## uni.connectSocket(options) @connectsocket"
,
"description"
:
"创建一个 WebSocket 连接。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ConnectSocketOptions](#connectsocketoptions) | 是 | - |
\n
#### ConnectSocketOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| url | string | 是 | 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 |
\n
| header | any | 否 | HTTP 请求 Header,header 中不能设置 Referer |
\n
| protocols | Array
\\
<string
\\
> | 否 | 子协议数组 |
\n
| success | ([ConnectSocketSuccess](#connectsocketsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ConnectSocketSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [SocketTask](#sockettask) |
\n\n
#### SocketTask
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| send | ([SendSocketMessageOptions](#sendsocketmessageoptions)) => void | 是 | 通过 WebSocket 连接发送数据 |
\n
| close | ([CloseSocketOptions](#closesocketoptions)) => void | 是 | 关闭 WebSocket 连接 |
\n
| onOpen | (([OnSocketOpenCallbackResult](#onsocketopencallbackresult)) => void) => void | 是 | 监听 WebSocket 连接打开事件 |
\n
| onClose | ((any) => void) => void | 是 | 监听 WebSocket 连接关闭事件 |
\n
| onError | (([GeneralCallbackResult](#generalcallbackresult)) => void) => void | 是 | 监听 WebSocket 错误 |
\n
| onMessage | (([OnSocketMessageCallbackResult](#onsocketmessagecallbackresult)) => void) => void | 是 | 监听 WebSocket 接受到服务器的消息事件 |
\n\n
##### SendSocketMessageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 是 | 需要发送的内容 |
\n
| success | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### CloseSocketOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| code | number | 否 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |
\n
| reason | string | 否 | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |
\n
| success | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### OnSocketOpenCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| header | any | 是 | 连接成功的 HTTP 响应 Header |
\n\n
##### OnSocketMessageCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 是 | 服务器返回的消息 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[connectSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket)
\n
"
},
"onSocketOpen"
:{
"name"
:
"## uni.onSocketOpen(options) @onsocketopen"
,
"description"
:
"监听WebSocket连接打开事件。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | ([OnSocketOpenCallbackResult](#onsocketopencallbackresult)) => void | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketOpen](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen)
\n
"
},
"onSocketError"
:{
"name"
:
"## uni.onSocketError(callback) @onsocketerror"
,
"description"
:
"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| callback | ([OnSocketErrorCallbackResult](#onsocketerrorcallbackresult)) => void | 是 | - |
\n
#### OnSocketErrorCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketError](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror)
\n
"
},
"sendSocketMessage"
:{
"name"
:
"## uni.sendSocketMessage(options) @sendsocketmessage"
,
"description"
:
"通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [SendSocketMessageOptions](#sendsocketmessageoptions) | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[sendSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage)
\n
"
},
"onSocketMessage"
:{
"name"
:
"## uni.onSocketMessage(callback) @onsocketmessage"
,
"description"
:
"监听WebSocket接受到服务器的消息事件。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| callback | ([OnSocketMessageCallbackResult](#onsocketmessagecallbackresult)) => void | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage)
\n
"
},
"closeSocket"
:{
"name"
:
"## uni.closeSocket(options) @closesocket"
,
"description"
:
"关闭 WebSocket 连接。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [CloseSocketOptions](#closesocketoptions) | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[closeSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket)
\n
"
},
"onSocketClose"
:{
"name"
:
"## uni.onSocketClose(callback) @onsocketclose"
,
"description"
:
"监听WebSocket关闭。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| callback | ([OnSocketCloseCallbackResult](#onsocketclosecallbackresult)) => void | 是 | - |
\n
#### OnSocketCloseCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| code | number | 是 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
\t
|
\n
| reason | string | 是 | 一个可读的字符串,表示连接被关闭的原因。
\t
|
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketClose](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose)
\n
"
},
"setStorage"
:{
"name"
:
"## uni.setStorage(options) @setstorage"
,
"description"
:
"
\n
uni.setStorage函数定义
\n
将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [SetStorageOptions](#setstorageoptions) | 是 | uni.setStorage参数定义 |
\n
#### SetStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| data | any | 是 | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 |
\n
| success | ([SetStorageSuccess](#setstoragesuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([SetStorageFail](#setstoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### SetStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[setStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage)
\n
"
},
"setStorageSync"
:{
"name"
:
"## uni.setStorageSync(key, data) @setstoragesync"
,
"description"
:
"
\n
uni.setStorageSync函数定义
\n
将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| data | any | 是 | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[setStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync)
\n
"
},
"getStorage"
:{
"name"
:
"## uni.getStorage(options) @getstorage"
,
"description"
:
"
\n
uni.getStorage函数定义
\n
从本地缓存中异步获取指定 key 对应的内容。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetStorageOptions](#getstorageoptions) | 是 | uni.getStorage参数定义 |
\n
#### GetStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| success | ([GetStorageSuccess](#getstoragesuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GetStorageFail](#getstoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetStorageSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 否 | key 对应的内容 |
\n\n
##### GetStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage)
\n
"
},
"getStorageSync"
:{
"name"
:
"## uni.getStorageSync(key) @getstoragesync"
,
"description"
:
"
\n
uni.getStorageSync函数定义
\n
从本地缓存中同步获取指定 key 对应的内容。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| any |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync)
\n
"
},
"getStorageInfo"
:{
"name"
:
"## uni.getStorageInfo(options) @getstorageinfo"
,
"description"
:
"
\n
uni.getStorageInfo函数定义
\n
异步获取当前 storage 的相关信息。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetStorageInfoOptions](#getstorageinfooptions) | 是 | uni.getStorageInfo参数定义 |
\n
#### GetStorageInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([GetStorageInfoSuccess](#getstorageinfosuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GetStorageInfoFail](#getstorageinfofail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetStorageInfoSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| keys | Array
\\
<string
\\
> | 是 | 当前 storage 中所有的 key |
\n
| currentSize | number | 是 | 当前占用的空间大小, 单位:kb |
\n
| limitSize | number | 是 | 限制的空间大小, 单位:kb |
\n\n
##### GetStorageInfoFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorageInfo](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfo)
\n
"
},
"getStorageInfoSync"
:{
"name"
:
"## uni.getStorageInfoSync() @getstorageinfosync"
,
"description"
:
"
\n
uni.getStorageInfoSync函数定义
\n
同步获取当前 storage 的相关信息。
\n\n
"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetStorageInfoSuccess](#getstorageinfosuccess) |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorageInfoSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfosync)
\n
"
},
"removeStorage"
:{
"name"
:
"## uni.removeStorage(options) @removestorage"
,
"description"
:
"
\n
uni.removeStorage函数定义
\n
从本地缓存中异步移除指定 key。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [RemoveStorageOptions](#removestorageoptions) | 是 | uni.removeStorage参数定义 |
\n
#### RemoveStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| success | ([RemoveStorageSuccess](#removestoragesuccess)) => void | 否 | 接口调用的回调函数 |
\n
| fail | ([RemoveStorageFail](#removestoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### RemoveStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[removeStorage](hhttps://uniapp.dcloud.net.cn/api/storage/storage.html#removestorage)
\n
"
},
"removeStorageSync"
:{
"name"
:
"## uni.removeStorageSync(key) @removestoragesync"
,
"description"
:
"
\n
uni.removeStorageSync函数定义
\n
从本地缓存中同步移除指定 key。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[removeStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync)
\n
"
},
"clearStorage"
:{
"name"
:
"## uni.clearStorage(option?) @clearstorage"
,
"description"
:
"
\n
uni.clearStorage函数定义
\n
清理本地数据缓存。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| option | [ClearStorageOptions](#clearstorageoptions) | 否 | - |
\n
#### ClearStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([ClearStorageSuccess](#clearstoragesuccess)) => void | 否 | 接口调用的回调函数 |
\n
| fail | ([ClearStorageFail](#clearstoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ClearStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[clearStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage)
\n
"
},
"clearStorageSync"
:{
"name"
:
"## uni.clearStorageSync() @clearstoragesync"
,
"description"
:
"
\n
uni.clearStorageSync函数定义
\n
清理本地数据缓存。
\n
"
,
"param"
:
""
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[clearStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync)
\n
"
},
"getLocation"
:{
"name"
:
"## uni.getLocation(options) @getlocation"
,
"description"
:
"
\n
获取当前的地理位置、速度
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetLocationOptions](#getlocationoptions) | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
""
,
"tutorial"
:
"
\n
### 参见
\n
[getLocation](http://uniapp.dcloud.io/api/location/location?id=getlocation)
\n
"
},
"chooseImage"
:{
"name"
:
"## uni.chooseImage(options) @chooseimage"
,
"description"
:
"从本地相册选择图片或使用相机拍照"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ChooseImageOptions](#chooseimageoptions) | 是 | - |
\n
#### ChooseImageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| count | number | 否 | 最多可以选择的图片张数,默认9 |
\n
| sizeType | Array
\\
<string
\\
> | 否 | original 原图,compressed 压缩图,默认二者都有 |
\n
| sourceType | Array
\\
<string
\\
> | 否 | album 从相册选图,camera 使用相机,默认二者都有 |
\n
| extension | Array
\\
<string
\\
> | 否 | 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。 |
\n
| crop | [ChooseImageCropOptions](#chooseimagecropoptions) | 否 | 图像裁剪参数,设置后 sizeType 失效。 |
\n
| success | ([ChooseImageSuccessCallback](#chooseimagesuccesscallback)) => void | 否 | 成功则返回图片的本地文件路径列表 tempFilePaths |
\n
| fail | ([ChooseImageFailCallback](#chooseimagefailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ChooseImageCropOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| width | number | 是 | 裁剪的宽度,单位为px,用于计算裁剪宽高比。 |
\n
| height | number | 是 | 裁剪的高度,单位为px,用于计算裁剪宽高比。 |
\n
| quality | number | 否 | 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。 |
\n
| resize | boolean | 否 | 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。 |
\n
| saveToAlbum | boolean | 否 | 是否将裁剪的图片保存到手机相册里,默认值为false。 |
\n\n
##### ChooseImageSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | - |
\n
| tempFilePaths | Array
\\
<string
\\
> | 是 | - |
\n
| tempFiles | any | 是 | - |
\n\n
##### ChooseImageFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[chooseImage](http://uniapp.dcloud.io/api/media/image?id=chooseimage)
\n
"
},
"saveImageToPhotosAlbum"
:{
"name"
:
"## uni.saveImageToPhotosAlbum(options) @saveimagetophotosalbum"
,
"description"
:
"保存图片到系统相册"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [SaveImageToPhotosAlbumOptions](#saveimagetophotosalbumoptions) | 是 | - |
\n
#### SaveImageToPhotosAlbumOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| filePath | string | 是 | 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径 |
\n
| success | ([SaveImageToPhotosAlbumSuccessCallback](#saveimagetophotosalbumsuccesscallback)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GetImageInfoFailCallback](#getimageinfofailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### SaveImageToPhotosAlbumSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| path | string | 是 | 保存到相册的图片路径 |
\n\n
##### GetImageInfoFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[saveImageToPhotosAlbum](http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum)
\n
"
},
"getAppAuthorizeSetting"
:{
"name"
:
"## uni.getAppAuthorizeSetting() @getappauthorizesetting"
,
"description"
:
"获取 APP 授权设置。"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetAppAuthorizeSettingResult](#getappauthorizesettingresult) |
\n\n
#### GetAppAuthorizeSettingResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| albumAuthorized | string | 否 | 允许 App 使用相册的开关(仅 iOS 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |
\n
| bluetoothAuthorized | string | 否 | 允许 App 使用蓝牙的开关(仅 iOS 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -
\\
> App模块配置` 中配置 `BlueTooth(低功耗蓝牙)` 模块 |
\n
| cameraAuthorized | string | 是 | 允许 App 使用摄像头的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台:表示没有授予 `android.permission.CAMERA` 权限;iOS平台没有该值 |
\n
| locationAuthorized | string | 是 | 允许 App 使用定位的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台:表示没有授予 `android.permission.ACCESS_COARSE_LOCATION` 权限;iOS平台:表示没有在 `manifest.json -
\\
> App模块配置` 中配置 `Geolocation(定位)` 模块 |
\n
| locationAccuracy | string | 否 | 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) - reduced: 模糊定位 - full: 精准定位 - unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -
\\
> App模块配置` 中配置 `Geolocation(定位)` 模块) |
\n
| locationReducedAccuracy | boolean | 否 | 定位准确度(推荐使用 locationAccuracy 属性)。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) |
\n
| microphoneAuthorized | string | 是 | 允许 App 使用麦克风的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台:表示没有授予 `android.permission.RECORD_AUDIO` 权限;iOS平台没有该值 |
\n
| notificationAuthorized | string | 是 | 允许 App 通知的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| notificationAlertAuthorized | string | 否 | 允许 App 通知带有提醒的开关(仅 iOS 10.0+ 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: 没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| notificationBadgeAuthorized | string | 否 | 允许 App 通知带有标记的开关(仅 iOS 10.0+ 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: 没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| notificationSoundAuthorized | string | 否 | 允许 App 通知带有声音的开关(仅 iOS 10.0+ 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: 没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| phoneCalendarAuthorized | string | 否 | 允许读写日历的开关(仅微信小程序支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getAppAuthorizeSetting](http://uniapp.dcloud.io/api/system/getappauthorizesetting)
\n
"
},
"getAppBaseInfo"
:{
"name"
:
"## uni.getAppBaseInfo(config?) @getappbaseinfo"
,
"description"
:
"获取app基本信息"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| config | [GetAppBaseInfoOptions](#getappbaseinfooptions) | 否 | - |
\n
#### GetAppBaseInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| filter | Array
\\
<string
\\
> | 是 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetAppBaseInfoResult](#getappbaseinforesult) |
\n\n
#### GetAppBaseInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| appId | string | 否 | manifest.json 中应用appid,即DCloud appid。
\t
|
\n
| appName | string | 否 | manifest.json 中应用名称
\t
|
\n
| appVersion | string | 否 | manifest.json 中应用版本名称。
\t
|
\n
| appVersionCode | string | 否 | manifest.json 中应用版本名号。
\t
|
\n
| appLanguage | string | 否 | 应用设置的语言en、zh-Hans、zh-Hant、fr、es
\t
|
\n
| language | string | 否 | 应用设置的语言
\t
|
\n
| version | string | 否 | 引擎版本号 |
\n
| appWgtVersion | string | 否 | 应用资源(wgt)的版本名称。
\t
|
\n
| hostLanguage | string | 否 | 小程序宿主语言
\t
|
\n
| hostVersion | string | 否 | App、小程序宿主版本。 |
\n
| hostName | string | 否 | 小程序宿主名称
\t
|
\n
| hostPackageName | string | 否 | 小程序宿主包名
\t
|
\n
| hostSDKVersion | string | 否 | uni小程序SDK版本、小程序客户端基础库版本
\t
|
\n
| hostTheme | string | 否 | 系统当前主题,取值为light或dark。微信小程序全局配置
\"
darkmode
\"
:true时才能获取,否则为 null (不支持小游戏) |
\n
| isUniAppX | boolean | 是 | 是否uni-app x |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getAppBaseInfo](https://uniapp.dcloud.net.cn/api/system/getAppBaseInfo.html)
\n
"
},
"getDeviceInfo"
:{
"name"
:
"## uni.getDeviceInfo(config) @getdeviceinfo"
,
"description"
:
"获取设备信息"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| config | [GetDeviceInfoOptions](#getdeviceinfooptions) | 是 | - |
\n
#### GetDeviceInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| filter | Array
\\
<string
\\
> | 是 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetDeviceInfoResult](#getdeviceinforesult) |
\n\n
#### GetDeviceInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| brand | string | 否 | 设备品牌 |
\n
| deviceBrand | string | 否 | 设备品牌 |
\n
| deviceId | string | 否 | 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 |
\n
| model | string | 否 | 设备型号
\t
|
\n
| deviceModel | string | 否 | 设备型号
\t
|
\n
| deviceType | string | 否 | 设备类型phone、pad、pc
\t
|
\n
| deviceOrientation | string | 否 | 设备方向 竖屏 portrait、横屏 landscape
\t
|
\n
| devicePixelRatio | string | 否 | 设备像素比
\t
|
\n
| system | string | 否 | 操作系统及版本
\t
|
\n
| platform | string | 否 | 客户端平台
\t
|
\n
| oaid | string | 否 | oaid标识 Android专有 |
\n
| isRoot | boolean | 否 | 是否root |
\n
| isSimulator | boolean | 否 | 是否是模拟器 |
\n
| isUSBDebugging | boolean | 否 | adb是否开启 |
\n
| idfa | string | 否 | idfa标识 iOS专有 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getDeviceInfo](https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html)
\n
"
},
"getSystemInfo"
:{
"name"
:
"## uni.getSystemInfo(options) @getsysteminfo"
,
"description"
:
"异步获取系统信息"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetSystemInfoOptions](#getsysteminfooptions) | 是 | - |
\n
#### GetSystemInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([GetSystemInfoResult](#getsysteminforesult)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetSystemInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| SDKVersion | string | 是 | 客户端基础库版本 |
\n
| app | string | 否 | 当前运行的客户端 |
\n
| appId | string | 是 | `manifest.json` 中应用appid。 |
\n
| appLanguage | string | 否 | 应用设置的语言。仅 App、H5 支持 |
\n
| appName | string | 是 | `manifest.json` 中应用名称。和`字节跳动小程序、飞书小程序`字段冲突,原字端与`hostName`一致 |
\n
| appVersion | string | 是 | `manifest.json` 中应用版本名称。 |
\n
| appVersionCode | number | 是 | `manifest.json` 中应用版本名号 |
\n
| appWgtVersion | string | 否 | 应用资源(wgt)的版本名称。(仅 App 支持) |
\n
| brand | string | 否 | 手机品牌。H5 不支持 |
\n
| browserName | string | 是 | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空 |
\n
| browserVersion | string | 是 | 浏览器版本、webview 版本。小程序端为空 |
\n
| deviceId | string | 是 | 设备 ID |
\n
| deviceBrand | string | 否 | 设备品牌。如:`apple`、`huawei`。H5 不支持 |
\n
| deviceModel | string | 是 | 设备型号 |
\n
| deviceType | string | 是 | 设备类型。`phone`、`pad`、`pc` |
\n
| devicePixelRatio | number | 是 | 设备像素比 |
\n
| deviceOrientation | string | 是 | 设备方向。如:`竖屏 portrait`、`横屏 landscape` - portrait: 竖屏 - landscape: 横屏 |
\n
| fontSizeSetting | number | 否 | 用户字体大小设置 |
\n
| host | string | 否 | 宿主平台 |
\n
| hostFontSizeSetting | number | 否 | 用户字体大小设置 |
\n
| hostSDKVersion | string | 否 | 客户端基础库版本 |
\n
| hostName | string | 否 | App、小程序宿主名称,如:`WeChat`、`FeiShu`、`alipay`、`DINGTALK`。H5 不支持 |
\n
| hostVersion | string | 否 | App、小程序宿主版本。如:微信版本号。H5 不支持 |
\n
| hostLanguage | string | 否 | 小程序宿主语言、app 语言 |
\n
| hostTheme | string | 否 | App 主题 `light`、`dark`。H5 端为空,小程序端为系统当前主题 |
\n
| hostPackageName | string | 否 | 小程序宿主包名。仅 App 支持,其他平台为空 |
\n
| language | string | 否 | 程序设置的语言 |
\n
| model | string | 是 | 手机型号 |
\n
| osName | string | 是 | ios、android、windows、mac、linux |
\n
| osVersion | string | 是 | 操作系统版本。如 ios 版本,andriod 版本 |
\n
| osLanguage | string | 否 | 操作系统语言,小程序端与 `version` 相同,H5 与浏览器语言一致 |
\n
| osTheme | string | 否 | |操作系统主题 light、dark。小程序端为小程序主题,H5 端为空 |
\n
| pixelRatio | number | 是 | 设备像素比 |
\n
| platform | string | 是 | 客户端平台 |
\n
| screenWidth | number | 是 | 屏幕宽度 |
\n
| screenHeight | number | 是 | 屏幕高度 |
\n
| statusBarHeight | number | 否 | 状态栏的高度 |
\n
| storage | string | 否 | 设备磁盘容量 |
\n
| swanNativeVersion | string | 否 | 宿主平台版本号 |
\n
| system | string | 是 | 操作系统版本 |
\n
| safeArea | [SafeArea](#safearea) | 否 | 在竖屏正方向下的安全区域 |
\n
| safeAreaInsets | [SafeAreaInsets](#safeareainsets) | 否 | 在竖屏正方向下的安全区域插入位置 |
\n
| ua | string | 是 | 用户标识。小程序端为空 |
\n
| uniCompileVersion | string | 是 | uni 编译器版本号 |
\n
| uniPlatform | string | 是 | uni-app 运行平台。如:`app`、`mp-weixin`、`web` |
\n
| uniRuntimeVersion | string | 是 | uni 运行时版本 |
\n
| version | string | 是 | 引擎版本号 |
\n
| romName | string | 否 | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios` |
\n
| romVersion | string | 否 | rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号` |
\n
| windowWidth | number | 是 | 可使用窗口宽度 |
\n
| windowHeight | number | 是 | 可使用窗口高度 |
\n
| navigationBarHeight | number | 否 | 导航栏的高度 |
\n
| titleBarHeight | number | 否 | 标题栏高度 |
\n
| currentBattery | string | 否 | 当前电量百分比 |
\n
| AppPlatform | string | 否 | App平台 |
\n
| windowTop | number | 是 | 可使用窗口的顶部位置 |
\n
| windowBottom | number | 是 | 可使用窗口的底部位置 |
\n
| albumAuthorized | boolean | 否 | 允许微信使用相册的开关(仅 iOS 有效) |
\n
| cameraAuthorized | boolean | 否 | 允许微信使用摄像头的开关 |
\n
| locationAuthorized | boolean | 否 | 允许微信使用定位的开关 |
\n
| microphoneAuthorized | boolean | 否 | 允许微信使用麦克风的开关 |
\n
| notificationAuthorized | boolean | 否 | 允许微信通知的开关 |
\n
| notificationAlertAuthorized | boolean | 否 | 允许微信通知带有提醒的开关(仅 iOS 有效) |
\n
| notificationBadgeAuthorized | boolean | 否 | 允许微信通知带有标记的开关(仅 iOS 有效) |
\n
| notificationSoundAuthorized | boolean | 否 | 允许微信通知带有声音的开关(仅 iOS 有效) |
\n
| bluetoothEnabled | boolean | 否 | 蓝牙的系统开关 |
\n
| locationEnabled | boolean | 否 | 地理位置的系统开关 |
\n
| wifiEnabled | boolean | 否 | Wi-Fi 的系统开关 |
\n
| cacheLocation | any | 否 | 上一次缓存的位置信息 |
\n
| theme | string | 否 | 系统当前主题,取值为light或dark。仅微信小程序支持 |
\n
| oaid | string | 否 | oaid |
\n
| osAndroidAPILevel | number | 否 | Android 系统API库的版本。 |
\n\n
###### SafeArea
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| left | number | 是 | 安全区域左上角横坐标 |
\n
| right | number | 是 | 安全区域右下角横坐标 |
\n
| top | number | 是 | 安全区域左上角纵坐标 |
\n
| bottom | number | 是 | 安全区域右下角纵坐标 |
\n
| width | number | 是 | 安全区域的宽度,单位逻辑像素 |
\n
| height | number | 是 | 安全区域的高度,单位逻辑像素 |
\n\n
###### SafeAreaInsets
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| left | number | 是 | 安全区域左侧插入位置 |
\n
| right | number | 是 | 安全区域右侧插入位置 |
\n
| top | number | 是 | 安全区顶部插入位置 |
\n
| bottom | number | 是 | 安全区域底部插入位置 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getSystemInfo](http://uniapp.dcloud.io/api/system/info?id=getsysteminfo)
\n
"
},
"getSystemInfoSync"
:{
"name"
:
"## uni.getSystemInfoSync() @getsysteminfosync"
,
"description"
:
"同步获取系统信息"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetSystemInfoResult](#getsysteminforesult) |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getSystemInfoSync](http://uniapp.dcloud.io/api/system/info?id=getsysteminfosync)
\n
"
},
"getWindowInfo"
:{
"name"
:
"## uni.getWindowInfo() @getwindowinfo"
,
"description"
:
"同步获取窗口信息"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetWindowInfoResult](#getwindowinforesult) |
\n\n
#### GetWindowInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| pixelRatio | number | 是 | 设备像素比 |
\n
| screenWidth | number | 是 | 屏幕宽度 |
\n
| screenHeight | number | 是 | 屏幕高度 |
\n
| windowWidth | number | 是 | 可使用窗口宽度 |
\n
| windowHeight | number | 是 | 可使用窗口高度 |
\n
| statusBarHeight | number | 是 | 状态栏的高度 |
\n
| windowTop | number | 是 | 可使用窗口的顶部位置 |
\n
| windowBottom | number | 是 | 可使用窗口的底部位置 |
\n
| safeArea | [SafeArea](#safearea) | 是 | 在竖屏正方向下的安全区域 |
\n
| safeAreaInsets | [SafeAreaInsets](#safeareainsets) | 是 | 在竖屏正方向下的安全区域插入位置 |
\n
| screenTop | number | 是 | 窗口上边缘的 y 值 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getWindowInfo](http://uniapp.dcloud.io/api/system/getWindowInfo.html)
\n
"
},
"getSystemSetting"
:{
"name"
:
"## uni.getSystemSetting() @getsystemsetting"
,
"description"
:
"获取系统设置"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetSystemSettingResult](#getsystemsettingresult) |
\n\n
#### GetSystemSettingResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| bluetoothEnabled | boolean | 否 | 蓝牙是否开启 |
\n
| bluetoothError | string | 否 | 蓝牙的报错信息 |
\n
| locationEnabled | boolean | 否 | 位置是否开启 |
\n
| wifiEnabled | boolean | 否 | wifi是否开启 |
\n
| wifiError | string | 否 | wifi的报错信息 |
\n
| deviceOrientation | string | 否 | 设备方向 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getSystemSetting](https://uniapp.dcloud.net.cn/api/system/getsystemsetting.html)
\n
"
},
"general_type"
:{
"name"
:
"## 通用类型
\n
"
,
"param"
:
"### UniError
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| ctors | Constructor | 是 | - |
\n
| errSubject | string | 是 | - |
\n
| errCode | number | 是 | - |
\n
| errMsg | string | 是 | - |
\n
| data | any | 否 | - |
\n
| name | string | 是 | - |
\n
| message | string | 是 | - |
\n
| cause | [UTSError](#utserror) | 否 | - |
\n
| stack | string | 否 | - |
\n\n
### GeneralCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n
"
}}
\ No newline at end of file
{
"exit"
:{
"name"
:
"## uni.exit(options?) @exit"
,
"description"
:
"
\n
退出当前应用"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ExitOptions](#exitoptions) | 否 | - |
\n
#### ExitOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([ExitSuccess](#exitsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ExitSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | - |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | x | x | x |
\n
"
,
"tutorial"
:
""
},
"previewImage"
:{
"name"
:
"## uni.previewImage(options) @previewimage"
,
"description"
:
"预览图片"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [PreviewImageOptions](#previewimageoptions) | 是 | - |
\n
#### PreviewImageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| count | string | 否 | 当前显示图片的链接,不填则默认为 urls 的第一张 |
\n
| current | any | 否 | current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。App平台在 1.9.5至1.9.8之间,current为必填。不填会报错 |
\n
| urls | Array
\\
<string
\\
> | 是 | 需要预览的图片链接列表 |
\n
| indicator | string | 否 | 图片指示器样式 - default: 底部圆点指示器 - number: 顶部数字指示器 - none: 不显示指示器 |
\n
| loop | boolean | 否 | 是否可循环预览 |
\n
| longPressActions | [LongPressActionsOptions](#longpressactionsoptions) | 否 | 长按图片显示操作菜单,如不填默认为保存相册,1.9.5 起支持。 |
\n
| success | ([PreviewImageSuccessCallback](#previewimagesuccesscallback)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([PreviewImageFailCallback](#previewimagefailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### LongPressActionsOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| itemList | Array
\\
<string
\\
> | 是 | 按钮的文字数组 |
\n
| itemColor | string | 否 | 按钮的文字颜色,字符串格式,默认为
\"
#000000
\"
|
\n
| success | ([LongPressActionsSuccessData](#longpressactionssuccessdata)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | (any) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
###### LongPressActionsSuccessData
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| tapIndex | number | 是 | 接口调用失败的回调函数 |
\n
| index | number | 是 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### PreviewImageSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errSubject | string | 是 | - |
\n
| errMsg | string | 是 | - |
\n\n
##### PreviewImageFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[previewImage](http://uniapp.dcloud.io/api/media/image?id=previewimage)
\n
"
},
"closePreviewImage"
:{
"name"
:
"## uni.closePreviewImage(options) @closepreviewimage"
,
"description"
:
"关闭图片预览"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ClosePreviewImageOptions](#closepreviewimageoptions) | 是 | - |
\n
#### ClosePreviewImageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([ClosePreviewImageSuccessCallback](#closepreviewimagesuccesscallback)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ClosePreviewImageFailCallback](#closepreviewimagefailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ClosePreviewImageSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n\n
##### ClosePreviewImageFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[closePreviewImage](http://uniapp.dcloud.io/api/media/image?id=closepreviewimage)
\n
"
},
"showToast"
:{
"name"
:
"## uni.showToast(options) @showtoast"
,
"description"
:
"
\r\n
uni.showToast函数定义
\r\n
弹出toast
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowToastOptions](#showtoastoptions) | 是 | uni.showToast参数定义 |
\n
#### ShowToastOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 是 | 提示的内容,长度与 icon 取值有关。 |
\n
| icon | string | 否 | icon值说明 success: 显示成功图标,error: 显示错误图标; fail: 显示错误图标,此时title文本无长度显示; exception: 显示异常图标,此时title文本无长度显示; loading: 显示加载图标;none: 不显示图标。 |
\n
| image | string | 否 | 自定义图标的本地路径(app端暂不支持gif) |
\n
| mask | boolean | 否 | 是否显示透明蒙层,防止触摸穿透,默认:false |
\n
| duration | number | 否 | 提示的延迟时间,单位毫秒,默认:1500 |
\n
| position | string | 否 | position值说明(仅App生效) top: 居上显示; center: 居中显示;bottom: 居底显示 |
\n
| success | ([ShowToastSuccess](#showtoastsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowToastFail](#showtoastfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ShowToastFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 1001:title is null |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showToast](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast)
\n
"
},
"hideToast"
:{
"name"
:
"## uni.hideToast() @hidetoast"
,
"description"
:
"
\r\n
uni.hideToast函数定义
\r\n
隐藏toast
\r\n
"
,
"param"
:
""
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[hideToast](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hidetoast)
\n
"
},
"showLoading"
:{
"name"
:
"## uni.showLoading(options) @showloading"
,
"description"
:
"
\r\n
uni.showLoading函数定义
\r\n
弹出loading
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowLoadingOptions](#showloadingoptions) | 是 | uni.showLoading参数定义 |
\n
#### ShowLoadingOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 是 | 提示的内容,长度与 icon 取值有关。 |
\n
| mask | boolean | 否 | 是否显示透明蒙层,防止触摸穿透,默认:false |
\n
| success | ([ShowLoadingSuccess](#showloadingsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowLoadingFail](#showloadingfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ShowLoadingFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 1001:title is null |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showLoading](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading)
\n
"
},
"hideLoading"
:{
"name"
:
"## uni.hideLoading() @hideloading"
,
"description"
:
"
\r\n
uni.hideLoading函数定义
\r\n
隐藏loading
\r\n
"
,
"param"
:
""
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[hideLoading](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hideloading)
\n
"
},
"showModal"
:{
"name"
:
"## uni.showModal(options) @showmodal"
,
"description"
:
"
\r\n
uni.showModal 函数定义
\r\n\r\n
弹出modal
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowModalOptions](#showmodaloptions) | 是 | uni.showModal 参数定义 |
\n
#### ShowModalOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 否 | 提示的标题 |
\n
| content | string | 否 | 提示的内容 |
\n
| showCancel | boolean | 否 | |
\n
| cancelText | string | 否 | 取消按钮的文字,默认为
\"
取消
\"
|
\n
| cancelColor | string | 否 | 取消按钮的文字颜色,默认为
\"
#000000
\"
|
\n
| confirmText | string | 否 | 确定按钮的文字,默认为
\"
确定
\"
|
\n
| confirmColor | string | 否 | 确定按钮的文字颜色 |
\n
| editable | boolean | 否 | |
\n
| placeholderText | string | 否 | 显示输入框时的提示文本 |
\n
| success | ([ShowModalSuccess](#showmodalsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowModalFail](#showmodalfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ShowModalSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| confirm | boolean | 是 | 为 true 时,表示用户点击了确定按钮 |
\n
| cancel | boolean | 是 | 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) |
\n
| content | string | 否 | editable 为 true 时,用户输入的文本 |
\n\n
##### ShowModalFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showModal](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal)
\n
"
},
"showActionSheet"
:{
"name"
:
"## uni.showActionSheet(options) @showactionsheet"
,
"description"
:
"
\r\n
uni.showActionSheet函数定义
\r\n\r\n
弹出actionSheet
\r\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ShowActionSheetOptions](#showactionsheetoptions) | 是 | uni.showActionSheet函数参数定义 |
\n
#### ShowActionSheetOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| title | string | 否 | 菜单标题 |
\n
| alertText | string | 否 | 警示文案(同菜单标题, app无效) |
\n
| itemList | Array
\\
<string
\\
> | 是 | 按钮的文字数组 |
\n
| itemColor | string | 否 | 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色) |
\n
| popover | [Popover](#popover) | 否 | 大屏设备弹出原生选择按钮框的指示区域,默认居中显示 |
\n
| success | ([ShowActionSheetSuccess](#showactionsheetsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([ShowActionSheetFail](#showactionsheetfail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### Popover
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| top | number | 是 | 指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度 |
\n
| left | number | 是 | 指示区域坐标 |
\n
| width | number | 是 | 指示区域宽度 |
\n
| height | number | 是 | 指示区域高度 |
\n\n
##### ShowActionSheetSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| tapIndex | number | 否 | 用户点击的按钮,从上到下的顺序,从0开始 |
\n\n
##### ShowActionSheetFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 0:成功 1001:parameter.itemList should have at least 1 item 1002:cancel |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[showActionSheet](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet)
\n
"
},
"getNetworkType"
:{
"name"
:
"## uni.getNetworkType(options) @getnetworktype"
,
"description"
:
"获取网络类型"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetNetworkTypeOptions](#getnetworktypeoptions) | 是 | - |
\n
#### GetNetworkTypeOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([GetNetworkTypeSuccess](#getnetworktypesuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetNetworkTypeSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| networkType | string | 是 | 网络类型 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getNetworkType](http://uniapp.dcloud.io/api/system/network?id=getnetworktype)
\n
"
},
"request"
:{
"name"
:
"## uni.request(param) @request"
,
"description"
:
"发起网络请求。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| param | [RequestOptions](#requestoptions) | 是 | 网络请求参数 |
\n
#### RequestOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| url | string | 是 | 开发者服务器接口地址 |
\n
| data | any | 否 | 请求的参数 Object
\\
|String类型 |
\n
| header | any | 否 | 设置请求的 header,header 中不能设置 Referer |
\n
| method | string | 否 | 请求类型 默认值GET
\t
GET
\\
|POST
\\
|PUT
\\
|DELETE
\\
|HEAD
\\
|OPTIONS |
\n
| timeout | number | 否 | 超时时间,单位 ms |
\n
| dataType | string | 否 | 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse |
\n
| responseType | string | 否 | 设置响应的数据类型。 |
\n
| sslVerify | boolean | 否 | 验证 ssl 证书 |
\n
| withCredentials | boolean | 否 | 跨域请求时是否携带凭证(cookies) |
\n
| firstIpv4 | boolean | 否 | DNS解析时优先使用ipv4 |
\n
| success | ([RequestSuccess](#requestsuccess)) => void | 否 | 网络请求成功回调。 |
\n
| fail | ([RequestFail](#requestfail)) => void | 否 | 网络请求失败回调。 |
\n
| complete | (any) => void | 否 | 网络请求完成回调,成功或者失败都会调用。 |
\n\n
##### RequestSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 否 | 开发者服务器返回的数据 |
\n
| statusCode | number | 是 | 开发者服务器返回的 HTTP 状态码 |
\n
| header | any | 是 | 开发者服务器返回的 HTTP Response Header |
\n
| cookies | Array
\\
<string
\\
> | 是 | 开发者服务器返回的 cookies,格式为字符串数组 |
\n\n
##### RequestFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [RequestTask](#requesttask) |
\n\n
#### RequestTask
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| abort | () => void | 是 | 中断网络请求。 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[request](https://uniapp.dcloud.net.cn/api/request/request.html)
\n
"
},
"downloadFile"
:{
"name"
:
"## uni.downloadFile(options) @downloadfile"
,
"description"
:
"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [DownloadFileOptions](#downloadfileoptions) | 是 | - |
\n
#### DownloadFileOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| url | string | 是 | 下载资源的 url |
\n
| header | any | 否 | HTTP 请求 Header,header 中不能设置 Referer |
\n
| timeout | number | 否 | 超时时间,单位 ms |
\n
| success | ([DownloadFileSuccess](#downloadfilesuccess)) => void | 否 | 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} |
\n
| fail | ([DownloadFileFail](#downloadfilefail)) => void | 否 | 失败的回调函数 |
\n
| complete | (any) => void | 否 | 结束的回调函数(调用成功、失败都会执行) |
\n\n
##### DownloadFileSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| tempFilePath | string | 是 | 临时文件路径,下载后的文件会存储到一个临时文件 |
\n
| statusCode | number | 是 | 开发者服务器返回的 HTTP 状态码 |
\n\n
##### DownloadFileFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errSubject | string | 是 | - |
\n
| errCode | number | 是 | - |
\n
| errMsg | string | 是 | - |
\n
| data | any | 否 | - |
\n
| cause | any | 否 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [DownloadTask](#downloadtask) |
\n\n
#### DownloadTask
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| abort | () => void | 是 | 中断下载任务。 |
\n
| onProgressUpdate | (([OnProgressDownloadResult](#onprogressdownloadresult)) => void) => void | 是 | 监听下载进度变化。 |
\n\n
##### OnProgressDownloadResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| progress | number | 是 | 下载进度百分比 |
\n
| totalBytesWritten | number | 是 | 已经下载的数据长度,单位 Bytes |
\n
| totalBytesExpectedToWrite | number | 是 | 预期需要下载的数据总长度,单位 Bytes |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[downloadFile](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)
\n
"
},
"connectSocket"
:{
"name"
:
"## uni.connectSocket(options) @connectsocket"
,
"description"
:
"创建一个 WebSocket 连接。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ConnectSocketOptions](#connectsocketoptions) | 是 | - |
\n
#### ConnectSocketOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| url | string | 是 | 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 |
\n
| header | any | 否 | HTTP 请求 Header,header 中不能设置 Referer |
\n
| protocols | Array
\\
<string
\\
> | 否 | 子协议数组 |
\n
| success | ([ConnectSocketSuccess](#connectsocketsuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ConnectSocketSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [SocketTask](#sockettask) |
\n\n
#### SocketTask
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| send | ([SendSocketMessageOptions](#sendsocketmessageoptions)) => void | 是 | 通过 WebSocket 连接发送数据 |
\n
| close | ([CloseSocketOptions](#closesocketoptions)) => void | 是 | 关闭 WebSocket 连接 |
\n
| onOpen | (([OnSocketOpenCallbackResult](#onsocketopencallbackresult)) => void) => void | 是 | 监听 WebSocket 连接打开事件 |
\n
| onClose | ((any) => void) => void | 是 | 监听 WebSocket 连接关闭事件 |
\n
| onError | (([GeneralCallbackResult](#generalcallbackresult)) => void) => void | 是 | 监听 WebSocket 错误 |
\n
| onMessage | (([OnSocketMessageCallbackResult](#onsocketmessagecallbackresult)) => void) => void | 是 | 监听 WebSocket 接受到服务器的消息事件 |
\n\n
##### SendSocketMessageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 是 | 需要发送的内容 |
\n
| success | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### CloseSocketOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| code | number | 否 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |
\n
| reason | string | 否 | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |
\n
| success | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | ([GeneralCallbackResult](#generalcallbackresult)) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### OnSocketOpenCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| header | any | 是 | 连接成功的 HTTP 响应 Header |
\n\n
##### OnSocketMessageCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 是 | 服务器返回的消息 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[connectSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket)
\n
"
},
"onSocketOpen"
:{
"name"
:
"## uni.onSocketOpen(options) @onsocketopen"
,
"description"
:
"监听WebSocket连接打开事件。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | ([OnSocketOpenCallbackResult](#onsocketopencallbackresult)) => void | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketOpen](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen)
\n
"
},
"onSocketError"
:{
"name"
:
"## uni.onSocketError(callback) @onsocketerror"
,
"description"
:
"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| callback | ([OnSocketErrorCallbackResult](#onsocketerrorcallbackresult)) => void | 是 | - |
\n
#### OnSocketErrorCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketError](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror)
\n
"
},
"sendSocketMessage"
:{
"name"
:
"## uni.sendSocketMessage(options) @sendsocketmessage"
,
"description"
:
"通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [SendSocketMessageOptions](#sendsocketmessageoptions) | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[sendSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage)
\n
"
},
"onSocketMessage"
:{
"name"
:
"## uni.onSocketMessage(callback) @onsocketmessage"
,
"description"
:
"监听WebSocket接受到服务器的消息事件。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| callback | ([OnSocketMessageCallbackResult](#onsocketmessagecallbackresult)) => void | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage)
\n
"
},
"closeSocket"
:{
"name"
:
"## uni.closeSocket(options) @closesocket"
,
"description"
:
"关闭 WebSocket 连接。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [CloseSocketOptions](#closesocketoptions) | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[closeSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket)
\n
"
},
"onSocketClose"
:{
"name"
:
"## uni.onSocketClose(callback) @onsocketclose"
,
"description"
:
"监听WebSocket关闭。"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| callback | ([OnSocketCloseCallbackResult](#onsocketclosecallbackresult)) => void | 是 | - |
\n
#### OnSocketCloseCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| code | number | 是 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
\t
|
\n
| reason | string | 是 | 一个可读的字符串,表示连接被关闭的原因。
\t
|
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[onSocketClose](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose)
\n
"
},
"setStorage"
:{
"name"
:
"## uni.setStorage(options) @setstorage"
,
"description"
:
"
\n
uni.setStorage函数定义
\n
将数据存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [SetStorageOptions](#setstorageoptions) | 是 | uni.setStorage参数定义 |
\n
#### SetStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| data | any | 是 | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 |
\n
| success | ([SetStorageSuccess](#setstoragesuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([SetStorageFail](#setstoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### SetStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[setStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage)
\n
"
},
"setStorageSync"
:{
"name"
:
"## uni.setStorageSync(key, data) @setstoragesync"
,
"description"
:
"
\n
uni.setStorageSync函数定义
\n
将 data 存储在本地缓存中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| data | any | 是 | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[setStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync)
\n
"
},
"getStorage"
:{
"name"
:
"## uni.getStorage(options) @getstorage"
,
"description"
:
"
\n
uni.getStorage函数定义
\n
从本地缓存中异步获取指定 key 对应的内容。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetStorageOptions](#getstorageoptions) | 是 | uni.getStorage参数定义 |
\n
#### GetStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| success | ([GetStorageSuccess](#getstoragesuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GetStorageFail](#getstoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetStorageSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| data | any | 否 | key 对应的内容 |
\n\n
##### GetStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage)
\n
"
},
"getStorageSync"
:{
"name"
:
"## uni.getStorageSync(key) @getstoragesync"
,
"description"
:
"
\n
uni.getStorageSync函数定义
\n
从本地缓存中同步获取指定 key 对应的内容。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| any |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync)
\n
"
},
"getStorageInfo"
:{
"name"
:
"## uni.getStorageInfo(options) @getstorageinfo"
,
"description"
:
"
\n
uni.getStorageInfo函数定义
\n
异步获取当前 storage 的相关信息。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetStorageInfoOptions](#getstorageinfooptions) | 是 | uni.getStorageInfo参数定义 |
\n
#### GetStorageInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([GetStorageInfoSuccess](#getstorageinfosuccess)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GetStorageInfoFail](#getstorageinfofail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetStorageInfoSuccess
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| keys | Array
\\
<string
\\
> | 是 | 当前 storage 中所有的 key |
\n
| currentSize | number | 是 | 当前占用的空间大小, 单位:kb |
\n
| limitSize | number | 是 | 限制的空间大小, 单位:kb |
\n\n
##### GetStorageInfoFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorageInfo](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfo)
\n
"
},
"getStorageInfoSync"
:{
"name"
:
"## uni.getStorageInfoSync() @getstorageinfosync"
,
"description"
:
"
\n
uni.getStorageInfoSync函数定义
\n
同步获取当前 storage 的相关信息。
\n\n
"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetStorageInfoSuccess](#getstorageinfosuccess) |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getStorageInfoSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfosync)
\n
"
},
"removeStorage"
:{
"name"
:
"## uni.removeStorage(options) @removestorage"
,
"description"
:
"
\n
uni.removeStorage函数定义
\n
从本地缓存中异步移除指定 key。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [RemoveStorageOptions](#removestorageoptions) | 是 | uni.removeStorage参数定义 |
\n
#### RemoveStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |
\n
| success | ([RemoveStorageSuccess](#removestoragesuccess)) => void | 否 | 接口调用的回调函数 |
\n
| fail | ([RemoveStorageFail](#removestoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### RemoveStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[removeStorage](hhttps://uniapp.dcloud.net.cn/api/storage/storage.html#removestorage)
\n
"
},
"removeStorageSync"
:{
"name"
:
"## uni.removeStorageSync(key) @removestoragesync"
,
"description"
:
"
\n
uni.removeStorageSync函数定义
\n
从本地缓存中同步移除指定 key。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| key | string | 是 | 本地缓存中的指定的 key |"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[removeStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync)
\n
"
},
"clearStorage"
:{
"name"
:
"## uni.clearStorage(option?) @clearstorage"
,
"description"
:
"
\n
uni.clearStorage函数定义
\n
清理本地数据缓存。
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| option | [ClearStorageOptions](#clearstorageoptions) | 否 | - |
\n
#### ClearStorageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([ClearStorageSuccess](#clearstoragesuccess)) => void | 否 | 接口调用的回调函数 |
\n
| fail | ([ClearStorageFail](#clearstoragefail)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ClearStorageFail
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[clearStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage)
\n
"
},
"clearStorageSync"
:{
"name"
:
"## uni.clearStorageSync() @clearstoragesync"
,
"description"
:
"
\n
uni.clearStorageSync函数定义
\n
清理本地数据缓存。
\n
"
,
"param"
:
""
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4.4 | 2.0.3 | 3.9.0 | 9.0 | 2.0.3 | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[clearStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync)
\n
"
},
"getLocation"
:{
"name"
:
"## uni.getLocation(options) @getlocation"
,
"description"
:
"
\n
获取当前的地理位置、速度
\n
"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetLocationOptions](#getlocationoptions) | 是 | - |"
,
"returnValue"
:
""
,
"compatibility"
:
""
,
"tutorial"
:
"
\n
### 参见
\n
[getLocation](http://uniapp.dcloud.io/api/location/location?id=getlocation)
\n
"
},
"chooseImage"
:{
"name"
:
"## uni.chooseImage(options) @chooseimage"
,
"description"
:
"从本地相册选择图片或使用相机拍照"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [ChooseImageOptions](#chooseimageoptions) | 是 | - |
\n
#### ChooseImageOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| count | number | 否 | 最多可以选择的图片张数,默认9 |
\n
| sizeType | Array
\\
<string
\\
> | 否 | original 原图,compressed 压缩图,默认二者都有 |
\n
| sourceType | Array
\\
<string
\\
> | 否 | album 从相册选图,camera 使用相机,默认二者都有 |
\n
| extension | Array
\\
<string
\\
> | 否 | 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。 |
\n
| crop | [ChooseImageCropOptions](#chooseimagecropoptions) | 否 | 图像裁剪参数,设置后 sizeType 失效。 |
\n
| success | ([ChooseImageSuccessCallback](#chooseimagesuccesscallback)) => void | 否 | 成功则返回图片的本地文件路径列表 tempFilePaths |
\n
| fail | ([ChooseImageFailCallback](#chooseimagefailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### ChooseImageCropOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| width | number | 是 | 裁剪的宽度,单位为px,用于计算裁剪宽高比。 |
\n
| height | number | 是 | 裁剪的高度,单位为px,用于计算裁剪宽高比。 |
\n
| quality | number | 否 | 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。 |
\n
| resize | boolean | 否 | 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。 |
\n
| saveToAlbum | boolean | 否 | 是否将裁剪的图片保存到手机相册里,默认值为false。 |
\n\n
##### ChooseImageSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | - |
\n
| tempFilePaths | Array
\\
<string
\\
> | 是 | - |
\n
| tempFiles | any | 是 | - |
\n\n
##### ChooseImageFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[chooseImage](http://uniapp.dcloud.io/api/media/image?id=chooseimage)
\n
"
},
"saveImageToPhotosAlbum"
:{
"name"
:
"## uni.saveImageToPhotosAlbum(options) @saveimagetophotosalbum"
,
"description"
:
"保存图片到系统相册"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [SaveImageToPhotosAlbumOptions](#saveimagetophotosalbumoptions) | 是 | - |
\n
#### SaveImageToPhotosAlbumOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| filePath | string | 是 | 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径 |
\n
| success | ([SaveImageToPhotosAlbumSuccessCallback](#saveimagetophotosalbumsuccesscallback)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([GetImageInfoFailCallback](#getimageinfofailcallback)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### SaveImageToPhotosAlbumSuccessCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| path | string | 是 | 保存到相册的图片路径 |
\n\n
##### GetImageInfoFailCallback
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errCode | number | 是 | 错误码 |
\n
| errSubject | string | 是 | 调用API的名称 |
\n
| errMsg | string | 是 | 错误的详细信息 |
\n
| cause | any | 否 | 错误来源 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | - | - | - |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[saveImageToPhotosAlbum](http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum)
\n
"
},
"getAppBaseInfo"
:{
"name"
:
"## uni.getAppBaseInfo(config?) @getappbaseinfo"
,
"description"
:
"获取app基本信息"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| config | [GetAppBaseInfoOptions](#getappbaseinfooptions) | 否 | - |
\n
#### GetAppBaseInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| filter | Array
\\
<string
\\
> | 是 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetAppBaseInfoResult](#getappbaseinforesult) |
\n\n
#### GetAppBaseInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| appId | string | 否 | manifest.json 中应用appid,即DCloud appid。
\t
|
\n
| appName | string | 否 | manifest.json 中应用名称
\t
|
\n
| appVersion | string | 否 | manifest.json 中应用版本名称。
\t
|
\n
| appVersionCode | string | 否 | manifest.json 中应用版本名号。
\t
|
\n
| appLanguage | string | 否 | 应用设置的语言en、zh-Hans、zh-Hant、fr、es
\t
|
\n
| language | string | 否 | 应用设置的语言
\t
|
\n
| version | string | 否 | 引擎版本号 |
\n
| appWgtVersion | string | 否 | 应用资源(wgt)的版本名称。
\t
|
\n
| hostLanguage | string | 否 | 小程序宿主语言
\t
|
\n
| hostVersion | string | 否 | App、小程序宿主版本。 |
\n
| hostName | string | 否 | 小程序宿主名称
\t
|
\n
| hostPackageName | string | 否 | 小程序宿主包名
\t
|
\n
| hostSDKVersion | string | 否 | uni小程序SDK版本、小程序客户端基础库版本
\t
|
\n
| hostTheme | string | 否 | 系统当前主题,取值为light或dark。微信小程序全局配置
\"
darkmode
\"
:true时才能获取,否则为 null (不支持小游戏) |
\n
| isUniAppX | boolean | 是 | 是否uni-app x |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getAppBaseInfo](https://uniapp.dcloud.net.cn/api/system/getAppBaseInfo.html)
\n
"
},
"getDeviceInfo"
:{
"name"
:
"## uni.getDeviceInfo(config?) @getdeviceinfo"
,
"description"
:
"获取设备信息"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| config | [GetDeviceInfoOptions](#getdeviceinfooptions) | 否 | - |
\n
#### GetDeviceInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| filter | Array
\\
<string
\\
> | 是 | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetDeviceInfoResult](#getdeviceinforesult) |
\n\n
#### GetDeviceInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| brand | string | 否 | 设备品牌 |
\n
| deviceBrand | string | 否 | 设备品牌 |
\n
| deviceId | string | 否 | 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 |
\n
| model | string | 否 | 设备型号
\t
|
\n
| deviceModel | string | 否 | 设备型号
\t
|
\n
| deviceType | string | 否 | 设备类型phone、pad、pc
\t
|
\n
| deviceOrientation | string | 否 | 设备方向 竖屏 portrait、横屏 landscape
\t
|
\n
| devicePixelRatio | string | 否 | 设备像素比
\t
|
\n
| system | string | 否 | 操作系统及版本
\t
|
\n
| platform | string | 否 | 客户端平台
\t
|
\n
| oaid | string | 否 | oaid标识 Android专有 |
\n
| isRoot | boolean | 否 | 是否root |
\n
| isSimulator | boolean | 否 | 是否是模拟器 |
\n
| isUSBDebugging | boolean | 否 | adb是否开启 |
\n
| idfa | string | 否 | idfa标识 iOS专有 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getDeviceInfo](https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html)
\n
"
},
"getAppAuthorizeSetting"
:{
"name"
:
"## uni.getAppAuthorizeSetting() @getappauthorizesetting"
,
"description"
:
"获取 APP 授权设置。"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetAppAuthorizeSettingResult](#getappauthorizesettingresult) |
\n\n
#### GetAppAuthorizeSettingResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| albumAuthorized | string | 否 | 允许 App 使用相册的开关(仅 iOS 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |
\n
| bluetoothAuthorized | string | 否 | 允许 App 使用蓝牙的开关(仅 iOS 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -
\\
> App模块配置` 中配置 `BlueTooth(低功耗蓝牙)` 模块 |
\n
| cameraAuthorized | string | 是 | 允许 App 使用摄像头的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台:表示没有授予 `android.permission.CAMERA` 权限;iOS平台没有该值 |
\n
| locationAuthorized | string | 是 | 允许 App 使用定位的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台:表示没有授予 `android.permission.ACCESS_COARSE_LOCATION` 权限;iOS平台:表示没有在 `manifest.json -
\\
> App模块配置` 中配置 `Geolocation(定位)` 模块 |
\n
| locationAccuracy | string | 否 | 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) - reduced: 模糊定位 - full: 精准定位 - unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -
\\
> App模块配置` 中配置 `Geolocation(定位)` 模块) |
\n
| locationReducedAccuracy | boolean | 否 | 定位准确度(推荐使用 locationAccuracy 属性)。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) |
\n
| microphoneAuthorized | string | 是 | 允许 App 使用麦克风的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台:表示没有授予 `android.permission.RECORD_AUDIO` 权限;iOS平台没有该值 |
\n
| notificationAuthorized | string | 是 | 允许 App 通知的开关 - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| notificationAlertAuthorized | string | 否 | 允许 App 通知带有提醒的开关(仅 iOS 10.0+ 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: 没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| notificationBadgeAuthorized | string | 否 | 允许 App 通知带有标记的开关(仅 iOS 10.0+ 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: 没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| notificationSoundAuthorized | string | 否 | 允许 App 通知带有声音的开关(仅 iOS 10.0+ 支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) - config error: 没有在 `manifest.json -
\\
> App模块配置` 中配置 `Push(推送)` 模块 |
\n
| phoneCalendarAuthorized | string | 否 | 允许读写日历的开关(仅微信小程序支持) - authorized: 已经获得授权,无需再次请求授权 - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限) - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getAppAuthorizeSetting](http://uniapp.dcloud.io/api/system/getappauthorizesetting)
\n
"
},
"getSystemInfo"
:{
"name"
:
"## uni.getSystemInfo(options) @getsysteminfo"
,
"description"
:
"异步获取系统信息"
,
"param"
:
"### 参数
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| options | [GetSystemInfoOptions](#getsysteminfooptions) | 是 | - |
\n
#### GetSystemInfoOptions
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| success | ([GetSystemInfoResult](#getsysteminforesult)) => void | 否 | 接口调用成功的回调函数 |
\n
| fail | ([UniError](#unierror)) => void | 否 | 接口调用失败的回调函数 |
\n
| complete | (any) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
\n\n
##### GetSystemInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| SDKVersion | string | 是 | 客户端基础库版本 |
\n
| app | string | 否 | 当前运行的客户端 |
\n
| appId | string | 是 | `manifest.json` 中应用appid。 |
\n
| appLanguage | string | 否 | 应用设置的语言。仅 App、H5 支持 |
\n
| appName | string | 是 | `manifest.json` 中应用名称。和`字节跳动小程序、飞书小程序`字段冲突,原字端与`hostName`一致 |
\n
| appVersion | string | 是 | `manifest.json` 中应用版本名称。 |
\n
| appVersionCode | number | 是 | `manifest.json` 中应用版本名号 |
\n
| appWgtVersion | string | 否 | 应用资源(wgt)的版本名称。(仅 App 支持) |
\n
| brand | string | 否 | 手机品牌。H5 不支持 |
\n
| browserName | string | 是 | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空 |
\n
| browserVersion | string | 是 | 浏览器版本、webview 版本。小程序端为空 |
\n
| deviceId | string | 是 | 设备 ID |
\n
| deviceBrand | string | 否 | 设备品牌。如:`apple`、`huawei`。H5 不支持 |
\n
| deviceModel | string | 是 | 设备型号 |
\n
| deviceType | string | 是 | 设备类型。`phone`、`pad`、`pc` |
\n
| devicePixelRatio | number | 是 | 设备像素比 |
\n
| deviceOrientation | string | 是 | 设备方向。如:`竖屏 portrait`、`横屏 landscape` - portrait: 竖屏 - landscape: 横屏 |
\n
| fontSizeSetting | number | 否 | 用户字体大小设置 |
\n
| host | string | 否 | 宿主平台 |
\n
| hostFontSizeSetting | number | 否 | 用户字体大小设置 |
\n
| hostSDKVersion | string | 否 | 客户端基础库版本 |
\n
| hostName | string | 否 | App、小程序宿主名称,如:`WeChat`、`FeiShu`、`alipay`、`DINGTALK`。H5 不支持 |
\n
| hostVersion | string | 否 | App、小程序宿主版本。如:微信版本号。H5 不支持 |
\n
| hostLanguage | string | 否 | 小程序宿主语言、app 语言 |
\n
| hostTheme | string | 否 | App 主题 `light`、`dark`。H5 端为空,小程序端为系统当前主题 |
\n
| hostPackageName | string | 否 | 小程序宿主包名。仅 App 支持,其他平台为空 |
\n
| language | string | 否 | 程序设置的语言 |
\n
| model | string | 是 | 手机型号 |
\n
| osName | string | 是 | ios、android、windows、mac、linux |
\n
| osVersion | string | 是 | 操作系统版本。如 ios 版本,andriod 版本 |
\n
| osLanguage | string | 否 | 操作系统语言,小程序端与 `version` 相同,H5 与浏览器语言一致 |
\n
| osTheme | string | 否 |
\\
|操作系统主题 light、dark。小程序端为小程序主题,H5 端为空 |
\n
| pixelRatio | number | 是 | 设备像素比 |
\n
| platform | string | 是 | 客户端平台 |
\n
| screenWidth | number | 是 | 屏幕宽度 |
\n
| screenHeight | number | 是 | 屏幕高度 |
\n
| statusBarHeight | number | 否 | 状态栏的高度 |
\n
| storage | string | 否 | 设备磁盘容量 |
\n
| swanNativeVersion | string | 否 | 宿主平台版本号 |
\n
| system | string | 是 | 操作系统版本 |
\n
| safeArea | [SafeArea](#safearea) | 否 | 在竖屏正方向下的安全区域 |
\n
| safeAreaInsets | [SafeAreaInsets](#safeareainsets) | 否 | 在竖屏正方向下的安全区域插入位置 |
\n
| ua | string | 是 | 用户标识。小程序端为空 |
\n
| uniCompileVersion | string | 是 | uni 编译器版本号 |
\n
| uniPlatform | string | 是 | uni-app 运行平台。如:`app`、`mp-weixin`、`web` |
\n
| uniRuntimeVersion | string | 是 | uni 运行时版本 |
\n
| version | string | 是 | 引擎版本号 |
\n
| romName | string | 否 | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios` |
\n
| romVersion | string | 否 | rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号` |
\n
| windowWidth | number | 是 | 可使用窗口宽度 |
\n
| windowHeight | number | 是 | 可使用窗口高度 |
\n
| navigationBarHeight | number | 否 | 导航栏的高度 |
\n
| titleBarHeight | number | 否 | 标题栏高度 |
\n
| currentBattery | string | 否 | 当前电量百分比 |
\n
| AppPlatform | string | 否 | App平台 |
\n
| windowTop | number | 是 | 可使用窗口的顶部位置 |
\n
| windowBottom | number | 是 | 可使用窗口的底部位置 |
\n
| albumAuthorized | boolean | 否 | 允许微信使用相册的开关(仅 iOS 有效) |
\n
| cameraAuthorized | boolean | 否 | 允许微信使用摄像头的开关 |
\n
| locationAuthorized | boolean | 否 | 允许微信使用定位的开关 |
\n
| microphoneAuthorized | boolean | 否 | 允许微信使用麦克风的开关 |
\n
| notificationAuthorized | boolean | 否 | 允许微信通知的开关 |
\n
| notificationAlertAuthorized | boolean | 否 | 允许微信通知带有提醒的开关(仅 iOS 有效) |
\n
| notificationBadgeAuthorized | boolean | 否 | 允许微信通知带有标记的开关(仅 iOS 有效) |
\n
| notificationSoundAuthorized | boolean | 否 | 允许微信通知带有声音的开关(仅 iOS 有效) |
\n
| bluetoothEnabled | boolean | 否 | 蓝牙的系统开关 |
\n
| locationEnabled | boolean | 否 | 地理位置的系统开关 |
\n
| wifiEnabled | boolean | 否 | Wi-Fi 的系统开关 |
\n
| cacheLocation | any | 否 | 上一次缓存的位置信息 |
\n
| theme | string | 否 | 系统当前主题,取值为light或dark。仅微信小程序支持 |
\n
| oaid | string | 否 | oaid |
\n
| osAndroidAPILevel | number | 否 | Android 系统API库的版本。 |
\n\n
###### SafeArea
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| left | number | 是 | 安全区域左上角横坐标 |
\n
| right | number | 是 | 安全区域右下角横坐标 |
\n
| top | number | 是 | 安全区域左上角纵坐标 |
\n
| bottom | number | 是 | 安全区域右下角纵坐标 |
\n
| width | number | 是 | 安全区域的宽度,单位逻辑像素 |
\n
| height | number | 是 | 安全区域的高度,单位逻辑像素 |
\n\n
###### SafeAreaInsets
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| left | number | 是 | 安全区域左侧插入位置 |
\n
| right | number | 是 | 安全区域右侧插入位置 |
\n
| top | number | 是 | 安全区顶部插入位置 |
\n
| bottom | number | 是 | 安全区域底部插入位置 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getSystemInfo](http://uniapp.dcloud.io/api/system/info?id=getsysteminfo)
\n
"
},
"getSystemInfoSync"
:{
"name"
:
"## uni.getSystemInfoSync() @getsysteminfosync"
,
"description"
:
"同步获取系统信息"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetSystemInfoResult](#getsysteminforesult) |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getSystemInfoSync](http://uniapp.dcloud.io/api/system/info?id=getsysteminfosync)
\n
"
},
"getWindowInfo"
:{
"name"
:
"## uni.getWindowInfo() @getwindowinfo"
,
"description"
:
"同步获取窗口信息"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetWindowInfoResult](#getwindowinforesult) |
\n\n
#### GetWindowInfoResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| pixelRatio | number | 是 | 设备像素比 |
\n
| screenWidth | number | 是 | 屏幕宽度 |
\n
| screenHeight | number | 是 | 屏幕高度 |
\n
| windowWidth | number | 是 | 可使用窗口宽度 |
\n
| windowHeight | number | 是 | 可使用窗口高度 |
\n
| statusBarHeight | number | 是 | 状态栏的高度 |
\n
| windowTop | number | 是 | 可使用窗口的顶部位置 |
\n
| windowBottom | number | 是 | 可使用窗口的底部位置 |
\n
| safeArea | [SafeArea](#safearea) | 是 | 在竖屏正方向下的安全区域 |
\n
| safeAreaInsets | [SafeAreaInsets](#safeareainsets) | 是 | 在竖屏正方向下的安全区域插入位置 |
\n
| screenTop | number | 是 | 窗口上边缘的 y 值 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getWindowInfo](http://uniapp.dcloud.io/api/system/getWindowInfo.html)
\n
"
},
"getSystemSetting"
:{
"name"
:
"## uni.getSystemSetting() @getsystemsetting"
,
"description"
:
"获取系统设置"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :-|
\n
| [GetSystemSettingResult](#getsystemsettingresult) |
\n\n
#### GetSystemSettingResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| bluetoothEnabled | boolean | 否 | 蓝牙是否开启 |
\n
| bluetoothError | string | 否 | 蓝牙的报错信息 |
\n
| locationEnabled | boolean | 否 | 位置是否开启 |
\n
| wifiEnabled | boolean | 否 | wifi是否开启 |
\n
| wifiError | string | 否 | wifi的报错信息 |
\n
| deviceOrientation | string | 否 | 设备方向 |
\n
"
,
"compatibility"
:
"### 兼容性
\n\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :-| :-| :-| :-| :-| :-|
\n
| 4.4 | √ | 3.9.0 | 9.0 | √ | 3.9.0 |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[getSystemSetting](https://uniapp.dcloud.net.cn/api/system/getsystemsetting.html)
\n
"
},
"general_type"
:{
"name"
:
"## 通用类型
\n
"
,
"param"
:
"### UniError
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| ctors | Constructor | 是 | - |
\n
| errSubject | string | 是 | - |
\n
| errCode | number | 是 | - |
\n
| errMsg | string | 是 | - |
\n
| data | any | 否 | - |
\n
| name | string | 是 | - |
\n
| message | string | 是 | - |
\n
| cause | [UTSError](#utserror) | 否 | - |
\n
| stack | string | 否 | - |
\n\n
### GeneralCallbackResult
\n\n
| 参数名 | 参数类型 | 是否必填 | 描述 |
\n
| :-| :-| :-| :-|
\n
| errMsg | string | 是 | 错误信息 |
\n
"
}}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录