Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
unidocs-zh
提交
9bc3f37a
unidocs-zh
项目概览
DCloud
/
unidocs-zh
通知
3216
Star
106
Fork
815
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
94
列表
看板
标记
里程碑
合并请求
70
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
94
Issue
94
列表
看板
标记
里程碑
合并请求
70
合并请求
70
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
9bc3f37a
编写于
11月 21, 2023
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 新增相关 Bug 链接至 issues 系统
上级
82376ebf
变更
26
显示空白变更内容
内联
并排
Showing
26 changed file
with
1983 addition
and
46 deletion
+1983
-46
docs/.vuepress/utils/cssJson.json
docs/.vuepress/utils/cssJson.json
+912
-1
docs/.vuepress/utils/maniFestJson.json
docs/.vuepress/utils/maniFestJson.json
+1
-1
docs/.vuepress/utils/pagesJson.json
docs/.vuepress/utils/pagesJson.json
+1
-1
docs/.vuepress/utils/utsApiJson.json
docs/.vuepress/utils/utsApiJson.json
+855
-1
docs/.vuepress/utils/utsComJson.json
docs/.vuepress/utils/utsComJson.json
+1
-1
docs/.vuepress/utils/utsJson.json
docs/.vuepress/utils/utsJson.json
+1
-1
docs/.vuepress/utils/utsUnicloudApiJson.json
docs/.vuepress/utils/utsUnicloudApiJson.json
+110
-1
docs/uni-app-x/manifest.md
docs/uni-app-x/manifest.md
+23
-21
docs/uni-app-x/pagesjson.md
docs/uni-app-x/pagesjson.md
+2
-0
docs/uts/buildin-object-api/array.md
docs/uts/buildin-object-api/array.md
+14
-0
docs/uts/buildin-object-api/console.md
docs/uts/buildin-object-api/console.md
+2
-0
docs/uts/buildin-object-api/date.md
docs/uts/buildin-object-api/date.md
+1
-0
docs/uts/buildin-object-api/global.md
docs/uts/buildin-object-api/global.md
+17
-1
docs/uts/buildin-object-api/json.md
docs/uts/buildin-object-api/json.md
+3
-1
docs/uts/buildin-object-api/map.md
docs/uts/buildin-object-api/map.md
+4
-2
docs/uts/buildin-object-api/math.md
docs/uts/buildin-object-api/math.md
+2
-0
docs/uts/buildin-object-api/number.md
docs/uts/buildin-object-api/number.md
+4
-2
docs/uts/buildin-object-api/promise.md
docs/uts/buildin-object-api/promise.md
+2
-0
docs/uts/buildin-object-api/regexp.md
docs/uts/buildin-object-api/regexp.md
+2
-0
docs/uts/buildin-object-api/set.md
docs/uts/buildin-object-api/set.md
+4
-2
docs/uts/buildin-object-api/string.md
docs/uts/buildin-object-api/string.md
+2
-0
docs/uts/buildin-object-api/utsjsonobject.md
docs/uts/buildin-object-api/utsjsonobject.md
+11
-8
docs/uts/utsandroid.md
docs/uts/utsandroid.md
+1
-0
docs/uts/utsandroidhookproxy.md
docs/uts/utsandroidhookproxy.md
+3
-1
docs/uts/utsios.md
docs/uts/utsios.md
+2
-0
docs/uts/utsioshookproxy.md
docs/uts/utsioshookproxy.md
+3
-1
未找到文件。
docs/.vuepress/utils/cssJson.json
浏览文件 @
9bc3f37a
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
docs/.vuepress/utils/maniFestJson.json
浏览文件 @
9bc3f37a
{
"manifest"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| appid | string | - | [DCloud AppID 使用说明](https://ask.dcloud.net.cn/article/35907) |
\n
| name | string | - | 应用名称 |
\n
| description | string | - | 应用描述 |
\n
| versionName | string | - | 应用版本名称 |
\n
| versionCode | integer | - | 应用版本号,必须是整数,取值范围1~2147483647;升级时必须高于上一次设置的值。 |
\n
| locale | '' | - | 默认语言 |
\n
| fallbackLocale | '' | - | 默认回退语言 |
\n
| uni-app-x | [uni-app-x 配置项列表](#manifest-uni-app-x) | - | 存在uni-app-x节点则表示为uni-app x项目 |
\n
| app | [app 配置项列表](#manifest-app) | - | App端(原生App)配置 |"
,
"description"
:
"[配置指南](http://uniapp.dcloud.io/manifest)"
},
"manifest_uni-app-x"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| flex-direction | 'row'
\\
| 'row-reverse'
\\
| 'column'
\\
| 'column-reverse' | column | uvue页面默认flex排列方向 |"
,
"description"
:
"存在uni-app-x节点则表示为uni-app x项目"
},
"manifest_app"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| distribute | [distribute 配置项列表](#app-distribute) | - | App端发布配置 |"
,
"description"
:
"App端(原生App)配置"
},
"app_distribute"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| syncDebug | boolean | - | 是否为自定义调试基座 |
\n
| icons | [icons 配置项列表](#distribute-icons) | - | iOS、Android应用图标配置。云打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,不推荐手动在源码视图中修改。 |
\n
| android | [android 配置项列表](#distribute-android) | - | App-Android端发布配置 |
\n
| ios | [ios 配置项列表](#distribute-ios) | - | IOS配置 |"
,
"description"
:
"App端发布配置"
},
"distribute_icons"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| android | [android 配置项列表](#icons-android) | - | Android图标配置 |
\n
| ios | [ios 配置项列表](#icons-ios) | - | iOS图标配置 |"
,
"description"
:
"iOS、Android应用图标配置。云打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,不推荐手动在源码视图中修改。"
},
"icons_android"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| hdpi | string | - | 高分屏设备程序图标,分辨率要求72x72 |
\n
| xhdpi | string | - | 720P高分屏设备程序图标,分辨率要求96x96 |
\n
| xxhdpi | string | - | 1080P高分屏设备程序图标,分辨率要求144x144 |
\n
| xxxhdpi | string | - | 2K屏设备程序图标,分辨率要求192x192 |"
},
"icons_ios"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| appstore | string | - | 提交app store使用的图标 1024x1024 |
\n
| iphone | [iphone 配置项列表](#ios-iphone) | - | iPhone图标配置 |
\n
| ipad | [ipad 配置项列表](#ios-ipad) | - | iPad图标配置 |"
},
"ios_iphone"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| app@2x | string | - | iOS9.0+ 程序图标(2x) |
\n
| app@3x | string | - | iOS9.0+ 程序图标(3x) |
\n
| spotlight@2x | string | - | iOS9.0+ Spotlight图标(2x) |
\n
| spotlight@3x | string | - | iOS9.0+ Spotlight图标(3x) |
\n
| settings@2x | string | - | iOS9.0+ Settings设置图标(2x) |
\n
| settings@3x | string | - | iOS9.0+ Settings设置图标(3x) |
\n
| notification@2x | string | - | iOS9.0+ 通知栏图标(2x) |
\n
| notification@3x | string | - | iOS9.0+ 通知栏图标(3x) |"
},
"ios_ipad"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| app | string | - | iOS9.0+ 程序图标 |
\n
| app@2x | string | - | iOS9.0+ 程序图标(2x) |
\n
| proapp@2x | string | - | iOS9.0+ 程序图标(3x) |
\n
| spotlight | string | - | iOS9.0+ Spotlight图标 |
\n
| spotlight@2x | string | - | iOS9.0+ Spotlight图标(2x) |
\n
| settings | string | - | iOS9.0+ Settings设置图标 |
\n
| settings@2x | string | - | iOS9.0+ Settings设置图标(2x) |
\n
| notification | string | - | iOS9.0+ 通知栏图标 |
\n
| notification@2x | string | - | iOS9.0+ 通知栏图标(2x) |"
},
"distribute_android"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| minSdkVersion | integer | 21 | 应用兼容的最低Android版本(API等级);[参考文档](https://uniapp.dcloud.io/tutorial/app-android-minsdkversion) |
\n
| targetSdkVersion | integer | 30 | 应用适配的目标Android版本(API等级),部分应用市场要求设置较高的targetSdkVersion才能提交审核;[参考文档](https://uniapp.dcloud.io/tutorial/app-android-targetsdkversion) |
\n
| abiFilters | Array
\\
<'armeabi-v7a'
\\
| 'arm64-v8a'
\\
| 'x86'
\\
| 'x86_64'> | [
\"
arm64-v8a
\"\\
] | [参考文档](https://uniapp.dcloud.io/tutorial/app-android-abifilters) |"
,
"description"
:
"App-Android端发布配置"
},
"distribute_ios"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| appid | string | - | iOS Bundle ID |"
}}
\ No newline at end of file
{
"manifest"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| appid | string | - | [DCloud AppID 使用说明](https://ask.dcloud.net.cn/article/35907) |
\n
| name | string | - | 应用名称 |
\n
| description | string | - | 应用描述 |
\n
| versionName | string | - | 应用版本名称 |
\n
| versionCode | integer | - | 应用版本号,必须是整数,取值范围1~2147483647;升级时必须高于上一次设置的值。 |
\n
| locale | '' | - | 默认语言 |
\n
| fallbackLocale | '' | - | 默认回退语言 |
\n
| uni-app-x | [uni-app-x 配置项列表](#manifest-uni-app-x) | - | 存在uni-app-x节点则表示为uni-app x项目 |
\n
| app | [app 配置项列表](#manifest-app) | - | App端(原生App)配置 |"
,
"description"
:
"[配置指南](http://uniapp.dcloud.io/manifest)"
},
"manifest_uni-app-x"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| flex-direction | 'row'
\\
| 'row-reverse'
\\
| 'column'
\\
| 'column-reverse' | column | uvue页面默认flex排列方向 |"
,
"description"
:
"存在uni-app-x节点则表示为uni-app x项目"
},
"manifest_app"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| distribute | [distribute 配置项列表](#app-distribute) | - | App端发布配置 |"
,
"description"
:
"App端(原生App)配置"
},
"app_distribute"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| syncDebug | boolean | - | 是否为自定义调试基座 |
\n
| icons | [icons 配置项列表](#distribute-icons) | - | iOS、Android应用图标配置。云打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,不推荐手动在源码视图中修改。 |
\n
| android | [android 配置项列表](#distribute-android) | - | App-Android端发布配置 |
\n
| ios | [ios 配置项列表](#distribute-ios) | - | IOS配置 |"
,
"description"
:
"App端发布配置"
},
"distribute_icons"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| android | [android 配置项列表](#icons-android) | - | Android图标配置 |
\n
| ios | [ios 配置项列表](#icons-ios) | - | iOS图标配置 |"
,
"description"
:
"iOS、Android应用图标配置。云打包后生效,建议在HBuilderX中 manifest.json 的可视化界面操作,不推荐手动在源码视图中修改。"
},
"icons_android"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| hdpi | string | - | 高分屏设备程序图标,分辨率要求72x72 |
\n
| xhdpi | string | - | 720P高分屏设备程序图标,分辨率要求96x96 |
\n
| xxhdpi | string | - | 1080P高分屏设备程序图标,分辨率要求144x144 |
\n
| xxxhdpi | string | - | 2K屏设备程序图标,分辨率要求192x192 |"
},
"icons_ios"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| appstore | string | - | 提交app store使用的图标 1024x1024 |
\n
| iphone | [iphone 配置项列表](#ios-iphone) | - | iPhone图标配置 |
\n
| ipad | [ipad 配置项列表](#ios-ipad) | - | iPad图标配置 |"
},
"ios_iphone"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| app@2x | string | - | iOS9.0+ 程序图标(2x) |
\n
| app@3x | string | - | iOS9.0+ 程序图标(3x) |
\n
| spotlight@2x | string | - | iOS9.0+ Spotlight图标(2x) |
\n
| spotlight@3x | string | - | iOS9.0+ Spotlight图标(3x) |
\n
| settings@2x | string | - | iOS9.0+ Settings设置图标(2x) |
\n
| settings@3x | string | - | iOS9.0+ Settings设置图标(3x) |
\n
| notification@2x | string | - | iOS9.0+ 通知栏图标(2x) |
\n
| notification@3x | string | - | iOS9.0+ 通知栏图标(3x) |"
},
"ios_ipad"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| app | string | - | iOS9.0+ 程序图标 |
\n
| app@2x | string | - | iOS9.0+ 程序图标(2x) |
\n
| proapp@2x | string | - | iOS9.0+ 程序图标(3x) |
\n
| spotlight | string | - | iOS9.0+ Spotlight图标 |
\n
| spotlight@2x | string | - | iOS9.0+ Spotlight图标(2x) |
\n
| settings | string | - | iOS9.0+ Settings设置图标 |
\n
| settings@2x | string | - | iOS9.0+ Settings设置图标(2x) |
\n
| notification | string | - | iOS9.0+ 通知栏图标 |
\n
| notification@2x | string | - | iOS9.0+ 通知栏图标(2x) |"
},
"distribute_android"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| minSdkVersion | integer | 21 | 应用兼容的最低Android版本(API等级);[参考文档](https://uniapp.dcloud.io/tutorial/app-android-minsdkversion) |
\n
| targetSdkVersion | integer | 30 | 应用适配的目标Android版本(API等级),部分应用市场要求设置较高的targetSdkVersion才能提交审核;[参考文档](https://uniapp.dcloud.io/tutorial/app-android-targetsdkversion) |
\n
| abiFilters | Array
\\
<'armeabi-v7a'
\\
| 'arm64-v8a'
\\
| 'x86'
\\
| 'x86_64'> | [
\"
arm64-v8a
\"\\
] | [参考文档](https://uniapp.dcloud.io/tutorial/app-android-abifilters) |"
,
"description"
:
"App-Android端发布配置"
},
"distribute_ios"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 描述 |
\n
| :- | :- | :- | :- |
\n
| appid | string | - | iOS Bundle ID |"
},
"tutorial"
:
"## 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=collocation.manifest_json)"
}
\ No newline at end of file
docs/.vuepress/utils/pagesJson.json
浏览文件 @
9bc3f37a
{
"pages"
:{
"compatibility"
:
"**pages.json 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| globalStyle | 5.0 | √ | √ | 10.0 | √ | x |
\n
| pages | 5.0 | √ | √ | 10.0 | √ | x |
\n
| tabBar | 5.0 | √ | √ | 10.0 | √ | x |
\n
| condition | 5.0 | √ | √ | 10.0 | √ | x |
\n
| easycom | 5.0 | 2.5.5+ | √ | 10.0 | 2.5.5+ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| globalStyle | [globalStyle 配置项列表](#pages-globalstyle) | - | 否 | - |
\n
| pages | Array
\\
<[PagesOptionsPage](#pagesoptionspage)> | - | 是 | 页面路径及窗口表现 |
\n
| tabBar | [tabBar 配置项列表](#pages-tabbar) | - | 否 | - |
\n
| condition | [condition 配置项列表](#pages-condition) | - | 否 | - |
\n
| easycom | [easycom 配置项列表](#pages-easycom) | - | 否 | 组件自动引入规则 |"
},
"pages_globalStyle"
:{
"compatibility"
:
"**globalStyle 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTextStyle | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTitleText | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationStyle | 5.0 | 2.0.3+ | √ | 10.0 | 2.0.3+ | x |
\n
| enablePullDownRefresh | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | HexColor | APP与H5为#F8F8F8,小程序平台请参考相应小程序文档 | 否 | 导航栏背景颜色(同状态栏背景色) |
\n
| navigationBarTextStyle | 'white'
\\
| 'black' | black | 否 | 导航栏标题颜色,仅支持 black/white(支付宝小程序不支持,请使用 [my.setNavigationBar](https://opendocs.alipay.com/mini/api/xwq8e6))。 |
\n
| navigationBarTitleText | string | - | 否 | 导航栏标题文字内容 |
\n
| navigationStyle | 'default'
\\
| 'custom' | default | 否 | 导航栏样式,仅支持 default/custom。custom即取消默认的原生导航栏,需看[使用注意](/collocation/pages.md?id=customnav)。 |
\n
| enablePullDownRefresh | boolean | false | 否 | 是否开启下拉刷新,详见[页面生命周期](/tutorial/page.md?id=lifecycle)。 |"
},
"PagesOptionsPage"
:{
"compatibility"
:
"**PagesOptionsPage 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| path | 5.0 | √ | √ | 10.0 | √ | x |
\n
| style | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| path | 'HBuilderX.PageURIString' | - | 是 | 配置页面路径 |
\n
| style | [style 配置项列表](#pagesoptionspage-style) | - | 否 | - |"
},
"PagesOptionsPage_style"
:{
"compatibility"
:
"**style 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTextStyle | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTitleText | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationStyle | 5.0 | 2.0.3+ | √ | 10.0 | 2.0.3+ | x |
\n
| enablePullDownRefresh | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | HexColor | APP与H5为#F8F8F8,小程序平台请参考相应小程序文档 | 否 | 导航栏背景颜色(同状态栏背景色) |
\n
| navigationBarTextStyle | 'white'
\\
| 'black' | black | 否 | 导航栏标题颜色,仅支持 black/white |
\n
| navigationBarTitleText | string | - | 否 | 导航栏标题文字内容 |
\n
| navigationStyle | 'default'
\\
| 'custom' | default | 否 | 导航栏样式,仅支持 default/custom。custom即取消默认的原生导航栏,需看[使用注意](/collocation/pages.md?id=customnav)。 |
\n
| enablePullDownRefresh | boolean | false | 否 | 是否开启下拉刷新,详见[页面生命周期](/tutorial/page.md#lifecycle)。 |
\n
| h5 | [h5 配置项列表](#style-h5) | - | 否 | - |
\n
| mp-alipay | [mp-alipay 配置项列表](#style-mp-alipay) | - | 否 | - |"
},
"style_h5"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| titleNView | [titleNView 配置项列表](#h5-titlenview) | - | 否 | - |
\n
| pullToRefresh | [pullToRefresh 配置项列表](#h5-pulltorefresh) | - | 否 | - |"
},
"h5_titleNView"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| backgroundColor | 'HBuilderX.ColorString' | #f7f7f7 | 否 | 背景颜色,颜色值格式为
\"
#RRGGBB
\"
。 |
\n
| buttons | array | - | 否 | 自定义按钮,参考 [buttons](/collocation/pages.md?id=h5-titlenview-buttons)。 |
\n
| titleColor | 'HBuilderX.ColorString' | #000000 | 否 | 标题文字颜色 |
\n
| titleText | string | - | 否 | 标题文字内容 |
\n
| titleSize | string | - | 否 | 标题文字字体大小 |
\n
| type | 'default'
\\
| 'transparent' | default | 否 | 导航栏样式。
\"
default
\"
-默认样式;
\"
transparent
\"
-透明渐变。 |
\n
| searchInput | object | - | 否 | 导航栏上的搜索框样式,详见:[searchInput](/collocation/pages.md?id=h5-searchinput)。 |"
},
"h5_pullToRefresh"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| support | boolean | - | 否 | 是否开启窗口的下拉刷新功能 |
\n
| color | 'HBuilderX.ColorString' | - | 否 | 颜色值格式为
\"
#RRGGBB
\"
,仅
\"
circle
\"
样式下拉刷新支持此属性。 |
\n
| type | 'default'
\\
| 'circle' | - | 否 | 下拉刷新控件样式 |
\n
| height | string | - | 否 | 窗口的下拉刷新控件进入刷新状态的拉拽高度。支持百分比,如
\"
10%
\"
;像素值,如
\"
50px
\"
。 |
\n
| range | string | - | 否 | 窗口可下拉拖拽的范围。支持百分比,如
\"
10%
\"
;像素值,如
\"
50px
\"
。 |
\n
| offset | string | - | 否 | 下拉刷新控件的起始位置。仅对
\"
circle
\"
样式下拉刷新控件有效,用于定义刷新控件下拉时的起始位置。支持百分比,如
\"
10%
\"
;像素值,如
\"
50px
\"
。 |
\n
| contentdown | [contentdown 配置项列表](#pulltorefresh-contentdown) | - | 否 | - |
\n
| contentover | [contentover 配置项列表](#pulltorefresh-contentover) | - | 否 | - |
\n
| contentrefresh | [contentrefresh 配置项列表](#pulltorefresh-contentrefresh) | - | 否 | - |"
},
"pullToRefresh_contentdown"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| caption | string | - | 否 | 下拉刷新控件上显示的标题内容 |"
},
"pullToRefresh_contentover"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| caption | string | - | 否 | 下拉刷新控件上显示的标题内容 |"
},
"pullToRefresh_contentrefresh"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| caption | string | - | 否 | 下拉刷新控件上显示的标题内容 |"
},
"style_mp-alipay"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| allowsBounceVertical | 'YES'
\\
| 'NO' | YES | 否 | 是否允许向下拉拽。支持 YES / NO |
\n
| transparentTitle | 'always'
\\
| 'auto'
\\
| 'none' | none | 否 | 导航栏透明设置。支持 always 一直透明 / auto 滑动自适应 / none 不透明 |
\n
| titlePenetrate | string | No | 否 | 导航栏点击穿透 |
\n
| showTitleLoading | 'YES'
\\
| 'NO' | No | 否 | 是否进入时显示导航栏的 loading。支持 YES / NO |
\n
| titleImage | string | - | 否 | 导航栏图片地址,替换导航栏标题,必须为https的图片链接地址 |
\n
| backgroundImageUrl | 'HBuilderX.ImageURIString' | - | 否 | 下拉露出显示的背景图链接 |
\n
| backgroundImageColor | 'HBuilderX.ColorString' | - | 否 | 下拉露出显示的背景图底色 |
\n
| gestureBack | 'YES'
\\
| 'NO' | No | 否 | 支付宝小程序 iOS 用,是否支持手势返回。支持 YES / NO |
\n
| enableScrollBar | 'YES'
\\
| 'NO' | YES | 否 | 支付宝小程序 Android 用,是否显示 WebView 滚动条。支持 YES / NO。 |"
},
"pages_tabBar"
:{
"compatibility"
:
"**tabBar 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| color | 5.0 | √ | √ | 10.0 | √ | x |
\n
| selectedColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| backgroundColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| list | 5.0 | √ | √ | 10.0 | √ | x |
\n
| backgroundImage | 5.0 | √ | √ | 10.0 | √ | x |
\n
| backgroundRepeat | 5.0 | √ | √ | 10.0 | √ | x |
\n
| redDotColor | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| color | 'HBuilderX.ColorString' | - | 是 | tab 上的文字默认颜色 |
\n
| selectedColor | 'HBuilderX.ColorString' | - | 是 | tab 上的文字选中时的颜色 |
\n
| backgroundColor | 'HBuilderX.ColorString' | - | 是 | tab 的背景色 |
\n
| list | Array
\\
<[PagesOptionsTabbarList](#pagesoptionstabbarlist)> | - | 是 | tab 的列表,详见 list 属性说明,最少2个、最多5个 tab |
\n
| backgroundImage | string | - | 否 | 设置背景图片,优先级高于 backgroundColor |
\n
| backgroundRepeat | 'repeat'
\\
| 'repeat-x'
\\
| 'repeat-y'
\\
| 'no-repeat' | - | 否 | 设置标题栏的背景图平铺方式 |
\n
| redDotColor | 'HBuilderX.ColorString' | - | 否 | tabbar上红点颜色 |"
},
"PagesOptionsTabbarList"
:{
"compatibility"
:
"**PagesOptionsTabbarList 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| iconfont | 5.0 | 3.4.4+ | √ | 10.0 | 3.4.4+ | x |
\n
| pagePath | 5.0 | √ | √ | 10.0 | √ | x |
\n
| text | 5.0 | √ | √ | 10.0 | √ | x |
\n
| iconPath | 5.0 | √ | √ | 10.0 | √ | x |
\n
| selectedIconPath | 5.0 | √ | √ | 10.0 | √ | x |
\n
| visible | 5.0 | 3.2.10+ | √ | 10.0 | 3.2.10+ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| iconfont | [iconfont 配置项列表](#pagesoptionstabbarlist-iconfont) | - | 否 | 字体图标,优先级高于 iconPath |
\n
| pagePath | 'HBuilderX.PageURIString' | - | 是 | 页面路径,必须在 pages 中先定义 |
\n
| text | string | - | 是 | tab 上按钮文字,在 App 和 H5 平台为非必填。例如中间可放一个没有文字的+号图标 |
\n
| iconPath | 'HBuilderX.ImageURIString' | - | 否 | 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 position 为 top 时,此参数无效,不支持网络图片,不支持字体图标 |
\n
| selectedIconPath | 'HBuilderX.ImageURIString' | - | 否 | 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 position 为 top 时,此参数无效 |
\n
| visible | string | - | 否 | 该项是否显示,默认显示 |"
},
"PagesOptionsTabbarList_iconfont"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| text | string | - | 否 | 字库 Unicode 码 |
\n
| selectedText | string | - | 否 | 选中后字库 Unicode 码 |
\n
| fontSize | string | - | 否 | 字体图标字号(px) |
\n
| color | 'HBuilderX.ColorString' | - | 否 | 字体图标颜色 |
\n
| selectedColor | 'HBuilderX.ColorString' | - | 否 | 字体图标选中颜色 |"
,
"description"
:
"字体图标,优先级高于 iconPath"
},
"pages_condition"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| current | number | - | 是 | 当前激活的模式,list节点的索引值。 |
\n
| list | Array
\\
<[PagesConditionItem](#pagesconditionitem)> | - | 是 | 启动模式列表 |"
},
"PagesConditionItem"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string | - | 是 | 启动模式名称 |
\n
| path | 'HBuilderX.PageURIString' | - | 是 | 启动页面路径 |
\n
| query | string | - | 否 | 启动参数,可在页面的 onLoad 函数里获得 |"
},
"pages_easycom"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| autoscan | boolean | true | 否 | 是否开启自动扫描,开启后将会自动扫描符合components/组件名称/组件名称.vue/uvue目录结构的组件 |
\n
| custom | object | - | 否 | 以正则方式自定义组件匹配规则。如果autoscan不能满足需求,可以使用custom自定义匹配规则 |"
,
"description"
:
"组件自动引入规则"
}}
\ No newline at end of file
{
"pages"
:{
"compatibility"
:
"**pages.json 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| globalStyle | 5.0 | √ | √ | 10.0 | √ | x |
\n
| pages | 5.0 | √ | √ | 10.0 | √ | x |
\n
| tabBar | 5.0 | √ | √ | 10.0 | √ | x |
\n
| condition | 5.0 | √ | √ | 10.0 | √ | x |
\n
| easycom | 5.0 | 2.5.5+ | √ | 10.0 | 2.5.5+ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| globalStyle | [globalStyle 配置项列表](#pages-globalstyle) | - | 否 | - |
\n
| pages | Array
\\
<[PagesOptionsPage](#pagesoptionspage)> | - | 是 | 页面路径及窗口表现 |
\n
| tabBar | [tabBar 配置项列表](#pages-tabbar) | - | 否 | - |
\n
| condition | [condition 配置项列表](#pages-condition) | - | 否 | - |
\n
| easycom | [easycom 配置项列表](#pages-easycom) | - | 否 | 组件自动引入规则 |"
},
"pages_globalStyle"
:{
"compatibility"
:
"**globalStyle 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTextStyle | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTitleText | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationStyle | 5.0 | 2.0.3+ | √ | 10.0 | 2.0.3+ | x |
\n
| enablePullDownRefresh | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | HexColor | APP与H5为#F8F8F8,小程序平台请参考相应小程序文档 | 否 | 导航栏背景颜色(同状态栏背景色) |
\n
| navigationBarTextStyle | 'white'
\\
| 'black' | black | 否 | 导航栏标题颜色,仅支持 black/white(支付宝小程序不支持,请使用 [my.setNavigationBar](https://opendocs.alipay.com/mini/api/xwq8e6))。 |
\n
| navigationBarTitleText | string | - | 否 | 导航栏标题文字内容 |
\n
| navigationStyle | 'default'
\\
| 'custom' | default | 否 | 导航栏样式,仅支持 default/custom。custom即取消默认的原生导航栏,需看[使用注意](/collocation/pages.md?id=customnav)。 |
\n
| enablePullDownRefresh | boolean | false | 否 | 是否开启下拉刷新,详见[页面生命周期](/tutorial/page.md?id=lifecycle)。 |"
},
"PagesOptionsPage"
:{
"compatibility"
:
"**PagesOptionsPage 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| path | 5.0 | √ | √ | 10.0 | √ | x |
\n
| style | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| path | 'HBuilderX.PageURIString' | - | 是 | 配置页面路径 |
\n
| style | [style 配置项列表](#pagesoptionspage-style) | - | 否 | - |"
},
"PagesOptionsPage_style"
:{
"compatibility"
:
"**style 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTextStyle | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationBarTitleText | 5.0 | √ | √ | 10.0 | √ | x |
\n
| navigationStyle | 5.0 | 2.0.3+ | √ | 10.0 | 2.0.3+ | x |
\n
| enablePullDownRefresh | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| navigationBarBackgroundColor | HexColor | APP与H5为#F8F8F8,小程序平台请参考相应小程序文档 | 否 | 导航栏背景颜色(同状态栏背景色) |
\n
| navigationBarTextStyle | 'white'
\\
| 'black' | black | 否 | 导航栏标题颜色,仅支持 black/white |
\n
| navigationBarTitleText | string | - | 否 | 导航栏标题文字内容 |
\n
| navigationStyle | 'default'
\\
| 'custom' | default | 否 | 导航栏样式,仅支持 default/custom。custom即取消默认的原生导航栏,需看[使用注意](/collocation/pages.md?id=customnav)。 |
\n
| enablePullDownRefresh | boolean | false | 否 | 是否开启下拉刷新,详见[页面生命周期](/tutorial/page.md#lifecycle)。 |
\n
| h5 | [h5 配置项列表](#style-h5) | - | 否 | - |
\n
| mp-alipay | [mp-alipay 配置项列表](#style-mp-alipay) | - | 否 | - |"
},
"style_h5"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| titleNView | [titleNView 配置项列表](#h5-titlenview) | - | 否 | - |
\n
| pullToRefresh | [pullToRefresh 配置项列表](#h5-pulltorefresh) | - | 否 | - |"
},
"h5_titleNView"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| backgroundColor | 'HBuilderX.ColorString' | #f7f7f7 | 否 | 背景颜色,颜色值格式为
\"
#RRGGBB
\"
。 |
\n
| buttons | array | - | 否 | 自定义按钮,参考 [buttons](/collocation/pages.md?id=h5-titlenview-buttons)。 |
\n
| titleColor | 'HBuilderX.ColorString' | #000000 | 否 | 标题文字颜色 |
\n
| titleText | string | - | 否 | 标题文字内容 |
\n
| titleSize | string | - | 否 | 标题文字字体大小 |
\n
| type | 'default'
\\
| 'transparent' | default | 否 | 导航栏样式。
\"
default
\"
-默认样式;
\"
transparent
\"
-透明渐变。 |
\n
| searchInput | object | - | 否 | 导航栏上的搜索框样式,详见:[searchInput](/collocation/pages.md?id=h5-searchinput)。 |"
},
"h5_pullToRefresh"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| support | boolean | - | 否 | 是否开启窗口的下拉刷新功能 |
\n
| color | 'HBuilderX.ColorString' | - | 否 | 颜色值格式为
\"
#RRGGBB
\"
,仅
\"
circle
\"
样式下拉刷新支持此属性。 |
\n
| type | 'default'
\\
| 'circle' | - | 否 | 下拉刷新控件样式 |
\n
| height | string | - | 否 | 窗口的下拉刷新控件进入刷新状态的拉拽高度。支持百分比,如
\"
10%
\"
;像素值,如
\"
50px
\"
。 |
\n
| range | string | - | 否 | 窗口可下拉拖拽的范围。支持百分比,如
\"
10%
\"
;像素值,如
\"
50px
\"
。 |
\n
| offset | string | - | 否 | 下拉刷新控件的起始位置。仅对
\"
circle
\"
样式下拉刷新控件有效,用于定义刷新控件下拉时的起始位置。支持百分比,如
\"
10%
\"
;像素值,如
\"
50px
\"
。 |
\n
| contentdown | [contentdown 配置项列表](#pulltorefresh-contentdown) | - | 否 | - |
\n
| contentover | [contentover 配置项列表](#pulltorefresh-contentover) | - | 否 | - |
\n
| contentrefresh | [contentrefresh 配置项列表](#pulltorefresh-contentrefresh) | - | 否 | - |"
},
"pullToRefresh_contentdown"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| caption | string | - | 否 | 下拉刷新控件上显示的标题内容 |"
},
"pullToRefresh_contentover"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| caption | string | - | 否 | 下拉刷新控件上显示的标题内容 |"
},
"pullToRefresh_contentrefresh"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| caption | string | - | 否 | 下拉刷新控件上显示的标题内容 |"
},
"style_mp-alipay"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| allowsBounceVertical | 'YES'
\\
| 'NO' | YES | 否 | 是否允许向下拉拽。支持 YES / NO |
\n
| transparentTitle | 'always'
\\
| 'auto'
\\
| 'none' | none | 否 | 导航栏透明设置。支持 always 一直透明 / auto 滑动自适应 / none 不透明 |
\n
| titlePenetrate | string | No | 否 | 导航栏点击穿透 |
\n
| showTitleLoading | 'YES'
\\
| 'NO' | No | 否 | 是否进入时显示导航栏的 loading。支持 YES / NO |
\n
| titleImage | string | - | 否 | 导航栏图片地址,替换导航栏标题,必须为https的图片链接地址 |
\n
| backgroundImageUrl | 'HBuilderX.ImageURIString' | - | 否 | 下拉露出显示的背景图链接 |
\n
| backgroundImageColor | 'HBuilderX.ColorString' | - | 否 | 下拉露出显示的背景图底色 |
\n
| gestureBack | 'YES'
\\
| 'NO' | No | 否 | 支付宝小程序 iOS 用,是否支持手势返回。支持 YES / NO |
\n
| enableScrollBar | 'YES'
\\
| 'NO' | YES | 否 | 支付宝小程序 Android 用,是否显示 WebView 滚动条。支持 YES / NO。 |"
},
"pages_tabBar"
:{
"compatibility"
:
"**tabBar 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| color | 5.0 | √ | √ | 10.0 | √ | x |
\n
| selectedColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| backgroundColor | 5.0 | √ | √ | 10.0 | √ | x |
\n
| list | 5.0 | √ | √ | 10.0 | √ | x |
\n
| backgroundImage | 5.0 | √ | √ | 10.0 | √ | x |
\n
| backgroundRepeat | 5.0 | √ | √ | 10.0 | √ | x |
\n
| redDotColor | 5.0 | √ | √ | 10.0 | √ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| color | 'HBuilderX.ColorString' | - | 是 | tab 上的文字默认颜色 |
\n
| selectedColor | 'HBuilderX.ColorString' | - | 是 | tab 上的文字选中时的颜色 |
\n
| backgroundColor | 'HBuilderX.ColorString' | - | 是 | tab 的背景色 |
\n
| list | Array
\\
<[PagesOptionsTabbarList](#pagesoptionstabbarlist)> | - | 是 | tab 的列表,详见 list 属性说明,最少2个、最多5个 tab |
\n
| backgroundImage | string | - | 否 | 设置背景图片,优先级高于 backgroundColor |
\n
| backgroundRepeat | 'repeat'
\\
| 'repeat-x'
\\
| 'repeat-y'
\\
| 'no-repeat' | - | 否 | 设置标题栏的背景图平铺方式 |
\n
| redDotColor | 'HBuilderX.ColorString' | - | 否 | tabbar上红点颜色 |"
},
"PagesOptionsTabbarList"
:{
"compatibility"
:
"**PagesOptionsTabbarList 兼容性**
\n
| | 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- | :- |
\n
| iconfont | 5.0 | 3.4.4+ | √ | 10.0 | 3.4.4+ | x |
\n
| pagePath | 5.0 | √ | √ | 10.0 | √ | x |
\n
| text | 5.0 | √ | √ | 10.0 | √ | x |
\n
| iconPath | 5.0 | √ | √ | 10.0 | √ | x |
\n
| selectedIconPath | 5.0 | √ | √ | 10.0 | √ | x |
\n
| visible | 5.0 | 3.2.10+ | √ | 10.0 | 3.2.10+ | x |"
,
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| iconfont | [iconfont 配置项列表](#pagesoptionstabbarlist-iconfont) | - | 否 | 字体图标,优先级高于 iconPath |
\n
| pagePath | 'HBuilderX.PageURIString' | - | 是 | 页面路径,必须在 pages 中先定义 |
\n
| text | string | - | 是 | tab 上按钮文字,在 App 和 H5 平台为非必填。例如中间可放一个没有文字的+号图标 |
\n
| iconPath | 'HBuilderX.ImageURIString' | - | 否 | 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,当 position 为 top 时,此参数无效,不支持网络图片,不支持字体图标 |
\n
| selectedIconPath | 'HBuilderX.ImageURIString' | - | 否 | 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px ,当 position 为 top 时,此参数无效 |
\n
| visible | string | - | 否 | 该项是否显示,默认显示 |"
},
"PagesOptionsTabbarList_iconfont"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| text | string | - | 否 | 字库 Unicode 码 |
\n
| selectedText | string | - | 否 | 选中后字库 Unicode 码 |
\n
| fontSize | string | - | 否 | 字体图标字号(px) |
\n
| color | 'HBuilderX.ColorString' | - | 否 | 字体图标颜色 |
\n
| selectedColor | 'HBuilderX.ColorString' | - | 否 | 字体图标选中颜色 |"
,
"description"
:
"字体图标,优先级高于 iconPath"
},
"pages_condition"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| current | number | - | 是 | 当前激活的模式,list节点的索引值。 |
\n
| list | Array
\\
<[PagesConditionItem](#pagesconditionitem)> | - | 是 | 启动模式列表 |"
},
"PagesConditionItem"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string | - | 是 | 启动模式名称 |
\n
| path | 'HBuilderX.PageURIString' | - | 是 | 启动页面路径 |
\n
| query | string | - | 否 | 启动参数,可在页面的 onLoad 函数里获得 |"
},
"pages_easycom"
:{
"table"
:
"| 属性 | 类型 | 默认值 | 必填 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| autoscan | boolean | true | 否 | 是否开启自动扫描,开启后将会自动扫描符合components/组件名称/组件名称.vue/uvue目录结构的组件 |
\n
| custom | object | - | 否 | 以正则方式自定义组件匹配规则。如果autoscan不能满足需求,可以使用custom自定义匹配规则 |"
,
"description"
:
"组件自动引入规则"
},
"tutorial"
:
"## 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=collocation.pages_json)"
}
\ No newline at end of file
docs/.vuepress/utils/utsApiJson.json
浏览文件 @
9bc3f37a
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
docs/.vuepress/utils/utsComJson.json
浏览文件 @
9bc3f37a
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
docs/.vuepress/utils/utsJson.json
浏览文件 @
9bc3f37a
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
docs/.vuepress/utils/utsUnicloudApiJson.json
浏览文件 @
9bc3f37a
{
"uniCloud_props"
:{
"name"
:
"# uniCloud"
,
"description"
:
""
,
"param"
:
"## 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| config | [UniCloudInitOptions](#unicloudinitoptions-values) | 是 | - | - |
\n
### UniCloudInitOptions 属性值 @unicloudinitoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| provider | string | 是 | - | 服务商,目前支持 aliyun、tencent |
\n
| spaceName | string | 否 | - | 服务空间名 |
\n
| spaceId | string | 是 | - | 服务空间id |
\n
| clientSecret | string | 否 | - | 阿里云clientSecret |
\n
| endpoint | string | 否 | - | 阿里云endpoint |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
""
,
"tutorial"
:
""
},
"callFunction"
:{
"name"
:
"## callFunction(options) @callfunction"
,
"description"
:
"请求云函数"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudCallFunctionOptions](#unicloudcallfunctionoptions-values) | 是 | - | - |
\n
#### UniCloudCallFunctionOptions 属性值 @unicloudcallfunctionoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string (string.CloudFunctionString) | 是 | - | 云函数名 |
\n
| data | any | 否 | - | 云函数参数 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudCallFunctionResult](#unicloudcallfunctionresult-values)> |
\n\n
#### UniCloudCallFunctionResult 属性值 @unicloudcallfunctionresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| result | any | 是 | - | 云函数参数 |
\n
| requestId | string | 否 | - | 云函数请求id |
\n
"
,
"compatibility"
:
"### callFunction 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"unicloud-call-function"
:{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-call-function/unicloud-call-function.uvue)
\n
```html
\n
<template>
\n
<!-- #ifdef APP -->
\n
<scroll-view style=
\"
flex: 1
\"
>
\n
<!-- #endif -->
\n
<view>
\n
<page-head :title=
\"
title
\"
></page-head>
\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@click=
\"
callFunction
\"
>请求云函数</button>
\n
</view>
\n
</view>
\n
</view>
\n
<!-- #ifdef APP -->
\n
</scroll-view>
\n
<!-- #endif -->
\n
</template>
\n
<script>
\n
export default {
\n
data() {
\n
return {
\n
title: '请求云函数',
\n
callFunctionResult: {},
\n
callFunctionError: {},
\n
isUniTest: false
\n
}
\n
},
\n
onLoad() {
\n
},
\n
onUnload() {
\n
if(this.isUniTest){
\n
uni.hideToast()
\n
}
\n
},
\n
methods: {
\n
notify(content : string, title : string) {
\n
if (!this.isUniTest) {
\n
uni.showModal({
\n
title,
\n
content,
\n
showCancel: false
\n
})
\n
} else {
\n
uni.showToast({
\n
title: content
\n
})
\n
}
\n
},
\n
callFunction: function () {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
uniCloud.callFunction({
\n
name: 'echo-cf',
\n
data: {
\n
num: 1,
\n
str: 'ABC'
\n
}
\n
}).then<void>(res => {
\n
const result = res.result
\n
this.callFunctionResult = result
\n
console.log(JSON.stringify(result))
\n
uni.hideLoading()
\n
this.notify(result['showMessage'] as string, '提示')
\n
}).catch<void>((err : any | null) => {
\n
const error = err as UniCloudError
\n
this.callFunctionError = {
\n
errCode: error.errCode,
\n
errMsg: error.errMsg
\n
}
\n
uni.hideLoading()
\n
this.notify(error.errMsg, '错误')
\n
})
\n
}
\n
}
\n
}
\n
</script>
\n\n
<style>
\n
</style>
\n
```"
},
"importObject"
:{
"name"
:
"## importObject(objectName, options?) @importobject"
,
"description"
:
"引用云对象"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| objectName | string (string.CloudObjectString) | 是 | - | - |
\n
| options | [UniCloudImportObjectOptions](#unicloudimportobjectoptions-values) | 否 | - | - |
\n
#### UniCloudImportObjectOptions 属性值 @unicloudimportobjectoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| customUI | boolean | 否 | - | 是否移除自动展示的ui |
\n
| loadingOptions | [UniCloudImportObjectLoadingOptions](#unicloudimportobjectloadingoptions-values) | 否 | - | loading界面配置 |
\n
| errorOptions | [UniCloudImportObjectErrorOptions](#unicloudimportobjecterroroptions-values) | 否 | - | 错误提示配置 |
\n\n
##### UniCloudImportObjectLoadingOptions 属性值 @unicloudimportobjectloadingoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| title | string | 否 | - | 加载框标题 |
\n
| mask | boolean | 否 | - | 加载框是否显示mask |
\n\n
##### UniCloudImportObjectErrorOptions 属性值 @unicloudimportobjecterroroptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 否 | - | 错误提示类型,可以是modal或者toast |
\n
| retry | boolean | 否 | - | 是否显示重试按钮 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| any |
\n
"
,
"compatibility"
:
"### importObject 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"unicloud-import-object"
:{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-import-object/unicloud-import-object.uvue)
\n
```html
\n
<template>
\n
<!-- #ifdef APP -->
\n
<scroll-view style=
\"
flex:1
\"
>
\n
<!-- #endif -->
\n
<view>
\n
<page-head :title=
\"
title
\"
></page-head>
\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@tap=
\"
addTodo
\"
>添加Todo</button>
\n
</view>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@tap=
\"
randomFail
\"
>随机触发失败重试</button>
\n
</view>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@tap=
\"
fail
\"
>云对象失败调用</button>
\n
</view>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@tap=
\"
success
\"
>云对象成功调用</button>
\n
</view>
\n
</view>
\n
</view>
\n
<!-- #ifdef APP -->
\n
</scroll-view>
\n
<!-- #endif -->
\n
</template>
\n\n
<script>
\n
export default {
\n
data() {
\n
return {
\n
title: '请求云对象',
\n
todoTitle: '学习编程',
\n
todoContent: '熟悉uts语法',
\n
returnTodoTitle: '',
\n
returnTodoContent: '',
\n
failErrCode: '',
\n
successErrCode: -1,
\n
isUniTest: false
\n
}
\n
},
\n
onUnload() {
\n
if(this.isUniTest){
\n
uni.hideToast()
\n
}
\n
},
\n
methods: {
\n
notify(content : string, title : string) {
\n
if (!this.isUniTest) {
\n
uni.showModal({
\n
title,
\n
content,
\n
showCancel: false
\n
})
\n
} else {
\n
uni.showToast({
\n
title: content
\n
})
\n
}
\n
},
\n
addTodo() {
\n
const todo = uniCloud.importObject('todo', {
\n
customUI: this.isUniTest
\n
})
\n
const title = this.todoTitle
\n
const content = this.todoContent
\n
todo.add(title, content).then<void>((res : UTSJSONObject) : void => {
\n
this.returnTodoTitle = res['title'] as string
\n
this.returnTodoContent = res['content'] as string
\n
this.notify(res['showMessage'] as string, '提示')
\n
}).catch<void>((err : any | null) : void => {
\n
const error = err as UniCloudError
\n
console.error(error)
\n
})
\n
},
\n
randomFail() {
\n
const todoObj = uniCloud.importObject('todo', {
\n
errorOptions: {
\n
retry: true
\n
}
\n
})
\n
todoObj.randomFail().then<void>((res : UTSJSONObject) : void => {
\n
this.notify(res['showMessage'] as string, '提示')
\n
}).catch<void>((err : any | null) : void => {
\n
const error = err as UniCloudError
\n
console.error(error)
\n
})
\n
},
\n
fail() {
\n
const todo = uniCloud.importObject('todo', {
\n
customUI: this.isUniTest
\n
})
\n
todo.fail().then<void>((res : UTSJSONObject) : void => {
\n
this.notify('todo.fail应调用失败,此处错误的触发了成功回调', '错误')
\n
console.log('todo.fail: ', res);
\n
}).catch<void>((err : any | null) : void => {
\n
const error = err as UniCloudError
\n
this.failErrCode = error.errCode as string
\n
console.error(error)
\n
if (this.isUniTest) {
\n
uni.showToast({
\n
title: err.errMsg
\n
})
\n
}
\n
})
\n
},
\n
success() {
\n
const todo = uniCloud.importObject('todo', {
\n
customUI: this.isUniTest
\n
})
\n
todo.success().then<void>((res : UTSJSONObject) : void => {
\n
this.successErrCode = res['errCode'] as number
\n
this.notify(res['showMessage'] as string, '提示')
\n
}).catch<void>((err : any | null) : void => {
\n
const error = err as UniCloudError
\n
console.error(error)
\n
})
\n
}
\n
}
\n
}
\n
</script>
\n\n
<style>
\n\n
</style>
\n
```"
},
"uploadFile"
:{
"name"
:
"## uploadFile(options) @uploadfile"
,
"description"
:
"上传文件到云存储"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudUploadFileOptions](#uniclouduploadfileoptions-values) | 是 | - | - |
\n
#### UniCloudUploadFileOptions 属性值 @uniclouduploadfileoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| filePath | string | 是 | - | 文件路径 |
\n
| cloudPath | string | 是 | - | 云端路径 |
\n
| cloudPathAsRealPath | boolean | 否 | - | 是否以云端路径是否为真实路径保存上传的文件 |
\n
| onUploadProgress | (options: [UniCloudUploadProgress](#uniclouduploadprogress-values)) => any | 否 | - | 上传进度回调 |
\n\n
##### UniCloudUploadProgress 属性值 @uniclouduploadprogress-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| loaded | number | 是 | - | 已上传大小 |
\n
| total | number | 是 | - | 总大小 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudUploadFileResult](#uniclouduploadfileresult-values)> |
\n\n
#### UniCloudUploadFileResult 属性值 @uniclouduploadfileresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| filePath | string | 是 | - | 文件路径 |
\n
| fileID | string | 是 | - | 文件id |
\n
"
,
"compatibility"
:
"### uploadFile 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"getTempFileURL"
:{
"name"
:
"## getTempFileURL(options) @gettempfileurl"
,
"description"
:
"获取文件临时URL"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudGetTempFileURLOptions](#unicloudgettempfileurloptions-values) | 是 | - | - |
\n
#### UniCloudGetTempFileURLOptions 属性值 @unicloudgettempfileurloptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| fileList | Array
\\
<string
\\
> | 是 | - | 文件列表 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudGetTempFileURLResult](#unicloudgettempfileurlresult-values)> |
\n\n
#### UniCloudGetTempFileURLResult 属性值 @unicloudgettempfileurlresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| fileList | Array
\\
<[UniCloudGetTempFileURLResultItem](#unicloudgettempfileurlresultitem-values)
\\
> | 是 | - | 文件列表 |
\n\n
##### UniCloudGetTempFileURLResultItem 属性值 @unicloudgettempfileurlresultitem-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| fileID | string | 是 | - | 文件id |
\n
| tempFileURL | string | 是 | - | 文件临时url |
\n
"
,
"compatibility"
:
"### getTempFileURL 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"chooseAndUploadFile"
:{
"name"
:
"## chooseAndUploadFile(options) @chooseanduploadfile"
,
"description"
:
"选择并上传文件"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudChooseAndUploadFileOptions](#unicloudchooseanduploadfileoptions-values) | 是 | - | - |
\n
#### UniCloudChooseAndUploadFileOptions 属性值 @unicloudchooseanduploadfileoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| sourceType | Array
\\
<string
\\
> | 否 | - | - |
\n
| count | number | 否 | - | - |
\n
| sizeType | Array
\\
<string
\\
> | 否 | - | - |
\n
| extension | Array
\\
<string
\\
> | 否 | - | - |
\n
| compressed | boolean | 否 | - | - |
\n
| maxDuration | number | 否 | - | - |
\n
| camera | string | 否 | - | - |
\n
| crop | ChooseImageCropOptions | 否 | - | - |
\n
| type | string | 是 | - | - |
\n
| onChooseFile | (arg: [UniCloudChooseFileResult](#unicloudchoosefileresult-values)) => void | 否 | - | - |
\n
| onUploadProgress | (arg: [UniCloudChooseAndUploadFileProgressEvent](#unicloudchooseanduploadfileprogressevent-values)) => void | 否 | - | - |
\n\n
##### UniCloudChooseFileResult 属性值 @unicloudchoosefileresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| tempFiles | Array
\\
<[UniCloudChooseFileItem](#unicloudchoosefileitem-values)
\\
> | 是 | - | - |
\n
| tempFilePaths | Array
\\
<string
\\
> | 是 | - | - |
\n\n
###### UniCloudChooseFileItem 属性值 @unicloudchoosefileitem-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string | 是 | - | - |
\n
| path | string | 是 | - | - |
\n
| cloudPath | string | 是 | - | - |
\n
| cloudPathAsRealPath | boolean | 否 | - | - |
\n
| url | string | 否 | - | - |
\n
| errMsg | string | 否 | - | - |
\n\n
##### UniCloudChooseAndUploadFileProgressEvent 属性值 @unicloudchooseanduploadfileprogressevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| index | number | 是 | - | - |
\n
| loaded | number | 是 | - | - |
\n
| total | number | 是 | - | - |
\n
| tempFilePath | string | 是 | - | - |
\n
| tempFile | [UniCloudChooseFileItem](#unicloudchoosefileitem-values) | 是 | - | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudChooseAndUploadFileResult](#unicloudchooseanduploadfileresult-values)> |
\n\n
#### UniCloudChooseAndUploadFileResult 属性值 @unicloudchooseanduploadfileresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| tempFiles | Array
\\
<[UniCloudChooseFileItem](#unicloudchoosefileitem-values)
\\
> | 是 | - | - |
\n
| tempFilePaths | Array
\\
<string
\\
> | 是 | - | - |
\n\n
##### UniCloudChooseFileItem 属性值 @unicloudchoosefileitem-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string | 是 | - | - |
\n
| path | string | 是 | - | - |
\n
| cloudPath | string | 是 | - | - |
\n
| cloudPathAsRealPath | boolean | 否 | - | - |
\n
| url | string | 否 | - | - |
\n
| errMsg | string | 否 | - | - |
\n
"
,
"compatibility"
:
"### chooseAndUploadFile 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"unicloud-file-api"
:{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-file-api/unicloud-file-api.uvue)
\n
```html
\n
<template>
\n
<!-- #ifdef APP -->
\n
<scroll-view style=
\"
flex: 1
\"
>
\n
<!-- #endif -->
\n
<view>
\n
<page-head :title=
\"
title
\"
></page-head>
\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@click=
\"
uploadFile
\"
>选择文件上传</button>
\n
</view>
\n
</view>
\n
</view>
\n
<!-- #ifdef APP -->
\n
</scroll-view>
\n
<!-- #endif -->
\n
</template>
\n
<script>
\n
export default {
\n
data() {
\n
return {
\n
title: '云存储'
\n
}
\n
},
\n
onLoad() {
\n
},
\n
onUnload() {
\n
},
\n
methods: {
\n
uploadFile: function () {
\n
uni.chooseImage({
\n
count: 1,
\n
success(res) : void {
\n
uni.showLoading({
\n
title: '上传中...'
\n
})
\n
const tempFilePath = res.tempFilePaths[0]
\n
uniCloud.uploadFile({
\n
filePath: tempFilePath,
\n
cloudPath: 'test.jpg'
\n
})
\n
.then<void>(function (res) {
\n
uni.hideLoading()
\n
console.log(res)
\n
uni.showModal({
\n
content: '上传成功',
\n
showCancel: false
\n
});
\n
})
\n
.catch<void>(function (err : any | null) {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
uni.showModal({
\n
content: '上传失败,' + error.errMsg,
\n
showCancel: false
\n
});
\n
})
\n
// .finally((_: number) : void => {
\n
// uni.hideLoading()
\n
// })
\n
},
\n
fail(err) : void {
\n
console.error('chooseImage fail: ', err)
\n
}
\n
})
\n
}
\n
}
\n
}
\n
</script>
\n\n
<style>
\n
</style>
\n
```"
},
"databaseForJQL"
:{
"name"
:
"## databaseForJQL() @databaseforjql"
,
"description"
:
"获取数据库操作实例"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| [Database](#database-values) |
\n\n
#### Database 属性值 @database-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| collection | (args?: Array
\\
<any
\\
>) => [Collection](#collection-values) | 是 | - | - |
\n
| command | any | 是 | - | - |
\n
| Geo | any | 是 | - | - |
\n\n
##### Collection 属性值 @collection-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| where | (condition: any) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| doc | (docId: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| aggregate | () => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| foreignKey | (foreignKey: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| add | (data: any) => Promise<[UniCloudDBAddResult](#uniclouddbaddresult-values)> | 是 | - | - |
\n
| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |
\n
| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |
\n
| getTemp | () => any | 是 | - | - |
\n
| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n\n
###### UniCloudDBFilter 属性值 @uniclouddbfilter-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |
\n
| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |
\n
| update | (data: any) => Promise<[UniCloudDBUpdateResult](#uniclouddbupdateresult-values)> | 是 | - | - |
\n
| remove | () => Promise<[UniCloudDBRemoveResult](#uniclouddbremoveresult-values)> | 是 | - | - |
\n
| getTemp | () => any | 是 | - | - |
\n
| where | (condition: any) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| doc | (docId: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupBy | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupField | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| distinct | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| geoNear | (options: any) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n\n
###### UniCloudDBGetResult 属性值 @uniclouddbgetresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| data | Array
\\
<any
\\
> | 是 | - | etResult = { /** |
\n
| count | number | 否 | - | JSONObject>; /** |
\n
| requestId | string | 否 | - | ber
\\
| null; / |
\n\n
###### UniCloudDBCountResult 属性值 @uniclouddbcountresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| total | number | 是 | - | ntResult = { /** |
\n
| requestId | string | 否 | - | al: number; / |
\n\n
###### UniCloudDBUpdateResult 属性值 @uniclouddbupdateresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| updated | number | 是 | - | teResult = { /** |
\n
| requestId | string | 否 | - | ted: number; / |
\n\n
###### UniCloudDBRemoveResult 属性值 @uniclouddbremoveresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| deleted | number | 是 | - | veResult = { /** |
\n
| requestId | string | 否 | - | ted: number; / |
\n\n
###### UniCloudDBQuery 属性值 @uniclouddbquery-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |
\n
| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |
\n
| getTemp | () => any | 是 | - | - |
\n
| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupBy | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupField | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| distinct | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| geoNear | (options: any) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n\n
###### UniCloudDBAddResult 属性值 @uniclouddbaddresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| id | string | 是 | - | ddResult = { /** |
\n
| requestId | string | 否 | - | string; / |
\n
"
,
"compatibility"
:
"### databaseForJQL 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.91,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"unicloud-database"
:{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-database/unicloud-database.uvue)
\n
```html
\n
<template>
\n
<!-- #ifdef APP -->
\n
<scroll-view style=
\"
flex: 1
\"
>
\n
<!-- #endif -->
\n
<view>
\n
<page-head :title=
\"
title
\"
></page-head>
\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\n
<button type=
\"
primary
\"
@click=
\"
dbAdd
\"
>新增单条数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbBatchAdd
\"
>新增多条数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbUpdate
\"
>更新数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbGet
\"
>where传字符串获取数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbGetWithCommand
\"
>where传对象获取数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbRemove
\"
>删除数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbLookupInit
\"
>初始化联表查询数据</button>
\n
<button type=
\"
primary
\"
@click=
\"
dbLookup
\"
>联表查询</button>
\n
</view>
\n
</view>
\n
</view>
\n
<!-- #ifdef APP -->
\n
</scroll-view>
\n
<!-- #endif -->
\n
</template>
\n
<script>
\n
export default {
\n
data() {
\n
return {
\n
title: 'ClientDB',
\n
addId: '',
\n
batchAddIds: [] as Array<string>,
\n
batchAddinserted: 0,
\n
updateUpdated: 0,
\n
getData: [] as Array<UTSJSONObject>,
\n
getWithCommandData: [] as Array<UTSJSONObject>,
\n
removeDeleted: 0,
\n
lookupData: [] as Array<UTSJSONObject>,
\n
isUniTest: false
\n
}
\n
},
\n
onLoad() {
\n
},
\n
onUnload() {
\n
if(this.isUniTest){
\n
uni.hideToast()
\n
}
\n
},
\n
methods: {
\n
notify(content : string, title : string) {
\n
if (!this.isUniTest) {
\n
uni.showModal({
\n
title,
\n
content,
\n
showCancel: false
\n
})
\n
} else {
\n
uni.showToast({
\n
title: content
\n
})
\n
}
\n
},
\n
dbAdd: function () {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('type')
\n
.add({
\n
num: 1,
\n
tag: 'default-tag',
\n
date: new Date(),
\n
point: new db.Geo.Point(116, 38)
\n
})
\n
.then<void>(res => {
\n
uni.hideLoading()
\n
console.log(res)
\n
this.addId = res.id
\n
this.notify(`新增成功,id: ${res.id}`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbBatchAdd() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('type')
\n
.add([{
\n
num: 2,
\n
tag: 'default-tag',
\n
}, {
\n
num: 3,
\n
tag: 'default-tag',
\n
}])
\n
.then<void>((res) => {
\n
uni.hideLoading()
\n
console.log(res)
\n
console.log('JSON.stringify(res.inserted)', JSON.stringify(res.inserted))
\n
this.batchAddIds = res.ids
\n
this.batchAddinserted = res.inserted
\n
this.notify(`新增成功条数${res.inserted}, id列表: ${res.ids.join(',')}`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbGet() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('type')
\n
.where(
\n
'tag ==
\"
default-tag
\"
'
\n
)
\n
.field('num, tag')
\n
.orderBy('num desc')
\n
.skip(1)
\n
.limit(2)
\n
.get()
\n
.then<void>(res => {
\n
uni.hideLoading()
\n
console.log(res)
\n
this.getData = res.data
\n
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbGetWithCommand() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('type')
\n
.where({
\n
num: db.command.gt(1)
\n
})
\n
.field('num, tag')
\n
.orderBy('num desc')
\n
.skip(1)
\n
.limit(2)
\n
.get()
\n
.then<void>(res => {
\n
uni.hideLoading()
\n
console.log(res)
\n
this.getWithCommandData = res.data
\n
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbUpdate() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('type')
\n
.where(
\n
'tag ==
\"
default-tag
\"
'
\n
)
\n
.update({
\n
num: 4
\n
})
\n
.then<void>(res => {
\n
uni.hideLoading()
\n
console.log(res)
\n
this.updateUpdated = res.updated
\n
this.notify(`更新成功,更新了${res.updated}条数据`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbRemove() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('type')
\n
.where(
\n
'tag ==
\"
default-tag
\"
'
\n
)
\n
.remove()
\n
.then<void>(res => {
\n
uni.hideLoading()
\n
console.log(res)
\n
this.removeDeleted = res.deleted
\n
this.notify(`删除成功,删掉了${res.deleted}条数据`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbLookupInit() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
db.collection('local')
\n
.where('tag ==
\"
default-tag
\"
')
\n
.remove()
\n
.then(() : Promise<UniCloudDBRemoveResult> => {
\n
return db.collection('foreign')
\n
.where('tag ==
\"
default-tag
\"
')
\n
.remove()
\n
})
\n
.then(() : Promise<UniCloudDBBatchAddResult> => {
\n
return db.collection('local')
\n
.add([{
\n
id:
\"
local_1
\"
,
\n
name:
\"
local_1_name
\"
,
\n
tag:
\"
default-tag
\"
,
\n
foreign_id:
\"
foreign_1
\"\n
}, {
\n
id:
\"
local_2
\"
,
\n
name:
\"
local_2_name
\"
,
\n
tag:
\"
default-tag
\"
,
\n
foreign_id:
\"
foreign_2
\"\n
}])
\n
})
\n
.then(() : Promise<UniCloudDBBatchAddResult> => {
\n
return db.collection('foreign')
\n
.add([{
\n
id:
\"
foreign_1
\"
,
\n
name:
\"
foreign_1_name
\"
,
\n
tag:
\"
default-tag
\"\n
}, {
\n
id:
\"
foreign_2
\"
,
\n
name:
\"
foreign_2_name
\"
,
\n
tag:
\"
default-tag
\"\n
}])
\n
})
\n
.then<void>((_) : void => {
\n
uni.hideLoading()
\n
this.notify('数据初始化成功', '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
console.error(err)
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
},
\n
dbLookup() {
\n
uni.showLoading({
\n
title: '加载中...'
\n
})
\n
const db = uniCloud.databaseForJQL()
\n
const local = db.collection('local')
\n
.where('tag ==
\"
default-tag
\"
')
\n
.getTemp()
\n
const foreign = db.collection('foreign')
\n
.where('tag ==
\"
default-tag
\"
')
\n
.getTemp()
\n
db.collection(local, foreign)
\n
.get()
\n
.then<void>(res => {
\n
uni.hideLoading()
\n
console.log(res)
\n
this.lookupData = res.data
\n
this.notify(`联表查询成功,取到了${res.data.length}条数据`, '提示')
\n
})
\n
.catch<void>((err : any | null) => {
\n
uni.hideLoading()
\n
const error = err as UniCloudError
\n
this.notify(error.errMsg, '错误')
\n
})
\n
}
\n
}
\n
}
\n
</script>
\n\n
<style>
\n
</style>
\n
```"
},
"onResponse"
:{
"name"
:
"## onResponse(callback) @onresponse"
,
"description"
:
"监听响应事件"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### onResponse 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"offResponse"
:{
"name"
:
"## offResponse(callback) @offresponse"
,
"description"
:
"移除响应事件监听"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### offResponse 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"onRefreshToken"
:{
"name"
:
"## onRefreshToken(callback) @onrefreshtoken"
,
"description"
:
"监听token刷新事件"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### onRefreshToken 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"offRefreshToken"
:{
"name"
:
"## offRefreshToken(callback) @offrefreshtoken"
,
"description"
:
"移除token刷新事件监听"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### offRefreshToken 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
},
"getCurrentUserInfo"
:{
"name"
:
"## getCurrentUserInfo() @getcurrentuserinfo"
,
"description"
:
"获取token内缓存的用户信息"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| [UniCloudUserInfo](#uniclouduserinfo-values) |
\n\n
#### UniCloudUserInfo 属性值 @uniclouduserinfo-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| uid | string | 否 | - | UserInfo = { / |
\n
| role | Array
\\
<string
\\
> | 是 | - | ing
\\
| null; / |
\n
| permission | Array
\\
<string
\\
> | 是 | - | ay
\\
<string>; / |
\n
| tokenExpired | number | 是 | - | ay
\\
<string>; /** |
\n
"
,
"compatibility"
:
"### getCurrentUserInfo 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
""
}}
\ No newline at end of file
{
"uniCloud_props"
:
{
"name"
:
"# uniCloud"
,
"description"
:
""
,
"param"
:
"## 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| config | [UniCloudInitOptions](#unicloudinitoptions-values) | 是 | - | - |
\n
### UniCloudInitOptions 属性值 @unicloudinitoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| provider | string | 是 | - | 服务商,目前支持 aliyun、tencent |
\n
| spaceName | string | 否 | - | 服务空间名 |
\n
| spaceId | string | 是 | - | 服务空间id |
\n
| clientSecret | string | 否 | - | 阿里云clientSecret |
\n
| endpoint | string | 否 | - | 阿里云endpoint |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
""
,
"tutorial"
:
""
},
"callFunction"
:
{
"name"
:
"## callFunction(options) @callfunction"
,
"description"
:
"请求云函数"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudCallFunctionOptions](#unicloudcallfunctionoptions-values) | 是 | - | - |
\n
#### UniCloudCallFunctionOptions 属性值 @unicloudcallfunctionoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string (string.CloudFunctionString) | 是 | - | 云函数名 |
\n
| data | any | 否 | - | 云函数参数 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudCallFunctionResult](#unicloudcallfunctionresult-values)> |
\n\n
#### UniCloudCallFunctionResult 属性值 @unicloudcallfunctionresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| result | any | 是 | - | 云函数参数 |
\n
| requestId | string | 否 | - | 云函数请求id |
\n
"
,
"compatibility"
:
"### callFunction 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-call-function.callFunction)
\n
"
},
"unicloud-call-function"
:
{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-call-function/unicloud-call-function.uvue)
\n
```html
\n
<template>
\r\n
<!-- #ifdef APP -->
\r\n
<scroll-view style=
\"
flex: 1
\"
>
\r\n
<!-- #endif -->
\r\n
<view>
\r\n
<page-head :title=
\"
title
\"
></page-head>
\r\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@click=
\"
callFunction
\"
>请求云函数</button>
\r\n
</view>
\r\n
</view>
\r\n
</view>
\r\n
<!-- #ifdef APP -->
\r\n
</scroll-view>
\r\n
<!-- #endif -->
\r\n
</template>
\r\n
<script>
\r\n
export default {
\r\n
data() {
\r\n
return {
\r\n
title: '请求云函数',
\r\n
callFunctionResult: {},
\r\n
callFunctionError: {},
\r\n
isUniTest: false
\r\n
}
\r\n
},
\r\n
onLoad() {
\r\n
},
\r\n
onUnload() {
\r\n
if(this.isUniTest){
\r\n
uni.hideToast()
\r\n
}
\r\n
},
\r\n
methods: {
\r\n
notify(content : string, title : string) {
\r\n
if (!this.isUniTest) {
\r\n
uni.showModal({
\r\n
title,
\r\n
content,
\r\n
showCancel: false
\r\n
})
\r\n
} else {
\r\n
uni.showToast({
\r\n
title: content
\r\n
})
\r\n
}
\r\n
},
\r\n
callFunction: function () {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
uniCloud.callFunction({
\r\n
name: 'echo-cf',
\r\n
data: {
\r\n
num: 1,
\r\n
str: 'ABC'
\r\n
}
\r\n
}).then<void>(res => {
\r\n
const result = res.result
\r\n
this.callFunctionResult = result
\r\n
console.log(JSON.stringify(result))
\r\n
uni.hideLoading()
\r\n
this.notify(result['showMessage'] as string, '提示')
\r\n
}).catch<void>((err : any | null) => {
\r\n
const error = err as UniCloudError
\r\n
this.callFunctionError = {
\r\n
errCode: error.errCode,
\r\n
errMsg: error.errMsg
\r\n
}
\r\n
uni.hideLoading()
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
}
\r\n
}
\r\n
}
\r\n
</script>
\r\n\r\n
<style>
\r\n
</style>
\n
```"
},
"importObject"
:
{
"name"
:
"## importObject(objectName, options?) @importobject"
,
"description"
:
"引用云对象"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| objectName | string (string.CloudObjectString) | 是 | - | - |
\n
| options | [UniCloudImportObjectOptions](#unicloudimportobjectoptions-values) | 否 | - | - |
\n
#### UniCloudImportObjectOptions 属性值 @unicloudimportobjectoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| customUI | boolean | 否 | - | 是否移除自动展示的ui |
\n
| loadingOptions | [UniCloudImportObjectLoadingOptions](#unicloudimportobjectloadingoptions-values) | 否 | - | loading界面配置 |
\n
| errorOptions | [UniCloudImportObjectErrorOptions](#unicloudimportobjecterroroptions-values) | 否 | - | 错误提示配置 |
\n\n
##### UniCloudImportObjectLoadingOptions 属性值 @unicloudimportobjectloadingoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| title | string | 否 | - | 加载框标题 |
\n
| mask | boolean | 否 | - | 加载框是否显示mask |
\n\n
##### UniCloudImportObjectErrorOptions 属性值 @unicloudimportobjecterroroptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 否 | - | 错误提示类型,可以是modal或者toast |
\n
| retry | boolean | 否 | - | 是否显示重试按钮 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| any |
\n
"
,
"compatibility"
:
"### importObject 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-import-object.importObject)
\n
"
},
"unicloud-import-object"
:
{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-import-object/unicloud-import-object.uvue)
\n
```html
\n
<template>
\r\n
<!-- #ifdef APP -->
\r\n
<scroll-view style=
\"
flex:1
\"
>
\r\n
<!-- #endif -->
\r\n
<view>
\r\n
<page-head :title=
\"
title
\"
></page-head>
\r\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@tap=
\"
addTodo
\"
>添加Todo</button>
\r\n
</view>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@tap=
\"
randomFail
\"
>随机触发失败重试</button>
\r\n
</view>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@tap=
\"
fail
\"
>云对象失败调用</button>
\r\n
</view>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@tap=
\"
success
\"
>云对象成功调用</button>
\r\n
</view>
\r\n
</view>
\r\n
</view>
\r\n
<!-- #ifdef APP -->
\r\n
</scroll-view>
\r\n
<!-- #endif -->
\r\n
</template>
\r\n\r\n
<script>
\r\n
export default {
\r\n
data() {
\r\n
return {
\r\n
title: '请求云对象',
\r\n
todoTitle: '学习编程',
\r\n
todoContent: '熟悉uts语法',
\r\n
returnTodoTitle: '',
\r\n
returnTodoContent: '',
\r\n
failErrCode: '',
\r\n
successErrCode: -1,
\r\n
isUniTest: false
\r\n
}
\r\n
},
\r\n
onUnload() {
\r\n
if(this.isUniTest){
\r\n
uni.hideToast()
\r\n
}
\r\n
},
\r\n
methods: {
\r\n
notify(content : string, title : string) {
\r\n
if (!this.isUniTest) {
\r\n
uni.showModal({
\r\n
title,
\r\n
content,
\r\n
showCancel: false
\r\n
})
\r\n
} else {
\r\n
uni.showToast({
\r\n
title: content
\r\n
})
\r\n
}
\r\n
},
\r\n
addTodo() {
\r\n
const todo = uniCloud.importObject('todo', {
\r\n
customUI: this.isUniTest
\r\n
})
\r\n
const title = this.todoTitle
\r\n
const content = this.todoContent
\r\n
todo.add(title, content).then<void>((res : UTSJSONObject) : void => {
\r\n
this.returnTodoTitle = res['title'] as string
\r\n
this.returnTodoContent = res['content'] as string
\r\n
this.notify(res['showMessage'] as string, '提示')
\r\n
}).catch<void>((err : any | null) : void => {
\r\n
const error = err as UniCloudError
\r\n
console.error(error)
\r\n
})
\r\n
},
\r\n
randomFail() {
\r\n
const todoObj = uniCloud.importObject('todo', {
\r\n
errorOptions: {
\r\n
retry: true
\r\n
}
\r\n
})
\r\n
todoObj.randomFail().then<void>((res : UTSJSONObject) : void => {
\r\n
this.notify(res['showMessage'] as string, '提示')
\r\n
}).catch<void>((err : any | null) : void => {
\r\n
const error = err as UniCloudError
\r\n
console.error(error)
\r\n
})
\r\n
},
\r\n
fail() {
\r\n
const todo = uniCloud.importObject('todo', {
\r\n
customUI: this.isUniTest
\r\n
})
\r\n
todo.fail().then<void>((res : UTSJSONObject) : void => {
\r\n
this.notify('todo.fail应调用失败,此处错误的触发了成功回调', '错误')
\r\n
console.log('todo.fail: ', res);
\r\n
}).catch<void>((err : any | null) : void => {
\r\n
const error = err as UniCloudError
\r\n
this.failErrCode = error.errCode as string
\r\n
console.error(error)
\r\n
if (this.isUniTest) {
\r\n
uni.showToast({
\r\n
title: err.errMsg
\r\n
})
\r\n
}
\r\n
})
\r\n
},
\r\n
success() {
\r\n
const todo = uniCloud.importObject('todo', {
\r\n
customUI: this.isUniTest
\r\n
})
\r\n
todo.success().then<void>((res : UTSJSONObject) : void => {
\r\n
this.successErrCode = res['errCode'] as number
\r\n
this.notify(res['showMessage'] as string, '提示')
\r\n
}).catch<void>((err : any | null) : void => {
\r\n
const error = err as UniCloudError
\r\n
console.error(error)
\r\n
})
\r\n
}
\r\n
}
\r\n
}
\r\n
</script>
\r\n\r\n
<style>
\r\n\r\n
</style>
\n
```"
},
"uploadFile"
:
{
"name"
:
"## uploadFile(options) @uploadfile"
,
"description"
:
"上传文件到云存储"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudUploadFileOptions](#uniclouduploadfileoptions-values) | 是 | - | - |
\n
#### UniCloudUploadFileOptions 属性值 @uniclouduploadfileoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| filePath | string | 是 | - | 文件路径 |
\n
| cloudPath | string | 是 | - | 云端路径 |
\n
| cloudPathAsRealPath | boolean | 否 | - | 是否以云端路径是否为真实路径保存上传的文件 |
\n
| onUploadProgress | (options: [UniCloudUploadProgress](#uniclouduploadprogress-values)) => any | 否 | - | 上传进度回调 |
\n\n
##### UniCloudUploadProgress 属性值 @uniclouduploadprogress-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| loaded | number | 是 | - | 已上传大小 |
\n
| total | number | 是 | - | 总大小 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudUploadFileResult](#uniclouduploadfileresult-values)> |
\n\n
#### UniCloudUploadFileResult 属性值 @uniclouduploadfileresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| filePath | string | 是 | - | 文件路径 |
\n
| fileID | string | 是 | - | 文件id |
\n
"
,
"compatibility"
:
"### uploadFile 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-file-api.upload-file)
\n
"
},
"getTempFileURL"
:
{
"name"
:
"## getTempFileURL(options) @gettempfileurl"
,
"description"
:
"获取文件临时URL"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudGetTempFileURLOptions](#unicloudgettempfileurloptions-values) | 是 | - | - |
\n
#### UniCloudGetTempFileURLOptions 属性值 @unicloudgettempfileurloptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| fileList | Array
\\
<string
\\
> | 是 | - | 文件列表 |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudGetTempFileURLResult](#unicloudgettempfileurlresult-values)> |
\n\n
#### UniCloudGetTempFileURLResult 属性值 @unicloudgettempfileurlresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| fileList | Array
\\
<[UniCloudGetTempFileURLResultItem](#unicloudgettempfileurlresultitem-values)
\\
> | 是 | - | 文件列表 |
\n\n
##### UniCloudGetTempFileURLResultItem 属性值 @unicloudgettempfileurlresultitem-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| fileID | string | 是 | - | 文件id |
\n
| tempFileURL | string | 是 | - | 文件临时url |
\n
"
,
"compatibility"
:
"### getTempFileURL 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-file-api.choose-and-upload-file)
\n
"
},
"chooseAndUploadFile"
:
{
"name"
:
"## chooseAndUploadFile(options) @chooseanduploadfile"
,
"description"
:
"选择并上传文件"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| options | [UniCloudChooseAndUploadFileOptions](#unicloudchooseanduploadfileoptions-values) | 是 | - | - |
\n
#### UniCloudChooseAndUploadFileOptions 属性值 @unicloudchooseanduploadfileoptions-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| sourceType | Array
\\
<string
\\
> | 否 | - | - |
\n
| count | number | 否 | - | - |
\n
| sizeType | Array
\\
<string
\\
> | 否 | - | - |
\n
| extension | Array
\\
<string
\\
> | 否 | - | - |
\n
| compressed | boolean | 否 | - | - |
\n
| maxDuration | number | 否 | - | - |
\n
| camera | string | 否 | - | - |
\n
| crop | ChooseImageCropOptions | 否 | - | - |
\n
| type | string | 是 | - | - |
\n
| onChooseFile | (arg: [UniCloudChooseFileResult](#unicloudchoosefileresult-values)) => void | 否 | - | - |
\n
| onUploadProgress | (arg: [UniCloudChooseAndUploadFileProgressEvent](#unicloudchooseanduploadfileprogressevent-values)) => void | 否 | - | - |
\n\n
##### UniCloudChooseFileResult 属性值 @unicloudchoosefileresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| tempFiles | Array
\\
<[UniCloudChooseFileItem](#unicloudchoosefileitem-values)
\\
> | 是 | - | - |
\n
| tempFilePaths | Array
\\
<string
\\
> | 是 | - | - |
\n\n
###### UniCloudChooseFileItem 属性值 @unicloudchoosefileitem-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string | 是 | - | - |
\n
| path | string | 是 | - | - |
\n
| cloudPath | string | 是 | - | - |
\n
| cloudPathAsRealPath | boolean | 否 | - | - |
\n
| url | string | 否 | - | - |
\n
| errMsg | string | 否 | - | - |
\n\n
##### UniCloudChooseAndUploadFileProgressEvent 属性值 @unicloudchooseanduploadfileprogressevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| index | number | 是 | - | - |
\n
| loaded | number | 是 | - | - |
\n
| total | number | 是 | - | - |
\n
| tempFilePath | string | 是 | - | - |
\n
| tempFile | [UniCloudChooseFileItem](#unicloudchoosefileitem-values) | 是 | - | - |
\n
"
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| Promise<[UniCloudChooseAndUploadFileResult](#unicloudchooseanduploadfileresult-values)> |
\n\n
#### UniCloudChooseAndUploadFileResult 属性值 @unicloudchooseanduploadfileresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| tempFiles | Array
\\
<[UniCloudChooseFileItem](#unicloudchoosefileitem-values)
\\
> | 是 | - | - |
\n
| tempFilePaths | Array
\\
<string
\\
> | 是 | - | - |
\n\n
##### UniCloudChooseFileItem 属性值 @unicloudchoosefileitem-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| name | string | 是 | - | - |
\n
| path | string | 是 | - | - |
\n
| cloudPath | string | 是 | - | - |
\n
| cloudPathAsRealPath | boolean | 否 | - | - |
\n
| url | string | 否 | - | - |
\n
| errMsg | string | 否 | - | - |
\n
"
,
"compatibility"
:
"### chooseAndUploadFile 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-file-api.getTempFileURL)
\n
"
},
"unicloud-file-api"
:
{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-file-api/unicloud-file-api.uvue)
\n
```html
\n
<template>
\r\n
<!-- #ifdef APP -->
\r\n
<scroll-view style=
\"
flex: 1
\"
>
\r\n
<!-- #endif -->
\r\n
<view>
\r\n
<page-head :title=
\"
title
\"
></page-head>
\r\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@click=
\"
uploadFile
\"
>选择文件上传</button>
\r\n
</view>
\r\n
</view>
\r\n
</view>
\r\n
<!-- #ifdef APP -->
\r\n
</scroll-view>
\r\n
<!-- #endif -->
\r\n
</template>
\r\n
<script>
\r\n
export default {
\r\n
data() {
\r\n
return {
\r\n
title: '云存储'
\r\n
}
\r\n
},
\r\n
onLoad() {
\r\n
},
\r\n
onUnload() {
\r\n
},
\r\n
methods: {
\r\n
uploadFile: function () {
\r\n
uni.chooseImage({
\r\n
count: 1,
\r\n
success(res) : void {
\r\n
uni.showLoading({
\r\n
title: '上传中...'
\r\n
})
\r\n
const tempFilePath = res.tempFilePaths[0]
\r\n
uniCloud.uploadFile({
\r\n
filePath: tempFilePath,
\r\n
cloudPath: 'test.jpg'
\r\n
})
\r\n
.then<void>(function (res) {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
uni.showModal({
\r\n
content: '上传成功',
\r\n
showCancel: false
\r\n
});
\r\n
})
\r\n
.catch<void>(function (err : any | null) {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
uni.showModal({
\r\n
content: '上传失败,' + error.errMsg,
\r\n
showCancel: false
\r\n
});
\r\n
})
\r\n
// .finally((_: number) : void => {
\r\n
// uni.hideLoading()
\r\n
// })
\r\n
},
\r\n
fail(err) : void {
\r\n
console.error('chooseImage fail: ', err)
\r\n
}
\r\n
})
\r\n
}
\r\n
}
\r\n
}
\r\n
</script>
\r\n\r\n
<style>
\r\n
</style>
\n
```"
},
"databaseForJQL"
:
{
"name"
:
"## databaseForJQL() @databaseforjql"
,
"description"
:
"获取数据库操作实例"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| [Database](#database-values) |
\n\n
#### Database 属性值 @database-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| collection | (args?: Array
\\
<any
\\
>) => [Collection](#collection-values) | 是 | - | - |
\n
| command | any | 是 | - | - |
\n
| Geo | any | 是 | - | - |
\n\n
##### Collection 属性值 @collection-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| where | (condition: any) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| doc | (docId: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| aggregate | () => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| foreignKey | (foreignKey: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| add | (data: any) => Promise<[UniCloudDBAddResult](#uniclouddbaddresult-values)> | 是 | - | - |
\n
| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |
\n
| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |
\n
| getTemp | () => any | 是 | - | - |
\n
| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n\n
###### UniCloudDBFilter 属性值 @uniclouddbfilter-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |
\n
| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |
\n
| update | (data: any) => Promise<[UniCloudDBUpdateResult](#uniclouddbupdateresult-values)> | 是 | - | - |
\n
| remove | () => Promise<[UniCloudDBRemoveResult](#uniclouddbremoveresult-values)> | 是 | - | - |
\n
| getTemp | () => any | 是 | - | - |
\n
| where | (condition: any) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| doc | (docId: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |
\n
| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupBy | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupField | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| distinct | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| geoNear | (options: any) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n\n
###### UniCloudDBGetResult 属性值 @uniclouddbgetresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| data | Array
\\
<any
\\
> | 是 | - | tResult = { /** |
\n
| count | number | 否 | - | SONObject>; /** |
\n
| requestId | string | 否 | - | ber
\\
| null; / |
\n\n
###### UniCloudDBCountResult 属性值 @uniclouddbcountresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| total | number | 是 | - | tResult = { /** |
\n
| requestId | string | 否 | - | al: number; / |
\n\n
###### UniCloudDBUpdateResult 属性值 @uniclouddbupdateresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| updated | number | 是 | - | eResult = { /** |
\n
| requestId | string | 否 | - | ed: number; / |
\n\n
###### UniCloudDBRemoveResult 属性值 @uniclouddbremoveresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| deleted | number | 是 | - | eResult = { /** |
\n
| requestId | string | 否 | - | ed: number; / |
\n\n
###### UniCloudDBQuery 属性值 @uniclouddbquery-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |
\n
| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |
\n
| getTemp | () => any | 是 | - | - |
\n
| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupBy | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| groupField | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| distinct | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n
| geoNear | (options: any) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |
\n\n
###### UniCloudDBAddResult 属性值 @uniclouddbaddresult-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| id | string | 是 | - | dResult = { /** |
\n
| requestId | string | 否 | - | string; / |
\n
"
,
"compatibility"
:
"### databaseForJQL 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.91,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-database.databaseForJQL)
\n
"
},
"unicloud-database"
:
{
"example"
:
"## 示例
\n
> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-database/unicloud-database.uvue)
\n
```html
\n
<template>
\r\n
<!-- #ifdef APP -->
\r\n
<scroll-view style=
\"
flex: 1
\"
>
\r\n
<!-- #endif -->
\r\n
<view>
\r\n
<page-head :title=
\"
title
\"
></page-head>
\r\n
<view class=
\"
uni-padding-wrap uni-common-mt
\"
>
\r\n
<view class=
\"
uni-btn-v uni-common-mt
\"
>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbAdd
\"
>新增单条数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbBatchAdd
\"
>新增多条数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbUpdate
\"
>更新数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbGet
\"
>where传字符串获取数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbGetWithCommand
\"
>where传对象获取数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbRemove
\"
>删除数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbLookupInit
\"
>初始化联表查询数据</button>
\r\n
<button type=
\"
primary
\"
@click=
\"
dbLookup
\"
>联表查询</button>
\r\n
</view>
\r\n
</view>
\r\n
</view>
\r\n
<!-- #ifdef APP -->
\r\n
</scroll-view>
\r\n
<!-- #endif -->
\r\n
</template>
\r\n
<script>
\r\n
export default {
\r\n
data() {
\r\n
return {
\r\n
title: 'ClientDB',
\r\n
addId: '',
\r\n
batchAddIds: [] as Array<string>,
\r\n
batchAddinserted: 0,
\r\n
updateUpdated: 0,
\r\n
getData: [] as Array<UTSJSONObject>,
\r\n
getWithCommandData: [] as Array<UTSJSONObject>,
\r\n
removeDeleted: 0,
\r\n
lookupData: [] as Array<UTSJSONObject>,
\r\n
isUniTest: false
\r\n
}
\r\n
},
\r\n
onLoad() {
\r\n
},
\r\n
onUnload() {
\r\n
if(this.isUniTest){
\r\n
uni.hideToast()
\r\n
}
\r\n
},
\r\n
methods: {
\r\n
notify(content : string, title : string) {
\r\n
if (!this.isUniTest) {
\r\n
uni.showModal({
\r\n
title,
\r\n
content,
\r\n
showCancel: false
\r\n
})
\r\n
} else {
\r\n
uni.showToast({
\r\n
title: content
\r\n
})
\r\n
}
\r\n
},
\r\n
dbAdd: function () {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('type')
\r\n
.add({
\r\n
num: 1,
\r\n
tag: 'default-tag',
\r\n
date: new Date(),
\r\n
point: new db.Geo.Point(116, 38)
\r\n
})
\r\n
.then<void>(res => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
this.addId = res.id
\r\n
this.notify(`新增成功,id: ${res.id}`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbBatchAdd() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('type')
\r\n
.add([{
\r\n
num: 2,
\r\n
tag: 'default-tag',
\r\n
}, {
\r\n
num: 3,
\r\n
tag: 'default-tag',
\r\n
}])
\r\n
.then<void>((res) => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
console.log('JSON.stringify(res.inserted)', JSON.stringify(res.inserted))
\r\n
this.batchAddIds = res.ids
\r\n
this.batchAddinserted = res.inserted
\r\n
this.notify(`新增成功条数${res.inserted}, id列表: ${res.ids.join(',')}`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbGet() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('type')
\r\n
.where(
\r\n
'tag ==
\"
default-tag
\"
'
\r\n
)
\r\n
.field('num, tag')
\r\n
.orderBy('num desc')
\r\n
.skip(1)
\r\n
.limit(2)
\r\n
.get()
\r\n
.then<void>(res => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
this.getData = res.data
\r\n
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbGetWithCommand() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('type')
\r\n
.where({
\r\n
num: db.command.gt(1)
\r\n
})
\r\n
.field('num, tag')
\r\n
.orderBy('num desc')
\r\n
.skip(1)
\r\n
.limit(2)
\r\n
.get()
\r\n
.then<void>(res => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
this.getWithCommandData = res.data
\r\n
this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbUpdate() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('type')
\r\n
.where(
\r\n
'tag ==
\"
default-tag
\"
'
\r\n
)
\r\n
.update({
\r\n
num: 4
\r\n
})
\r\n
.then<void>(res => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
this.updateUpdated = res.updated
\r\n
this.notify(`更新成功,更新了${res.updated}条数据`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbRemove() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('type')
\r\n
.where(
\r\n
'tag ==
\"
default-tag
\"
'
\r\n
)
\r\n
.remove()
\r\n
.then<void>(res => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
this.removeDeleted = res.deleted
\r\n
this.notify(`删除成功,删掉了${res.deleted}条数据`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbLookupInit() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
db.collection('local')
\r\n
.where('tag ==
\"
default-tag
\"
')
\r\n
.remove()
\r\n
.then(() : Promise<UniCloudDBRemoveResult> => {
\r\n
return db.collection('foreign')
\r\n
.where('tag ==
\"
default-tag
\"
')
\r\n
.remove()
\r\n
})
\r\n
.then(() : Promise<UniCloudDBBatchAddResult> => {
\r\n
return db.collection('local')
\r\n
.add([{
\r\n
id:
\"
local_1
\"
,
\r\n
name:
\"
local_1_name
\"
,
\r\n
tag:
\"
default-tag
\"
,
\r\n
foreign_id:
\"
foreign_1
\"\r\n
}, {
\r\n
id:
\"
local_2
\"
,
\r\n
name:
\"
local_2_name
\"
,
\r\n
tag:
\"
default-tag
\"
,
\r\n
foreign_id:
\"
foreign_2
\"\r\n
}])
\r\n
})
\r\n
.then(() : Promise<UniCloudDBBatchAddResult> => {
\r\n
return db.collection('foreign')
\r\n
.add([{
\r\n
id:
\"
foreign_1
\"
,
\r\n
name:
\"
foreign_1_name
\"
,
\r\n
tag:
\"
default-tag
\"\r\n
}, {
\r\n
id:
\"
foreign_2
\"
,
\r\n
name:
\"
foreign_2_name
\"
,
\r\n
tag:
\"
default-tag
\"\r\n
}])
\r\n
})
\r\n
.then<void>((_) : void => {
\r\n
uni.hideLoading()
\r\n
this.notify('数据初始化成功', '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
console.error(err)
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
},
\r\n
dbLookup() {
\r\n
uni.showLoading({
\r\n
title: '加载中...'
\r\n
})
\r\n
const db = uniCloud.databaseForJQL()
\r\n
const local = db.collection('local')
\r\n
.where('tag ==
\"
default-tag
\"
')
\r\n
.getTemp()
\r\n
const foreign = db.collection('foreign')
\r\n
.where('tag ==
\"
default-tag
\"
')
\r\n
.getTemp()
\r\n
db.collection(local, foreign)
\r\n
.get()
\r\n
.then<void>(res => {
\r\n
uni.hideLoading()
\r\n
console.log(res)
\r\n
this.lookupData = res.data
\r\n
this.notify(`联表查询成功,取到了${res.data.length}条数据`, '提示')
\r\n
})
\r\n
.catch<void>((err : any | null) => {
\r\n
uni.hideLoading()
\r\n
const error = err as UniCloudError
\r\n
this.notify(error.errMsg, '错误')
\r\n
})
\r\n
}
\r\n
}
\r\n
}
\r\n
</script>
\r\n\r\n
<style>
\r\n
</style>
\n
```"
},
"onResponse"
:
{
"name"
:
"## onResponse(callback) @onresponse"
,
"description"
:
"监听响应事件"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### onResponse 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.get-current-user-info)
\n
"
},
"offResponse"
:
{
"name"
:
"## offResponse(callback) @offresponse"
,
"description"
:
"移除响应事件监听"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### offResponse 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.on-response)
\n
"
},
"onRefreshToken"
:
{
"name"
:
"## onRefreshToken(callback) @onrefreshtoken"
,
"description"
:
"监听token刷新事件"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### onRefreshToken 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.off-response)
\n
"
},
"offRefreshToken"
:
{
"name"
:
"## offRefreshToken(callback) @offrefreshtoken"
,
"description"
:
"移除token刷新事件监听"
,
"param"
:
"### 参数
\n\n
| 名称 | 类型 | 必填 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |
\n
#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| type | string | 是 | - | 响应事件类型 |
\n
| name | string | 是 | - | 响应事件由哪个云函数触发 |
\n
| content | any | 是 | - | 响应结果、错误内容 |
\n
"
,
"returnValue"
:
""
,
"compatibility"
:
"### offRefreshToken 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.on-refresh-token)
\n
"
},
"getCurrentUserInfo"
:
{
"name"
:
"## getCurrentUserInfo() @getcurrentuserinfo"
,
"description"
:
"获取token内缓存的用户信息"
,
"param"
:
""
,
"returnValue"
:
"### 返回值
\n\n
| 类型 |
\n
| :- |
\n
| [UniCloudUserInfo](#uniclouduserinfo-values) |
\n\n
#### UniCloudUserInfo 属性值 @uniclouduserinfo-values
\n\n
| 名称 | 类型 | 必备 | 默认值 | 描述 |
\n
| :- | :- | :- | :- | :- |
\n
| uid | string | 否 | - | serInfo = { / |
\n
| role | Array
\\
<string
\\
> | 是 | - | ing
\\
| null; /** |
\n
| permission | Array
\\
<string
\\
> | 是 | - | ay
\\
<string>; /** |
\n
| tokenExpired | number | 是 | - | ay
\\
<string>; /** |
\n
"
,
"compatibility"
:
"### getCurrentUserInfo 兼容性
\n
| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |
\n
| :- | :- | :- | :- | :- | :- |
\n
| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |
\n
"
,
"tutorial"
:
"
\n
### 参见
\n
[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.off-refresh-token)
\n
"
}
}
docs/uni-app-x/manifest.md
浏览文件 @
9bc3f37a
...
...
@@ -182,3 +182,5 @@ HBuilderX3.93版本起,编译器支持扫描代码,摇树treeShaking,自
依赖的模块:无
再次强调,以上模块不属于ext组件或api,是内置模块。但如果你的代码中没有使用这些组件和api,打正式包或自定义基座时会被摇掉。
<!-- MANIFESTJSON.tutorial -->
\ No newline at end of file
docs/uni-app-x/pagesjson.md
浏览文件 @
9bc3f37a
...
...
@@ -200,3 +200,5 @@ easycom是uni-app提供的一种简化组件使用的方式。一般情况下组
<!-- PAGESJSON.pages_easycom.table -->
<!-- PAGESJSON.pages_easycom.compatibility -->
<!-- PAGESJSON.tutorial -->
\ No newline at end of file
docs/uts/buildin-object-api/array.md
浏览文件 @
9bc3f37a
...
...
@@ -579,6 +579,20 @@ console.log(Array.isArray(new Int16Array([15, 33])));
<!-- UTSJSON.Array.includes.compatibility -->
### toKotlinList()
<!-- UTSJSON.Array.toKotlinList.description -->
<!-- UTSJSON.Array.toKotlinList.param -->
<!-- UTSJSON.Array.toKotlinList.returnValue -->
<!-- UTSJSON.Array.toKotlinList.compatibility -->
<!-- UTSJSON.Array.toKotlinList.tutorial -->
<!-- UTSJSON.Array.tutorial -->
## 常见操作
-
创建数组
...
...
docs/uts/buildin-object-api/console.md
浏览文件 @
9bc3f37a
...
...
@@ -53,3 +53,5 @@
<!-- UTSJSON.Console.warn.returnValue -->
<!-- UTSJSON.Console.warn.compatibility -->
<!-- UTSJSON.Console.tutorial -->
docs/uts/buildin-object-api/date.md
浏览文件 @
9bc3f37a
...
...
@@ -222,3 +222,4 @@ setTimeout(() => {
<!-- UTSJSON.Date.setFullYear.compatibility -->
<!-- UTSJSON.Date.tutorial -->
docs/uts/buildin-object-api/global.md
浏览文件 @
9bc3f37a
...
...
@@ -14,6 +14,8 @@
<!-- UTSJSON.Global.parseInt.compatibility -->
<!-- UTSJSON.Global.parseInt.tutorial -->
**注意**
-
该方法仅支持对 string 类型的解析,传入其他类型会编译报错。字符串开头的空白符将会被忽略。
...
...
@@ -47,6 +49,8 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.parseFloat.compatibility -->
<!-- UTSJSON.Global.parseFloat.tutorial -->
-
注意: 该方法仅支持对 string 类型的解析,传入其他类型会编译报错。
### isNaN(number)
...
...
@@ -59,6 +63,8 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.isNaN.compatibility -->
<!-- UTSJSON.Global.isNaN.tutorial -->
### isFinite(number)
<!-- UTSJSON.Global.isFinite.description -->
...
...
@@ -69,6 +75,8 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.isFinite.compatibility -->
<!-- UTSJSON.Global.isFinite.tutorial -->
### decodeURI(encodedURI)
<!-- UTSJSON.Global.decodeURI.description -->
...
...
@@ -79,6 +87,8 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.decodeURI.compatibility -->
<!-- UTSJSON.Global.decodeURI.tutorial -->
### decodeURIComponent(encodedURIComponent)
<!-- UTSJSON.Global.decodeURIComponent.description -->
...
...
@@ -89,6 +99,8 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.decodeURIComponent.compatibility -->
<!-- UTSJSON.Global.decodeURIComponent.tutorial -->
### encodeURI(uri)
<!-- UTSJSON.Global.encodeURI.description -->
...
...
@@ -99,6 +111,8 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.encodeURI.compatibility -->
<!-- UTSJSON.Global.encodeURI.tutorial -->
### encodeURIComponent(uriComponent)
<!-- UTSJSON.Global.encodeURIComponent.description -->
...
...
@@ -108,3 +122,5 @@ const c = parseInt("546", 2) // 结果为 NAN (原因:除了“0、1”外,
<!-- UTSJSON.Global.encodeURIComponent.returnValue -->
<!-- UTSJSON.Global.encodeURIComponent.compatibility -->
<!-- UTSJSON.Global.encodeURIComponent.tutorial -->
\ No newline at end of file
docs/uts/buildin-object-api/json.md
浏览文件 @
9bc3f37a
...
...
@@ -146,3 +146,5 @@ console.log(JSON.stringify(new Date(2006, 0, 2, 15, 4, 5)));
<!-- UTSJSON.JSON.parseArray_1.returnValue -->
<!-- UTSJSON.JSON.parseArray_1.compatibility -->
<!-- UTSJSON.JSON.tutorial -->
docs/uts/buildin-object-api/map.md
浏览文件 @
9bc3f37a
...
...
@@ -191,3 +191,5 @@ map.forEach(function(value:any | null,key:string,map: Map<string,any | null>){
})
```
<!-- UTSJSON.Map.tutorial -->
docs/uts/buildin-object-api/math.md
浏览文件 @
9bc3f37a
...
...
@@ -775,3 +775,5 @@ console.log(Math.tan(1));
// expected output: 1.5574077246549023
```
<!-- UTSJSON.Math.tan.compatibility -->
<!-- UTSJSON.Math.tutorial -->
docs/uts/buildin-object-api/number.md
浏览文件 @
9bc3f37a
...
...
@@ -239,3 +239,5 @@ console.log(b);
// expected output: 12
```
<!-- UTSJSON.Number.tutorial -->
\ No newline at end of file
docs/uts/buildin-object-api/promise.md
浏览文件 @
9bc3f37a
...
...
@@ -215,6 +215,8 @@ Promise 对象表示异步操作最终的完成(或失败)以及其结果值
<!-- UTSJSON.Promise.allSettled.compatibility -->
<!-- UTSJSON.Promise.tutorial -->
## Bug & Tips@tips
*
目前 Promise 类型编译到 kotlin 为 io.dcloud.uts.UTSPromise
docs/uts/buildin-object-api/regexp.md
浏览文件 @
9bc3f37a
...
...
@@ -157,6 +157,8 @@ console.log(globalRegex.test(str));
```
<!-- UTSJSON.RegExp.test.compatibility -->
<!-- UTSJSON.RegExp.tutorial -->
## Bug & Tips@tips
*
目前 RegExp 类型编译到 kotlin 为 io.dcloud.uts.UTSRegExp
\ No newline at end of file
docs/uts/buildin-object-api/set.md
浏览文件 @
9bc3f37a
...
...
@@ -123,7 +123,9 @@ console.log(set1.has(5));
console
.
log
(
set1
.
has
(
6
));
// expected output: false
```
<!-- UTSJSON.Set.has.compatibility -->
<!-- UTSJSON.Set.has.compatibility -->
.
<!-- UTSJSON.Set.tutorial -->
## Bug & Tips@tips
...
...
docs/uts/buildin-object-api/string.md
浏览文件 @
9bc3f37a
...
...
@@ -490,3 +490,5 @@ console.log(sentence.toUpperCase());
<!-- UTSJSON.String.at.returnValue -->
<!-- UTSJSON.String.at.compatibility -->
<!-- UTSJSON.String.tutorial -->
docs/uts/buildin-object-api/utsjsonobject.md
浏览文件 @
9bc3f37a
...
...
@@ -169,3 +169,6 @@ person.toMap().forEach((value, key) => {
```
<!-- UTSJSON.UTSJSONObject.toMap.compatibility -->
<!-- UTSJSON.UTSJSONObject.tutorial -->
docs/uts/utsandroid.md
浏览文件 @
9bc3f37a
...
...
@@ -382,4 +382,5 @@
<!-- UTSJSON.UTSAndroid.convert2AbsFullPath.compatibility -->
<!-- UTSJSON.UTSAndroid.tutorial -->
docs/uts/utsandroidhookproxy.md
浏览文件 @
9bc3f37a
...
...
@@ -13,3 +13,5 @@
<!-- UTSJSON.UTSAndroidHookProxy.onCreate.returnValue -->
<!-- UTSJSON.UTSAndroidHookProxy.onCreate.compatibility -->
<!-- UTSJSON.UTSAndroidHookProxy.tutorial -->
docs/uts/utsios.md
浏览文件 @
9bc3f37a
...
...
@@ -243,3 +243,5 @@
<!-- UTSJSON.UTSiOS.isBaseIpa.returnValue -->
<!-- UTSJSON.UTSiOS.isBaseIpa.compatibility -->
<!-- UTSJSON.UTSiOS.tutorial -->
docs/uts/utsioshookproxy.md
浏览文件 @
9bc3f37a
...
...
@@ -144,3 +144,5 @@
<!-- UTSJSON.UTSiOSHookProxy.applicationContinueUserActivityRestorationHandler.returnValue -->
<!-- UTSJSON.UTSiOSHookProxy.applicationContinueUserActivityRestorationHandler.compatibility -->
<!-- UTSJSON.UTSiOSHookProxy.tutorial -->
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录