diff --git a/docs/.vuepress/utils/utsApiJson.json b/docs/.vuepress/utils/utsApiJson.json index cd9fc5f5ec9148622b4d1818281270a7a9370c25..bbafb9c5cea5e6d9cc8aa6572f4e870307a6c2d6 100644 --- a/docs/.vuepress/utils/utsApiJson.json +++ b/docs/.vuepress/utils/utsApiJson.json @@ -1 +1 @@ -{"getApp":{"name":"## getApp() @getapp","description":"\n`getApp()` 函数用于获取当前应用实例,可通过应用实例调用 App.uvue methods 中定义的方法。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| any |\n \n","compatibility":"","tutorial":"\n### 参见\n[getApp](https://uniapp.dcloud.net.cn/tutorial/page.html#getapp)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.global.get-app)\n"},"get-app":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-app/get-app.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-app/get-app\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { state, setLifeCycleNum } from '@/store/index.uts'\r\n\r\n type MyGlobalData = {\r\n str : string,\r\n num : number,\r\n bool : boolean,\r\n obj : UTSJSONObject,\r\n null : string | null,\r\n arr : number[],\r\n mySet : string[],\r\n myMap : UTSJSONObject,\r\n func : () => string\r\n }\r\n\r\n export default {\r\n data() {\r\n return {\r\n originGlobalData: {\r\n str: '',\r\n num: 0,\r\n bool: false,\r\n obj: {\r\n str: '',\r\n num: 0,\r\n bool: false\r\n } as UTSJSONObject,\r\n null: null,\r\n arr: [] as number[],\r\n mySet: [] as string[],\r\n myMap: {},\r\n func: () : string => ''\r\n } as MyGlobalData,\r\n originGlobalDataFuncRes: '',\r\n newGlobalData: {\r\n str: '',\r\n num: 0,\r\n bool: false,\r\n obj: {\r\n str: '',\r\n num: 0,\r\n bool: false\r\n } as UTSJSONObject,\r\n null: null,\r\n arr: [] as number[],\r\n mySet: [] as string[],\r\n myMap: {},\r\n func: () : string => ''\r\n } as MyGlobalData,\r\n newGlobalDataFuncRes: '',\r\n lifeCycleNum: 0,\r\n }\r\n },\r\n onReady() {\r\n this.lifeCycleNum = state.lifeCycleNum\r\n },\r\n methods: {\r\n getGlobalData() {\r\n const app = getApp()\r\n\r\n this.originGlobalData.str = app.globalData.str\r\n this.originGlobalData.num = app.globalData.num\r\n this.originGlobalData.bool = app.globalData.bool\r\n this.originGlobalData.obj = app.globalData.obj\r\n this.originGlobalData.null = app.globalData.null\r\n this.originGlobalData.arr = app.globalData.arr\r\n app.globalData.mySet.forEach((value : string) => {\r\n this.originGlobalData.mySet.push(value)\r\n })\r\n app.globalData.myMap.forEach((value : any, key : string) => {\r\n this.originGlobalData.myMap[key] = value\r\n })\r\n this.originGlobalData.func = app.globalData.func\r\n this.originGlobalDataFuncRes = this.originGlobalData.func()\r\n },\r\n setGlobalData() {\r\n const app = getApp()\r\n\r\n app.globalData.str = 'new globalData str'\r\n app.globalData.num = 100\r\n app.globalData.bool = true\r\n app.globalData.obj = {\r\n str: 'new globalData obj str',\r\n num: 200,\r\n bool: true\r\n }\r\n app.globalData.null = 'not null'\r\n app.globalData.arr = [1, 2, 3]\r\n app.globalData.mySet = new Set(['a', 'b', 'c'])\r\n app.globalData.myMap = new Map([\r\n ['a', 1],\r\n ['b', 2],\r\n ['c', 3]\r\n ])\r\n app.globalData.func = () : string => {\r\n return 'new globalData func'\r\n }\r\n\r\n this.newGlobalData.str = app.globalData.str\r\n this.newGlobalData.num = app.globalData.num\r\n this.newGlobalData.bool = app.globalData.bool\r\n this.newGlobalData.obj = app.globalData.obj\r\n this.newGlobalData.null = app.globalData.null\r\n this.newGlobalData.arr = app.globalData.arr\r\n app.globalData.mySet.forEach((value : string) => {\r\n this.newGlobalData.mySet.push(value)\r\n })\r\n app.globalData.myMap.forEach((value : any, key : string) => {\r\n this.newGlobalData.myMap[key] = value\r\n })\r\n this.newGlobalData.func = app.globalData.func\r\n this.newGlobalDataFuncRes = this.newGlobalData.func()\r\n },\r\n _increasetLifeCycleNum: function () {\r\n const app = getApp()\r\n app.increasetLifeCycleNum()\r\n this.lifeCycleNum = state.lifeCycleNum\r\n },\r\n // 自动化测试\r\n setLifeCycleNum(num : number) {\r\n setLifeCycleNum(num)\r\n }\r\n },\r\n }\r\n\n```\n:::"},"getCurrentPages":{"name":"## getCurrentPages() @getcurrentpages","description":"\n`getCurrentPages()` 函数用于获取当前页面栈的实例,以数组形式按栈的顺序给出,数组中的元素为页面实例,第一个元素为首页,最后一个元素为当前页面。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| Array\\<[Page](#page-values)\\> |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| route | string | 是 | - | 页面的路由地址 |\n@| options | Map\\ | 是 | - | 页面的路由参数信息,目前web端options类型为Object,后续可能会调整 |\n#### Page 的方法 @page-values \n\n#### $getPageStyle() @$getpagestyle\n\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) |\n \n\n##### $getPageStyle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 参见\n[$getPageStyle](https://doc.dcloud.net.cn/uni-app-x/api/get-current-pages.html#getPageStyle)\n\n#### $setPageStyle(style) @$setpagestyle\n\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| style | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) | 是 | - | 如果属性名存在,且类型为UTSJSONObject返回对应的结果,不存在返回null | \n\n\n##### $setPageStyle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 参见\n[$setPageStyle](https://doc.dcloud.net.cn/uni-app-x/api/get-current-pages.html#setPageStyle)\n \n","compatibility":"","tutorial":"\n### 参见\n[getCurrentPages](https://uniapp.dcloud.net.cn/tutorial/page.html#getcurrentpages)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.global.get-current-pages)\n"},"get-current-pages":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-current-pages/get-current-pages.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-current-pages/get-current-pages\n>Template\n```vue\n\r\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n class Page {\r\n constructor(public route : string) {\r\n }\r\n }\r\n\r\n export default {\r\n data() {\r\n return {\r\n checked: false,\r\n pages: [] as Page[],\r\n currentPageStyle: {} as UTSJSONObject\r\n }\r\n },\r\n computed: {\r\n pageStyleText() : string {\r\n return JSON.stringify(this.currentPageStyle)\r\n }\r\n },\r\n onPullDownRefresh() {\r\n setTimeout(() => {\r\n uni.stopPullDownRefresh()\r\n }, 3000)\r\n },\r\n methods: {\r\n _getCurrentPages: function () {\r\n this.pages.length = 0\r\n const pages = getCurrentPages()\r\n this.pages.push(new Page(pages[0].route))\r\n if (this.pages[0].route.includes('/tabBar/')) {\r\n this.checked = true\r\n }\r\n for (let i = 1; i < pages.length; i++) {\r\n this.pages.push(new Page(pages[i].route))\r\n if (pages[i].route.includes('/tabBar/')) {\r\n this.checked = false\r\n }\r\n }\r\n },\r\n getPageStyle() {\r\n const pages = getCurrentPages();\r\n const currentPage = pages[pages.length - 1];\r\n this.currentPageStyle = currentPage.$getPageStyle();\r\n },\r\n setPageStyle(epr : boolean) {\r\n // 目前仅支持 enablePullDownRefresh\r\n const pages = getCurrentPages();\r\n const currentPage = pages[pages.length - 1];\r\n currentPage.$setPageStyle({\r\n enablePullDownRefresh: epr\r\n });\r\n },\r\n // getCurrentPage(): Page {\r\n // const pages = getCurrentPages();\r\n // const currentPage = pages[pages.length - 1];\r\n // return currentPage;\r\n // }\r\n },\r\n }\r\n\n```\n:::"},"$on":{"name":"## uni.$on(eventName, callback) @$on","description":"\n监听自定义事件。事件可以由 uni.$emit 触发。回调函数会接收 uni.$emit 传递的参数。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| callback | () => void | 是 | - | - | \n","returnValue":"","compatibility":"### $on 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$on](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#on)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$on)\n"},"$once":{"name":"## uni.$once(eventName, callback) @$once","description":"\n监听一个自定义事件。事件只触发一次,在第一次触发之后移除事件监听器。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| callback | () => void | 是 | - | - | \n","returnValue":"","compatibility":"### $once 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$once](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#once)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$once)\n"},"$off":{"name":"## uni.$off(eventName, callback?) @$off","description":"\n移除自定义事件监听器。如果提供了事件名和回调,则只移除这个回调的监听器。\n4.13+ 开始支持第二个参数为可选,如果仅提供事件名,则移除该事件的所有监听器。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| callback | () => void \\| null | 否 | - | | \n","returnValue":"","compatibility":"### $off 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$off](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#off)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$off)\n"},"$emit":{"name":"## uni.$emit(eventName, args?) @$emit","description":"\n触发自定义事件,附加的参数会传递给事件监听器。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| args | any \\| null | 否 | - | | \n","returnValue":"","compatibility":"### $emit 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$emit](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#emit)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$emit)\n"},"event-bus":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/event-bus/event-bus.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/event-bus/event-bus\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n log: [] as string[],\r\n }\r\n },\r\n methods: {\r\n fn(res : string) {\r\n this.log.push(res)\r\n },\n fn2(res : string) {\n this.log.push(res)\n },\r\n on() {\r\n uni.$on('test', this.fn)\r\n },\n on2() {\n uni.$on('test', this.fn2)\n },\r\n once() {\r\n uni.$once('test', this.fn)\r\n },\r\n off() {\r\n uni.$off('test', this.fn)\r\n },\n offAll() {\n // TODO 第二个参数为可选,后续优化后可不传递\n //uni.$off('test', null)\n },\r\n emit() {\r\n uni.$emit('test', 'msg:' + Date.now())\r\n },\r\n clear() {\r\n this.log.length = 0\r\n },\r\n },\r\n }\r\n\n```\n:::"},"addInterceptor":{"name":"## uni.addInterceptor(name, interceptor) @addinterceptor","description":"\n添加拦截器","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string | 是 | - | 需要拦截的 API 名称 |\n| interceptor | Interceptor | 是 | - | 拦截器 | \n","returnValue":"","compatibility":"### addInterceptor 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.97 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.interceptor.addInterceptor)\n"},"removeInterceptor":{"name":"## uni.removeInterceptor(name, interceptor?) @removeinterceptor","description":"\n删除拦截器","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string | 是 | - | 需要删除拦截器的 API 名称 |\n| interceptor | Interceptor \\| null | 否 | - | 拦截器 | \n","returnValue":"","compatibility":"### removeInterceptor 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.97 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.interceptor.removeInterceptor)\n"},"interceptor":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/interceptor/interceptor.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/interceptor/interceptor\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n const interceptor = {\r\n invoke: function (options : NavigateToOptions) {\r\n console.log('拦截 navigateTo 接口传入参数为:', options)\r\n const url = './page2'\r\n uni.showToast({\r\n title: `重定向到页面:${url}`\r\n })\r\n options.url = url\r\n },\r\n success: function (res : NavigateBackSuccess) {\r\n console.log('拦截 navigateTo 接口 success 返回参数为:', res)\r\n },\r\n fail: function (err : NavigateToFail) {\r\n console.log('拦截 navigateTo 接口 fail 返回参数为:', err)\r\n },\r\n complete: function (res : NavigateToComplete) {\r\n console.log('拦截 navigateTo 接口 complete 返回参数为:', res)\r\n }\r\n } as Interceptor\r\n export default {\r\n data() {\r\n return {\r\n msg: \"会跳转到测试页面1\"\r\n }\r\n },\r\n beforeUnmount() {\r\n // 移除 navigateTo 所有拦截器\r\n uni.removeInterceptor('navigateTo')\r\n },\r\n methods: {\r\n addInterceptor() {\r\n uni.addInterceptor('navigateTo', interceptor)\r\n uni.showToast({\r\n title: '页面跳转已拦截'\r\n })\r\n this.msg = \",路由被劫持到测试页面2\"\r\n },\r\n removeInterceptor() {\r\n uni.removeInterceptor('navigateTo', interceptor)\r\n uni.showToast({\r\n title: '拦截器已移除'\r\n })\r\n this.msg = \"会跳转到测试页面1\"\r\n },\r\n navigateTo() {\r\n uni.navigateTo({\r\n url: './page1',\r\n success(res) {\r\n console.log('res:', res)\r\n },\r\n fail(err) {\r\n console.error('err:', err)\r\n },\r\n complete(res) {\r\n console.log('res:', res)\r\n }\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"getLaunchOptionsSync":{"name":"## uni.getLaunchOptionsSync() @getlaunchoptionssync","description":"\n获取本次启动时的参数。返回值与App.onLaunch的回调参数一致\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **OnLaunchOptions** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | string | 是 | - | - | \n","compatibility":"### getLaunchOptionsSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getLaunchOptionsSync](https://doc.dcloud.net.cn/uni-app-x/api/get-launch-options-sync.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.get-launch-options-sync)\n"},"get-launch-options-sync":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-launch-options-sync/get-launch-options-sync.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-launch-options-sync/get-launch-options-sync\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\nexport default {\n data() {\n return {\n checked: false,\n homePagePath: 'pages/tabBar/component',\n launchOptionsPath: '',\n }\n },\n methods: {\n getLaunchOptionsSync() {\n const launchOptions = uni.getLaunchOptionsSync()\n this.launchOptionsPath = launchOptions.path\n\n if (launchOptions.path == this.homePagePath) {\n this.checked = true\n }\n },\n },\n}\n\n```\n:::"},"exit":{"name":"## uni.exit(options?) @exit","description":"\n退出当前应用","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ExitOptions](#exitoptions-values) \\| null | 否 | - | uni.exit参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [ExitSuccess](#exitsuccess-values)) => void \\| null | 否 | - | uni.exit成功回调函数定义 |\n@| fail | (res: [IExitError](#iexiterror-values)) => void \\| null | 否 | - | uni.exit失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.exit完成回调函数定义 | \n\n##### ExitSuccess 的属性值 @exitsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### IExitError 的属性值 @iexiterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 12001 \\| 12002 | 是 | - | 错误码
- 12001: 系统不支持
- 12002: 未知错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### exit 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | x | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.exit)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/exit/exit.uvue) \n ```uvue\n\n\n\n\n\n```"},"env":{"name":"## env","description":"","param":"### env 的属性值 @env-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| USER_DATA_PATH | string | 是 | - | 应用专属存储空间的外置存储空间根目录下的files目录 |\n| CACHE_PATH | string | 是 | - | 应用专属存储空间的外置存储空间根目录下的cache目录 |\n| SANDBOX_PATH | string | 是 | - | 应用专属存储空间的外置存储空间根目录(caches/files) |\n","compatibility":"#### env 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| USER_DATA_PATH | 3.99 | 4.11 | - |\n| CACHE_PATH | 3.99 | 4.11 | - |\n| SANDBOX_PATH | 3.99 | 4.11 | - |\n","returnValue":"","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.env)\n"},"navigateTo":{"name":"## uni.navigateTo(options) @navigateto","description":"\n保留当前页面,跳转到应用内的某个页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [NavigateToOptions](#navigatetooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| animationType | string \\| null | 否 | - | 窗口显示的动画类型
- auto: 自动选择动画效果
- none: 无动画效果
- slide-in-right: 从右侧横向滑动效果
- slide-in-left: 左侧横向滑动效果
- slide-in-top: 从上侧竖向滑动效果
- slide-in-bottom: 从下侧竖向滑动效果
- fade-in: 从透明到不透明逐渐显示效果
- zoom-out: 从小到大逐渐放大显示效果
- zoom-fade-out: 从小到大逐渐放大并且从透明到不透明逐渐显示效果
- pop-in: 从右侧平移入栈动画效果
- UnionType => 'auto' \\| 'none' \\| 'slide-in-right' \\| 'slide-in-left' \\| 'slide-in-top' \\| 'slide-in-bottom' \\| 'fade-in' \\| 'zoom-out' \\| 'zoom-fade-out' \\| 'pop-in' |\n@| animationDuration | number \\| null | 否 | - | 窗口显示动画的持续时间,单位为 ms |\n@| events | any \\| null | 否 | - | 页面间通信接口,用于监听被打开页面发送到当前页面的数据 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [NavigateToFail](#navigatetofail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### NavigateToFail 的属性值 @navigatetofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 路由错误码 - 4: 框架内部异常 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### NavigateToOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| animationType | x | x | 4.0 |\n| animationDuration | x | x | 4.0 |\n| events | x | x | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### navigateTo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[navigateTo](http://uniapp.dcloud.io/api/router?id=navigateto)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.navigateTo)\n"},"reLaunch":{"name":"## uni.reLaunch(options) @relaunch","description":"\n关闭所有页面,打开到应用内的某个页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReLaunchOptions](#relaunchoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的应用内页面路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [ReLaunchFail](#relaunchfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ReLaunchFail 的属性值 @relaunchfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### ReLaunchOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### reLaunch 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[reLaunch](http://uniapp.dcloud.io/api/router?id=relaunch)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.reLaunch)\n"},"navigateBack":{"name":"## uni.navigateBack(options?) @navigateback","description":"\n关闭当前页面,返回上一页面或多级页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [NavigateBackOptions](#navigatebackoptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| delta | number \\| null | 否 | - | 返回的页面数,如果 delta 大于现有页面数,则返回到首页 |\n@| animationType | string \\| null | 否 | - | 窗口关闭的动画类型
- auto: 自动选择动画效果
- none: 无动画效果
- slide-out-right: 横向向右侧滑出屏幕动画
- slide-out-left: 横向向左侧滑出屏幕动画
- slide-out-top: 竖向向上侧滑出屏幕动画
- slide-out-bottom: 竖向向下侧滑出屏幕动画
- fade-out: 从不透明到透明逐渐隐藏动画
- zoom-in: 从大逐渐缩小关闭动画
- zoom-fade-in: 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画
- pop-out: 从右侧平移出栈动画效果
- UnionType => 'auto' \\| 'none' \\| 'slide-out-right' \\| 'slide-out-left' \\| 'slide-out-top' \\| 'slide-out-bottom' \\| 'fade-out' \\| 'zoom-in' \\| 'zoom-fade-in' \\| 'pop-out' |\n@| animationDuration | number \\| null | 否 | - | 窗口关闭动画的持续时间,单位为 ms |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [NavigateBackFail](#navigatebackfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### NavigateBackFail 的属性值 @navigatebackfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### NavigateBackOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| delta | √ | 4.11 | 4.0 |\n| animationType | x | x | 4.0 |\n| animationDuration | x | x | 4.0 |\n| success | √ | x | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### navigateBack 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[navigateBack](http://uniapp.dcloud.io/api/router?id=navigateback)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.navigateBack)\n"},"redirectTo":{"name":"## uni.redirectTo(options) @redirectto","description":"\n关闭当前页面,跳转到应用内的某个页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [RedirectToOptions](#redirecttooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [RedirectToFail](#redirecttofail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### RedirectToFail 的属性值 @redirecttofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### RedirectToOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### redirectTo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[redirectTo](http://uniapp.dcloud.io/api/router?id=redirectto)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.redirectTo)\n"},"switchTab":{"name":"## uni.switchTab(options) @switchtab","description":"\n跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SwitchTabOptions](#switchtaboptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的 tabBar 页面的路径,路径后不能带参数 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SwitchTabFail](#switchtabfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SwitchTabFail 的属性值 @switchtabfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### SwitchTabOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### switchTab 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[switchTab](http://uniapp.dcloud.io/api/router?id=switchtab)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.switchTab)\n"},"navigator":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/navigator/navigator.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/navigator/navigator\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { state, setLifeCycleNum } from '@/store/index.uts'\r\n\r\n export default {\r\n data() {\r\n return {\r\n onLoadTime: 0,\r\n onShowTime: 0,\r\n onReadyTime: 0,\r\n onHideTime: 0,\r\n }\r\n },\r\n onLoad() {\r\n this.onLoadTime = Date.now()\r\n console.log('onLoad', this.onLoadTime)\r\n },\r\n onShow() {\r\n this.onShowTime = Date.now()\r\n console.log('onShow', this.onShowTime)\r\n },\r\n onReady() {\r\n this.onReadyTime = Date.now()\r\n console.log('onReady', this.onReadyTime)\r\n },\r\n onHide() {\r\n this.onHideTime = Date.now()\r\n console.log('onHide', this.onHideTime)\r\n },\r\n onBackPress(options : OnBackPressOptions) : boolean | null {\r\n console.log('onBackPress', Date.now())\r\n console.log('onBackPress from', options.from)\r\n return null\r\n },\r\n onUnload() {\r\n console.log('onUnload', Date.now())\r\n },\r\n methods: {\r\n reLaunch() {\r\n uni.reLaunch({\r\n url: '/pages/tabBar/component',\r\n success(result) {\r\n console.log('reLaunch success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('reLaunch fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('reLaunch complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateTo() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=Hello',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateToErrorPage() {\r\n uni.navigateTo({\r\n url: '/pages/error-page/error-page',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n uni.showToast({\r\n title: error.errMsg,\r\n icon: 'none',\r\n })\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateToDebounce() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=debounce',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=debounce',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n navigateToRelativePath1() {\r\n uni.navigateTo({\r\n url: 'new-page/new-page-1?data=new-page/new-page-1',\r\n success() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail() {\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n navigateToRelativePath2() {\r\n uni.navigateTo({\r\n url: './new-page/new-page-1?data=./new-page/new-page-1',\r\n success() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail() {\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n navigateToRelativePath3() {\r\n uni.navigateTo({\r\n url: '../navigator/new-page/new-page-1?data=../navigator/new-page/new-page-1',\r\n success() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail() {\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateBack() {\r\n uni.navigateBack({\r\n success(result) {\r\n console.log('navigateBack success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateBack fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateBack complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateBackWithDelta1() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1',\r\n success() {\r\n uni.navigateBack({\r\n delta: 1,\r\n success(result) {\r\n console.log('navigateBack success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateBack fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateBack complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n })\r\n },\r\n navigateBackWithDelta100() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1',\r\n success() {\r\n uni.navigateBack({\r\n delta: 100,\r\n success(result) {\r\n console.log('navigateBack success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateBack fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateBack complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n })\r\n },\r\n redirectTo() {\r\n uni.redirectTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=Hello',\r\n success(result) {\r\n console.log('redirectTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('redirectTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('redirectTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n switchTab() {\r\n uni.switchTab({\r\n url: '/pages/tabBar/template',\r\n success(result) {\r\n console.log('switchTab success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('switchTab fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('switchTab complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n getLifeCycleNum() : number {\r\n return state.lifeCycleNum\r\n },\r\n // 自动化测试\r\n setLifeCycleNum(num : number) {\r\n setLifeCycleNum(num)\r\n },\r\n },\r\n }\r\n\n```\n:::"},"setNavigationBarColor":{"name":"## uni.setNavigationBarColor(options) @setnavigationbarcolor","description":"\n设置导航条、状态栏颜色\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetNavigationBarColorOptions](#setnavigationbarcoloroptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| frontColor | \"#ffffff\" \\| \"#000000\" | 是 | - | 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 |\n@| backgroundColor | [string.ColorString](/uts/data-type.md#ide-string) | 是 | - | 背景颜色值,有效值为十六进制颜色 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (error: [SetNavigationBarColorFail](#setnavigationbarcolorfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetNavigationBarColorFail 的属性值 @setnavigationbarcolorfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### SetNavigationBarColorOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| frontColor | √ | 4.11 | 4.0 |\n| backgroundColor | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setNavigationBarColor 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setNavigationBarColor](https://doc.dcloud.net.cn/uni-app-x/api/set-navigation-bar-color.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-navigation-bar-color)\n"},"set-navigation-bar-color":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/set-navigation-bar-color/set-navigation-bar-color\n>Template\n```vue\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { state, setLifeCycleNum } from '@/store/index.uts'\r\n\r\n export default {\r\n methods: {\r\n setNavigationBarColor1() {\r\n uni.setNavigationBarColor({\r\n frontColor: '#ffffff',\r\n backgroundColor: '#00ff00',\r\n success: () => {\r\n console.log('setNavigationBarColor success')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail: () => {\r\n console.log('setNavigationBarColor fail')\r\n this.setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete: () => {\r\n console.log('setNavigationBarColor complete')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n }\r\n })\r\n },\r\n setNavigationBarColor2() {\r\n uni.setNavigationBarColor({\r\n frontColor: '#000000',\r\n backgroundColor: '#ff0000',\r\n success: () => {\r\n console.log('setNavigationBarColor success')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail: () => {\r\n console.log('setNavigationBarColor fail')\r\n this.setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete: () => {\r\n console.log('setNavigationBarColor complete')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n }\r\n })\r\n },\r\n // 自动化测试\r\n getLifeCycleNum() : number {\r\n return state.lifeCycleNum\r\n },\r\n // 自动化测试\r\n setLifeCycleNum(num : number) {\r\n setLifeCycleNum(num)\r\n },\r\n goNavbarLite() {\r\n uni.navigateTo({\r\n url: '/pages/template/navbar-lite/navbar-lite'\r\n })\r\n }\r\n },\r\n }\r\n\n```\n:::"},"setNavigationBarTitle":{"name":"## uni.setNavigationBarTitle(options) @setnavigationbartitle","description":"\n动态设置当前页面的标题\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetNavigationBarTitleOptions](#setnavigationbartitleoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string | 是 | - | 页面标题 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (error: [SetNavigationBarTitleFail](#setnavigationbartitlefail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetNavigationBarTitleFail 的属性值 @setnavigationbartitlefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### SetNavigationBarTitleOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| title | 3.97 | 4.11 | 4.0 |\n| success | 3.97 | 4.11 | 4.0 |\n| fail | 3.97 | 4.11 | 4.0 |\n| complete | 3.97 | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setNavigationBarTitle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.97 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setNavigationBarTitle](https://doc.dcloud.net.cn/uni-app-x/api/set-navigation-bar-title.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-navigation-bar-title)\n"},"set-navigation-bar-title":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/set-navigation-bar-title/set-navigation-bar-title\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n import { state, setLifeCycleNum } from '@/store/index.uts'\n\n export default {\n data() {\n return {\n newTitle: 'new title',\n longTitle: 'long title long title long title long title long title long title long title long title long title long title'\n }\n },\n methods: {\n setNavigationBarNewTitle() {\n uni.setNavigationBarTitle({\n title: this.newTitle,\n success: () => {\n console.log('setNavigationBarTitle success')\n this.setLifeCycleNum(state.lifeCycleNum + 1)\n },\n fail: () => {\n console.log('setNavigationBarTitle fail')\n this.setLifeCycleNum(state.lifeCycleNum - 1)\n },\n complete: () => {\n console.log('setNavigationBarTitle complete')\n this.setLifeCycleNum(state.lifeCycleNum + 1)\n }\n })\n },\n setNavigationBarLongTitle() {\n uni.setNavigationBarTitle({\n title: this.longTitle,\n success() {\n console.log('setNavigationBarTitle success')\n },\n fail() {\n console.log('setNavigationBarTitle fail')\n },\n complete() {\n console.log('setNavigationBarTitle complete')\n }\n })\n },\n // 自动化测试\n getLifeCycleNum() : number {\n return state.lifeCycleNum\n },\n // 自动化测试\n setLifeCycleNum(num : number) {\n setLifeCycleNum(num)\n }\n },\n }\n\n```\n:::"},"showTabBar":{"name":"## uni.showTabBar(options?) @showtabbar","description":"\n显示 tabBar\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowTabBarOptions](#showtabbaroptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| animation | boolean | 否 | - | 是否需要动画效果 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### showTabBar 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showTabBar](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#showtabbar)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.showTabBar)\n"},"hideTabBar":{"name":"## uni.hideTabBar(options?) @hidetabbar","description":"\n隐藏 tabBar\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [HideTabBarOptions](#hidetabbaroptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| animation | boolean | 否 | - | 是否需要动画效果 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### hideTabBar 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[hideTabBar](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#hidetabbar)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.hideTabBar)\n"},"showTabBarRedDot":{"name":"## uni.showTabBarRedDot(options) @showtabbarreddot","description":"\n显示 tabBar 某一项的右上角的红点\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowTabBarRedDotOptions](#showtabbarreddotoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### showTabBarRedDot 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showTabBarRedDot](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#showtabbarreddot)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.showTabBarRedDot)\n"},"hideTabBarRedDot":{"name":"## uni.hideTabBarRedDot(options) @hidetabbarreddot","description":"\n隐藏 tabBar 某一项的右上角的红点\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [HideTabBarRedDotOptions](#hidetabbarreddotoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### hideTabBarRedDot 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[hideTabBarRedDot](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#hidetabbarreddot)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.hideTabBarRedDot)\n"},"setTabBarBadge":{"name":"## uni.setTabBarBadge(options) @settabbarbadge","description":"\n为 tabBar 某一项的右上角添加文本\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetTabBarBadgeOptions](#settabbarbadgeoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| text | string | 是 | - | 显示的文本,不超过 3 个半角字符 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setTabBarBadge 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setTabBarBadge](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#settabbarbadge)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.setTabBarBadge)\n"},"removeTabBarBadge":{"name":"## uni.removeTabBarBadge(options) @removetabbarbadge","description":"\n移除 tabBar 某一项右上角的文本\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [RemoveTabBarBadgeOptions](#removetabbarbadgeoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### removeTabBarBadge 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[removeTabBarBadge](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#removetabbarbadge)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.removeTabBarBadge)\n"},"setTabBarStyle":{"name":"## uni.setTabBarStyle(options) @settabbarstyle","description":"\n动态设置 tabBar 的整体样式\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetTabBarStyleOptions](#settabbarstyleoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| color | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | tab 上的文字默认颜色 |\n@| selectedColor | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | tab 上的文字选中时的颜色 |\n@| backgroundColor | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | tab 的背景色 |\n@| backgroundImage | string | 否 | - | 图片背景 |\n@| backgroundRepeat | \"repeat\" \\| \"repeat-x\" \\| \"repeat-y\" \\| \"no-repeat\" | 否 | - | 背景图平铺方式
- repeat: 背景图片在垂直方向和水平方向平铺
- repeat-x: 背景图片在水平方向平铺,垂直方向拉伸
- repeat-y: 背景图片在垂直方向平铺,水平方向拉伸
- no-repeat: 背景图片在垂直方向和水平方向都拉伸 |\n@| borderStyle | string | 否 | - | tabbar上边框的颜色 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setTabBarStyle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setTabBarStyle](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#settabbarstyle)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.setTabBarStyle)\n"},"setTabBarItem":{"name":"## uni.setTabBarItem(options) @settabbaritem","description":"\n动态设置 tabBar 某一项的内容\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetTabBarItemOptions](#settabbaritemoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar 的哪一项,从左边算起,索引从0开始 |\n@| text | string | 否 | - | tab 上按钮文字 |\n@| iconPath | string | 否 | - | 图片路径 |\n@| selectedIconPath | string | 否 | - | 选中时的图片路径 |\n@| pagePath | string | 否 | - | 页面绝对路径 |\n@| iconfont | **SetTabBarItemIconFontOptions** | 否 | - | 字体图标,优先级高于 iconPath |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| text | string | 是 | - | 字库 Unicode 码 |\n@@| selectedText | string | 是 | - | 选中后字库 Unicode 码 |\n@@| fontSize | string | 否 | - | 字体图标字号(px) |\n@@| color | string | 否 | - | 字体图标颜色 |\n@@| selectedColor | string | 否 | - | 字体图标选中颜色 |\n@| visible | boolean | 否 | - | tab 是否显示 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setTabBarItem 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setTabBarItem](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#settabbaritem)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.setTabBarItem)\n"},"startPullDownRefresh":{"name":"## uni.startPullDownRefresh(options?) @startpulldownrefresh","description":"\n开始下拉刷新\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [StartPullDownRefreshOptions](#startpulldownrefreshoptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [StartPullDownRefreshFail](#startpulldownrefreshfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### StartPullDownRefreshFail 的属性值 @startpulldownrefreshfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### startPullDownRefresh 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[startPullDownRefresh](https://uniapp.dcloud.io/uni-app-x/api/pull-down-refresh.html#startpulldownrefresh)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pull-down-refresh.startPullDownRefresh)\n"},"stopPullDownRefresh":{"name":"## uni.stopPullDownRefresh() @stoppulldownrefresh","description":"\n停止当前页面下拉刷新\n","param":"","returnValue":"","compatibility":"### stopPullDownRefresh 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[stopPullDownRefresh](https://doc.dcloud.net.cn/uni-app-x/api/pull-down-refresh.html#stoppulldownrefresh)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pull-down-refresh.stopPullDownRefresh)\n"},"pull-down-refresh":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/pull-down-refresh/pull-down-refresh.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/pull-down-refresh/pull-down-refresh\n>Template\n```vue\n\n\n\n\n\n```\n>Script\n```uts\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tdata: [] as Array,\n\t\t\t\tloadMoreText: \"加载中...\",\n\t\t\t\tshowLoadMore: false,\n\t\t\t\tmax: 0\n\t\t\t}\n\t\t},\n\t\tonReady() {\n uni.startPullDownRefresh();\n\t\t\tthis.initData();\n\t\t},\n\t\tonReachBottom() {\n\t\t\tconsole.log(\"onReachBottom\");\n\t\t\tif (this.max > 40) {\n\t\t\t\tthis.loadMoreText = \"没有更多数据了!\"\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.showLoadMore = true;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.setListData();\n\t\t\t}, 300);\n\t\t},\n\t\tonPullDownRefresh() {\n\t\t\tconsole.log('onPullDownRefresh');\n\t\t\tthis.initData();\n\t\t},\n\t\tmethods: {\n\t\t\tinitData(){\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.max = 0;\n\t\t\t\t\tthis.data = [];\n\t\t\t\t\tlet data:Array = [];\n\t\t\t\t\tthis.max += 20;\n\t\t\t\t\tfor (let i:number = this.max - 19; i < this.max + 1; i++) {\n\t\t\t\t\t\tdata.push(i)\n\t\t\t\t\t}\n\t\t\t\t\tthis.data = this.data.concat(data);\n\t\t\t\t\tuni.stopPullDownRefresh();\n\t\t\t\t}, 1000);\n\t\t\t},\n\t\t\tsetListData() {\n\t\t\t\tlet data:Array = [];\n\t\t\t\tthis.max += 10;\n\t\t\t\tfor (let i:number = this.max - 9; i < this.max + 1; i++) {\n\t\t\t\t\tdata.push(i)\n\t\t\t\t}\n\t\t\t\tthis.data = this.data.concat(data);\n\t\t\t}\n\t\t}\n\t}\n\n```\n:::"},"pageScrollTo":{"name":"## uni.pageScrollTo(options) @pagescrollto","description":"\n将页面滚动到目标位置\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [PageScrollToOptions](#pagescrolltooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| scrollTop | number \\| null | 否 | - | 滚动到页面的目标位置 |\n@| selector | string \\| null | 否 | - | 选择器 |\n@| offsetTop | number \\| null | 否 | - | 偏移距离,可以滚动到 selector 加偏移距离的位置 |\n@| duration | number \\| null | 否 | - | 滚动动画的时长 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [PageScrollToFail](#pagescrolltofail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### PageScrollToFail 的属性值 @pagescrolltofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### PageScrollToOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| offsetTop | 3.91 | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### pageScrollTo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[pageScrollTo](https://doc.dcloud.net.cn/uni-app-x/api/page-scroll-to.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.page-scroll-to)\n"},"page-scroll-to":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/page-scroll-to/page-scroll-to.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/page-scroll-to/page-scroll-to\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'pageScrollTo',\n }\n },\n methods: {\n scrollTo() {\n uni.pageScrollTo({\n scrollTop: 100,\n duration: 300,\n success: () => {\n console.log('success')\n },\n })\n },\n scrollToElement() {\n uni.pageScrollTo({\n selector: '.custom-element',\n duration: 300,\n success: () => {\n console.log('success')\n },\n })\n },\n },\n }\n\n```\n:::"},"getElementById":{"name":"## uni.getElementById(id) @getelementbyid","description":"\n返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| id | [string.IDString](/uts/data-type.md#ide-string) \\| string | 是 | - | - | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) \\| null | 否 |\n \n","compatibility":"### getElementById 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getElementById](https://doc.dcloud.net.cn/uni-app-x/api/get-element.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.dom.get-element.getElementById)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-element-by-id/get-element-by-id.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-element-by-id/get-element-by-id\n>Template\n```vue\n\r\n\r\n\r\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n checked: false,\r\n homePagePath: '/pages/tabBar/component',\r\n launchOptionsPath: '',\r\n }\r\n },\r\n methods: {\r\n getElementByNotExistId() : Element | null {\r\n return uni.getElementById('not-exist-id')\r\n },\r\n changePageHeadBackgroundColor() {\r\n const pageHead = uni.getElementById('page-head')!\r\n pageHead.style.setProperty('background-color', 'red')\r\n },\r\n changeTextColor() {\r\n const text = uni.getElementById('text')!\r\n text.style.setProperty('color', 'red')\r\n },\r\n changeViewStyle() {\r\n const view = uni.getElementById('view')\r\n if (view !== null) {\r\n view.style.setProperty('width', '90%')\r\n view.style.setProperty('height', '50px')\r\n view.style.setProperty('background-color', '#007AFF')\r\n }\r\n },\r\n goMultipleRootNode() {\r\n uni.navigateTo({ url: '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node' })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"createSelectorQuery":{"name":"## uni.createSelectorQuery() @createselectorquery","description":"\n返回一个SelectorQuery对象实例\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n\n#### SelectorQuery 的方法 @selectorquery-values \n\n#### in(component?) @in\n\n将选择器的选取范围更改为自定义组件component内\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| component | any \\| null | 否 | - | | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n#### select(selector) @select\n\n在当前页面下选择第一个匹配选择器selector的节点\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| selector | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n\n##### NodesRef 的方法 @nodesref-values \n\n##### boundingClientRect(callback?) @boundingclientrect\n\n添加节点的布局位置的查询请求,相对于显示区域,以像素为单位\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void \\| null | 否 | - | | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n##### scrollOffset(callback) @scrolloffset\n\n添加节点的滚动位置查询请求,以像素为单位\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n##### fields(fields, callback) @fields\n\n获取节点的相关信息,需要获取的字段在fields中指定\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fields | [NodeField](#nodefield-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| id | boolean \\| null | 否 | - | 是否返回节点 id |\n@| dataset | boolean \\| null | 否 | - | 是否返回节点 dataset |\n@| rect | boolean \\| null | 否 | - | 是否返回节点布局位置(left right top bottom) |\n@| size | boolean \\| null | 否 | - | 是否返回节点尺寸(width height) |\n@| scrollOffset | boolean \\| null | 否 | - | 是否返回节点的 scrollLeft scrollTop,节点必须是 scroll-view 或者 viewport |\n@| properties | Array\\ \\| null | 否 | - | 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) |\n@| computedStyle | Array\\ \\| null | 否 | - | 指定样式名列表,返回节点对应样式名的当前值 |\n@| context | boolean \\| null | 否 | - | 是否返回节点对应的 Context 对象 |\n| callback | (result: any) => void | 是 | - | | \n\n###### NodeField 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| context | x | x | 4.0 |\n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n##### context(callback) @context\n\n添加节点的 Context 对象查询请求\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n###### context 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| x | x | 4.0 |\n\n\n##### node(callback) @node\n\n获取 Node 节点实例。目前支持 Canvas 的获取。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n \n\n\n\n#### selectAll(selector) @selectall\n\n在当前页面下选择匹配选择器selector的所有节点\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| selector | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n \n\n\n\n#### selectViewport() @selectviewport\n\n选择显示区域\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n \n\n\n\n#### exec(callback) @exec\n\n执行所有的请求\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: Array\\) => void \\| null | 是 | - | - | \n\n##### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [NodesRef](#nodesref-values) \\| null | 否 |\n \n\n\n \n","compatibility":"### createSelectorQuery 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[createSelectorQuery](https://doc.dcloud.net.cn/uni-app-x/api/nodes-info.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.dom.nodes-info.createSelectorQuery)\n"},"nodes-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/nodes-info/nodes-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/nodes-info/nodes-info\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import nodeChild from './nodes-info-child.uvue'\r\n\r\n type NodeInfoType = {\r\n left : number | null,\r\n top : number | null,\r\n right : number | null,\r\n bottom : number | null,\r\n width : number | null,\r\n height : number | null,\r\n }\r\n\r\n export default {\r\n components: {\r\n nodeChild\r\n },\r\n data() {\r\n return {\r\n title: 'createSelectorQuery',\r\n nodeInfoList: [] as NodeInfoType[],\r\n // 仅用于自动化测试\r\n rootNodeInfo: null as NodeInfoType | null,\r\n //供自动化测试使用\r\n // resizeRectValid: false\r\n }\r\n },\r\n onResize() {\r\n //供自动化测试使用\r\n /* var rect12Element = uni.getElementById(\"rect-1-2\")\r\n if(rect12Element != null) {\r\n var domRect = rect12Element.getBoundingClientRect()\r\n if(domRect.width > 100) {\r\n this.resizeRectValid = true\r\n }\r\n } */\r\n },\r\n methods: {\r\n // 仅用于自动化测试\r\n getRootNodeInfo(selector : string) {\r\n uni.createSelectorQuery().select(selector).boundingClientRect().exec((ret) => {\r\n if (ret.length == 1) {\r\n const nodeInfo = ret[0] as NodeInfo;\r\n const nodeType = {\r\n left: nodeInfo.left,\r\n top: nodeInfo.top,\r\n right: nodeInfo.right,\r\n bottom: nodeInfo.bottom,\r\n width: nodeInfo.width,\r\n height: nodeInfo.height,\r\n } as NodeInfoType;\r\n this.rootNodeInfo = nodeType\r\n }\r\n })\r\n },\r\n getNodeInfo() {\r\n uni.createSelectorQuery().select('.rect1').boundingClientRect().exec((ret) => {\r\n this.nodeInfoList.length = 0\r\n const i = ret[0] as NodeInfo\r\n this.nodeInfoList.push({\r\n left: i.left,\r\n top: i.top,\r\n right: i.right,\r\n bottom: i.bottom,\r\n width: i.width,\r\n height: i.height,\r\n } as NodeInfoType)\r\n })\r\n },\r\n getAllNodeInfo() {\r\n uni.createSelectorQuery().selectAll('.rect').boundingClientRect().exec((ret) => {\r\n this.nodeInfoList.length = 0\r\n const array = ret[0] as NodeInfo[]\r\n array.forEach((i) => {\r\n this.nodeInfoList.push({\r\n left: i.left,\r\n top: i.top,\r\n right: i.right,\r\n bottom: i.bottom,\r\n width: i.width,\r\n height: i.height,\r\n } as NodeInfoType)\r\n })\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"showActionSheet":{"name":"## uni.showActionSheet(options) @showactionsheet","description":"从底部向上弹出操作菜单","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowActionSheetOptions](#showactionsheetoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string \\| null | 否 | - | 菜单标题 |\n@| alertText | string \\| null | 否 | - | 警示文案(同菜单标题, app无效) |\n@| itemList | Array\\ | 是 | - | 按钮的文字数组 |\n@| itemColor | [string.ColorString](/uts/data-type.md#ide-string) \\| null | 否 | - | 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色) |\n@| popover | **Popover** \\| null | 否 | - | 大屏设备弹出原生选择按钮框的指示区域,默认居中显示 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| top | number | 是 | - | 指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度 |\n@@| left | number | 是 | - | 指示区域坐标 |\n@@| width | number | 是 | - | 指示区域宽度 |\n@@| height | number | 是 | - | 指示区域高度 |\n@| success | (res: [ShowActionSheetSuccess](#showactionsheetsuccess-values)) => void \\| null | 否 | - | uni.showActionSheet成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showActionSheet成功回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showActionSheet成功回调函数定义 | \n\n##### ShowActionSheetSuccess 的属性值 @showactionsheetsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tapIndex | number \\| null | 否 | - | 用户点击的按钮,从上到下的顺序,从0开始 |\n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showActionSheet 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showActionSheet](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showActionSheet)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/action-sheet/action-sheet.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/action-sheet/action-sheet\n>Template\n```vue\n\r\n\n\n```\n>Script\n```uts\n\r\n type ItemType = {\r\n value : string,\r\n name : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'action-sheet',\r\n itemColorCustom: false,\r\n itemContentLarge: false,\r\n itemNumLargeSelect: false,\n showErrorToast:true,\r\n items: [{\r\n value: '标题',\r\n name: '有标题'\r\n },\r\n {\r\n value: '',\r\n name: '无标题'\r\n },\r\n {\r\n value: '超长标题测试内容,测试超过显示最大范围之后的样式-超长标题测试内容,测试超过显示最大范围之后的样式',\r\n name: '超长标题'\r\n }\r\n ] as ItemType[],\r\n current: 0,\r\n }\r\n },\n onLoad(){\n uni.showActionSheet({\n title: \"onLoad 调用示例,请手动取消\",\n itemList:['item1', 'item2'],\n })\n },\r\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\r\n radioChange(e : UniRadioGroupChangeEvent) {\r\n for (let i = 0; i < this.items.length; i++) {\r\n if (this.items[i].value === e.detail.value) {\r\n this.current = i;\r\n break;\r\n }\r\n }\r\n },\r\n itemContentLargeChange: function (e : UniSwitchChangeEvent) {\r\n this.itemContentLarge = e.detail.value\r\n },\r\n itemColorChange: function (e : UniSwitchChangeEvent) {\r\n this.itemColorCustom = e.detail.value\r\n },\r\n itemNumLargeChange: function (e : UniSwitchChangeEvent) {\r\n this.itemNumLargeSelect = e.detail.value\r\n },\r\n actionSheetTap() {\r\n\r\n let itemInfo = ['item1', 'item2', 'item3', 'item4']\r\n\r\n if (this.itemContentLarge) {\r\n itemInfo = ['两个黄鹂鸣翠柳,一行白鹭上青天。窗含西岭千秋雪,门泊东吴万里船', '水光潋滟晴方好,山色空蒙雨亦奇。 欲把西湖比西子,淡妆浓抹总相宜', '']\r\n }\n\n if (this.itemNumLargeSelect) {\r\n // 大量选项测试,不能超过6个元素 https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet\r\n itemInfo = []\n for (var i = 1; i <= 10; i++) {\r\n itemInfo.push('两个黄鹂鸣翠柳,一行白鹭上青天');\r\n }\r\n }\r\n\r\n const that = this\r\n if (this.itemColorCustom) {\r\n uni.showActionSheet({\r\n title: this.items[this.current].value,\r\n itemList: itemInfo,\r\n itemColor: \"#ff00ff\",\r\n success: (e) => {\r\n console.log(e.tapIndex);\r\n uni.showToast({\r\n title: \"点击了第\" + e.tapIndex + \"个选项\",\r\n icon: \"none\"\r\n })\r\n },\r\n fail: (e) => {\n if(this.showErrorToast){\n uni.showToast({\n title: e.errMsg,\n icon: \"none\"\n })\n }\r\n console.log(e);\r\n }\r\n })\r\n } else {\r\n uni.showActionSheet({\r\n title: this.items[this.current].value,\r\n itemList: itemInfo,\r\n success: (e) => {\r\n console.log(e.tapIndex);\r\n uni.showToast({\r\n title: \"点击了第\" + e.tapIndex + \"个选项\",\r\n icon: \"none\"\r\n })\r\n },\r\n fail: (e) => {\r\n console.log(e);\n if(this.showErrorToast){\n uni.showToast({\n title: e.errMsg,\n icon: \"none\"\n })\n }\n }\r\n })\r\n }\r\n },\r\n }\r\n }\r\n\n```\n:::"},"showLoading":{"name":"## uni.showLoading(options) @showloading","description":"显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowLoadingOptions](#showloadingoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string | 是 | - | 提示的内容,长度与 icon 取值有关。 |\n@| mask | boolean \\| null | 否 | - | 是否显示透明蒙层,防止触摸穿透,默认:false |\n@| success | (res: ShowLoadingSuccess) => void \\| null | 否 | - | uni.showLoading成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showLoading失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showLoading完成回调函数定义 | \n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showLoading 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showLoading](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showLoading)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/loading/loading.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/loading/loading\n>Template\n```vue\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : string\n name : string\n }\n export default {\n data() {\n return {\n title: 'loading',\n items: [\n {\n value: 'null',\n name: '无标题',\n },\n {\n value: '三秒后自动关闭',\n name: '普通标题',\n },\n {\n value: '超长文本内容,测试超出范围-超长文本内容,测试超出范围-三秒后自动关闭',\n name: '长标题',\n },\n ] as ItemType[],\n current: 0,\n maskSelect: false,\n titleSelect: \"null\"\n }\n },\n onLoad(){\n uni.showLoading({\n \ttitle:'onLoad 调用示例,2秒后消失'\n })\n setTimeout(function() {\n uni.hideLoading()\n }, 2000);\n },\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\n\n radioChange(e : UniRadioGroupChangeEvent) {\n const selected = this.items.find((item) : boolean => {\n return item.value == e.detail.value\n })\n if (selected != null) {\n this.titleSelect = selected.value\n }\n },\n maskChange: function (e : UniSwitchChangeEvent) {\n this.maskSelect = e.detail.value\n },\n showLoading: function () {\n\n console.log(this.titleSelect)\n if (this.titleSelect == \"null\") {\n uni.showLoading({\n title: \"\",\n mask: this.maskSelect\n });\n } else {\n uni.showLoading({\n title: this.titleSelect,\n mask: this.maskSelect\n });\n }\n setTimeout(() => {\n this.hideLoading();\n }, 3000);\n },\n hideLoading: function () {\n uni.hideLoading();\n }\n }\n }\n\n```\n:::"},"showModal":{"name":"## uni.showModal(options) @showmodal","description":"显示模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowModalOptions](#showmodaloptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string \\| null | 否 | - | 提示的标题 |\n@| content | string \\| null | 否 | - | 提示的内容 |\n@| showCancel | boolean \\| null | 否 | true
是否显示取消按钮,默认为 true | |\n@| cancelText | string \\| null | 否 | - | 取消按钮的文字,默认为\"取消\" |\n@| cancelColor | [string.ColorString](/uts/data-type.md#ide-string) \\| null | 否 | - | 取消按钮的文字颜色,默认为\"#000000\" |\n@| confirmText | string \\| null | 否 | - | 确定按钮的文字,默认为\"确定\" |\n@| confirmColor | [string.ColorString](/uts/data-type.md#ide-string) \\| null | 否 | - | 确定按钮的文字颜色 |\n@| editable | boolean \\| null | 否 | false
是否显示输入框 | |\n@| placeholderText | string \\| null | 否 | - | 显示输入框时的提示文本 |\n@| success | (res: [ShowModalSuccess](#showmodalsuccess-values)) => void \\| null | 否 | - | uni.showModal成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showModal失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showModal完成回调函数定义 | \n\n##### ShowModalSuccess 的属性值 @showmodalsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| confirm | boolean | 是 | - | 为 true 时,表示用户点击了确定按钮 |\n| cancel | boolean | 是 | - | 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) |\n| content | string \\| null | 否 | - | editable 为 true 时,用户输入的文本 |\n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showModal 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showModal](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showModal)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/modal/modal.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/modal/modal\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : string,\n name : string,\n }\n export default {\n data() {\n return {\n title: 'modal',\n showCancelSelect: false,\n cancelTextSelect: false,\n confirmTextSelect: false,\n editableSelect: false,\n placeholderTextSelect: false,\n exeRet: \"\",\n items: [{\n value: '标题',\n name: '有标题'\n },\n {\n value: '',\n name: '无标题'\n },\n {\n value: '超长标题测试内容,测试超过显示最大范围之后的样式-超长标题测试内容,测试超过显示最大范围之后的样式',\n name: '超长标题'\n }\n ] as ItemType[],\n current: 0\n }\n },\n onLoad() {\n uni.showModal({\n title: \"onLoad 调用示例,请手动取消\",\n showCancel: false\n })\n },\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\n showCancelChange: function (e : UniSwitchChangeEvent) {\n this.showCancelSelect = e.detail.value\n },\n cancelTextChange: function (e : UniSwitchChangeEvent) {\n this.cancelTextSelect = e.detail.value\n },\n confirmTextChange: function (e : UniSwitchChangeEvent) {\n this.confirmTextSelect = e.detail.value\n },\n editableChange: function (e : UniSwitchChangeEvent) {\n this.editableSelect = e.detail.value\n },\n placeholderTextChange: function (e : UniSwitchChangeEvent) {\n this.placeholderTextSelect = e.detail.value\n },\n radioChange(e : UniRadioGroupChangeEvent) {\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].value === e.detail.value) {\n this.current = i;\n break;\n }\n }\n },\n modalTap: function () {\n let cancelTextVal : string\n let cancelColorVal = ''\n if (this.cancelTextSelect) {\n cancelTextVal = \"修改后的取消文本\"\n cancelColorVal = \"#ff00ff\"\n } else {\n cancelTextVal = \"取消\"\n }\n\n let confirmTextVal = '确定'\n let confirmColorVal = ''\n if (this.confirmTextSelect) {\n confirmTextVal = \"修改后的确定文本\"\n confirmColorVal = \"#00ffff\"\n }\n\n let placeholderTextVal = ''\n let contentVal = \"弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内\"\n if (this.placeholderTextSelect) {\n placeholderTextVal = \"定制提示信息\"\n contentVal = \"\"\n }\n uni.showModal({\n title: this.items[this.current].value,\n editable: this.editableSelect,\n placeholderText: placeholderTextVal,\n content: contentVal,\n showCancel: this.showCancelSelect,\n cancelText: cancelTextVal,\n cancelColor: cancelColorVal,\n confirmText: confirmTextVal,\n confirmColor: confirmColorVal,\n success: (res) => {\n this.exeRet = JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = JSON.stringify(res)\n }\n })\n }\n }\n }\n\n```\n:::"},"showToast":{"name":"## uni.showToast(options) @showtoast","description":"显示消息提示框","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowToastOptions](#showtoastoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string | 是 | - | 提示的内容,长度与 icon 取值有关。 |\n@| icon | \"success\" \\| \"error\" \\| \"fail\" \\| \"exception\" \\| \"loading\" \\| \"none\" | 否 | - | icon值说明 success: 显示成功图标,error: 显示错误图标; fail: 显示错误图标,此时title文本无长度显示; exception: 显示异常图标,此时title文本无长度显示; loading: 显示加载图标;none: 不显示图标。 |\n@| image | [string.ImageURIString](/uts/data-type.md#ide-string) \\| null | 否 | - | 自定义图标的本地路径(app端暂不支持gif) |\n@| mask | boolean \\| null | 否 | - | 是否显示透明蒙层,防止触摸穿透,默认:false |\n@| duration | number \\| null | 否 | - | 提示的延迟时间,单位毫秒,默认:1500 |\n@| position | \"top\" \\| \"center\" \\| \"bottom\" | 否 | - | position值说明(仅App生效) top: 居上显示; center: 居中显示;bottom: 居底显示 |\n@| success | (res: ShowToastSuccess) => void \\| null | 否 | - | uni.showToast成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showToast失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showToast完成回调函数定义 | \n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showToast 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showToast](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showToast)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/toast/toast.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/toast/toast\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'toast',\n exeRet: ''\n }\n },\n onLoad() {\n uni.showToast({\n title: 'onLoad 调用示例,2秒后消失'\n })\n setTimeout(function () {\n uni.hideToast()\n }, 2000);\n },\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\n toast1Tap: function () {\n uni.showToast({\n title: \"默认\",\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toastTapIconError: function () {\n uni.showToast({\n title: \"默认\",\n icon: 'error',\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toast2Tap: function () {\n uni.showToast({\n title: \"duration 3000\",\n duration: 3000,\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toast3Tap: function () {\n uni.showToast({\n title: \"loading\",\n icon: \"loading\",\n duration: 5000,\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toast4Tap: function () {\n uni.showToast({\n title: \"logo\",\n image: \"/static/uni.png\",\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n // #ifdef APP\n toast5Tap: function () {\n uni.showToast({\n title: \"显示一段轻提示\",\n position: 'bottom',\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n // #endif\n hideToast: function () {\n uni.hideToast()\n }\n }\n }\n\n```\n:::"},"loadFontFace":{"name":"## uni.loadFontFace(options) @loadfontface","description":"\n动态加载网络字体\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [LoadFontFaceOptions](#loadfontfaceoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| global | boolean | 否 | - | 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。 |\n@| family | string | 是 | - | 定义的字体名称 |\n@| source | string | 是 | - | 字体资源的地址, App-Android 平台不支持 woff、woff2 格式字体文件 |\n@| desc | **LoadFontFaceOptionDesc** | 否 | - | 可选的字体描述符 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| style | string \\| null | 否 | - | |\n@@| weight | string \\| null | 否 | - | |\n@@| variant | string \\| null | 否 | - | |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (error: [LoadFontFaceFail](#loadfontfacefail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### LoadFontFaceFail 的属性值 @loadfontfacefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 4 \\| 99 \\| 101 \\| 100001 \\| 100002 \\| 200001 \\| 300001 \\| 300002 | 是 | - | 错误码
- 4: 框架内部异常
- 99: page is not ready
- 101: 参数错误
- 100001: family is null
- 100002: source is null
- 200001: local font not found
- 300001: same source task is loading
- 300002: download fail |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### LoadFontFaceOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| global | √ | x | 4.0 |\n| family | √ | 4.10 | 4.0 |\n| source | √ | 4.10 | 4.0 |\n| desc | x | 4.10 | 4.0 |\n| success | √ | 4.10 | 4.0 |\n| fail | √ | 4.10 | 4.0 |\n| complete | √ | 4.10 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### loadFontFace 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.10 | 4.0 |\n","tutorial":"\n### 参见\n[loadFontFace](https://doc.dcloud.net.cn/uni-app-x/api/load-font-face.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.load-font-face)\n"},"load-font-face":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/load-font-face/load-font-face.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/load-font-face/load-font-face\n>Template\n```vue\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n uniIcon1: '\\ue100',\n uniIcon2: '\\ue101',\n }\n },\n onLoad() {\n uni.loadFontFace({\n global: true,\n family: 'UniFontFamily',\n source: \"url('/static/font/uni.ttf')\",\n success() {\n console.log('global loadFontFace uni.ttf success')\n },\n fail(error) {\n console.warn('global loadFontFace uni.ttf fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiTTF',\n source:\n \"url('https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf')\",\n success() {\n console.log('loadFontFace Remote AlimamaDaoLiTi.ttf success')\n },\n fail(error) {\n console.warn('loadFontFace Remote AlimamaDaoLiTi.ttf fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiOTF',\n source: \"url('/static/font/AlimamaDaoLiTi.otf')\",\n success() {\n console.log('loadFontFace AlimamaDaoLiTi.otf success')\n },\n fail(error) {\n console.warn('loadFontFace AlimamaDaoLiTi.otf fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiWOFF',\n source: \"url('/static/font/AlimamaDaoLiTi.woff')\",\n success() {\n console.log('loadFontFace AlimamaDaoLiTi.woff success')\n },\n fail(error) {\n console.warn('loadFontFace AlimamaDaoLiTi.woff fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiWOFF2',\n source: \"url('/static/font/AlimamaDaoLiTi.woff2')\",\n success() {\n console.log('loadFontFace AlimamaDaoLiTi.woff2 success')\n },\n fail(error) {\n console.warn('loadFontFace AlimamaDaoLiTi.woff2 fail', error.errMsg)\n },\n })\n },\n methods: {\n navigateToChild() {\n uni.navigateTo({\n url: '/pages/API/load-font-face/load-font-face-child',\n })\n },\n },\n }\n\n```\n:::"},"rpx2px":{"name":"## uni.rpx2px(number) @rpx2px","description":"\n将rpx单位值转换成px","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| number | number | 是 | - | | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| number |\n \n","compatibility":"### rpx2px 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.02 | 4.11 | 4.02 |\n","tutorial":"\n### 参见\n[rpx2px](https://doc.dcloud.net.cn/uni-app-x/api/rpx2px.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.rpx2px)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/rpx2px/rpx2px.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/rpx2px/rpx2px\n>Template\n```vue\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'rpx2px',\n rpxValue: 750,\n pxValue: 0,\n result: false\n }\n },\n methods: {\n rpx2px: function () {\n this.pxValue = uni.rpx2px(this.rpxValue);\n\n // 仅限自动化测试\n const windowInfo = uni.getWindowInfo();\n if (windowInfo.windowWidth == this.pxValue) {\n this.result = true\n }\n }\n }\n }\n\n```\n:::"},"request":{"name":"## uni.request(param) @request","description":"发起网络请求。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| param | [RequestOptions\\](#requestoptions-values) | 是 | - | 网络请求参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 开发者服务器接口地址 |\n@| data | any \\| null | 否 | null | 请求的参数 UTSJSONObject\\|string类型 |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | 设置请求的 header,header 中不能设置 Referer |\n@| method | \"GET\" \\| \"POST\" \\| \"PUT\" \\| \"PATCH\" \\| \"DELETE\" \\| \"HEAD\" \\| \"OPTIONS\" | 否 | \"GET\" | 请求方法
- GET GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。
- POST POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。
- PUT PUT方法用有效载荷请求替换目标资源的所有当前表示。
- PATCH PATCH方法用于对资源应用部分修改。
- DELETE DELETE方法删除指定的资源。
- HEAD HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。
- OPTIONS OPTIONS 方法用于描述目标资源的通信选项。 |\n@| timeout | number \\| null | 否 | 60000 | 超时时间,单位 ms |\n@| withCredentials | boolean \\| null | 否 | - | 跨域请求时是否携带凭证(cookies)
|\n@| firstIpv4 | boolean \\| null | 否 | false | DNS解析时优先使用ipv4 |\n@| success | (option: [RequestSuccess\\](#requestsuccess-values)) => void \\| null | 否 | null | 网络请求成功回调。 |\n@| fail | (option: [RequestFail](#requestfail-values)) => void \\| null | 否 | null | 网络请求失败回调。 |\n@| complete | (option: any) => void \\| null | 否 | null | 网络请求完成回调,成功或者失败都会调用。 | \n\n##### RequestSuccess\\ 的属性值 @requestsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | T \\| null | 否 | - | 开发者服务器返回的数据 |\n| statusCode | number | 是 | - | 开发者服务器返回的 HTTP 状态码 |\n| header | any | 是 | - | 开发者服务器返回的 HTTP Response Header |\n| cookies | Array\\ | 是 | - | 开发者服务器返回的 cookies,格式为字符串数组 |\n\n##### RequestFail 的属性值 @requestfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 5 \\| 1000 \\| 100001 \\| 100002 \\| 600003 \\| 600009 \\| 602001 | 是 | - | 错误码
- 5 接口超时
- 1000 服务端系统错误
- 100001 json数据解析错误
- 100002 错误信息json解析失败
- 600003 网络中断
- 600009 URL格式不合法
- 602001 request系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### RequestOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| withCredentials | x | x | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [RequestTask](#requesttask-values) |\n\n#### RequestTask 的方法 @requesttask-values \n\n#### abort() @abort\n中断网络请求。\n\n\n##### abort 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[abort](https://uniapp.dcloud.net.cn/api/request/request.html#request)\n \n","compatibility":"### request 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[request](https://uniapp.dcloud.net.cn/api/request/request.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.request)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/request/request.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/request/request\n>Template\n```vue\n\r\n\r\n\n```\n>Script\n```uts\n\n class GETDataType {\n data: UTSJSONObject | null = null\n }\n\r\n const duration = 2000\r\n const methodMap = {\r\n \"GET\": \"/api/http/method/get\",\r\n \"POST\": \"/api/http/method/post\",\r\n \"PUT\": \"/api/http/method/put\",\r\n \"DELETE\": \"/api/http/method/delete\",\r\n \"PATCH\": \"/api/http/method/patch\",\r\n \"OPTIONS\": \"/api/http/method/options\",\r\n \"HEAD\": \"/api/http/method/head\"\r\n }\r\n\r\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'request',\r\n res: '',\r\n task: null as RequestTask | null,\r\n host: \"https://request.dcloud.net.cn\",\r\n url: \"/api/http/method/get\",\r\n method: \"GET\" as RequestMethod | null,\r\n data: null as any | null,\r\n header: null as UTSJSONObject | null,\r\n errorCodeUrls: [\r\n \"/api/http/statusCode/200\",\r\n \"/api/http/statusCode/204\",\r\n \"/api/http/statusCode/301\",\r\n \"/api/http/statusCode/302\",\r\n \"/api/http/statusCode/307\",\r\n \"/api/http/statusCode/400\",\r\n \"/api/http/statusCode/401\",\r\n \"/api/http/statusCode/403\",\r\n \"/api/http/statusCode/404\",\r\n \"/api/http/statusCode/405\",\r\n \"/api/http/statusCode/500\",\r\n \"/api/http/statusCode/502\",\r\n \"/api/http/statusCode/503\",\r\n \"/api/http/statusCode/504\",\r\n ],\r\n headerUrls: [\r\n \"/api/http/header/ua\",\r\n \"/api/http/header/referer\",\r\n \"/api/http/header/requestCookie\",\r\n \"/api/http/header/setCookie\",\r\n \"/api/http/header/deleteCookie\"\r\n ],\r\n contentTypeUrls: [\r\n \"/api/http/contentType/text/plain\",\r\n \"/api/http/contentType/text/html\",\r\n \"/api/http/contentType/text/xml\",\r\n \"/api/http/contentType/image/gif\",\r\n \"/api/http/contentType/image/jpeg\",\r\n \"/api/http/contentType/image/png\",\r\n \"/api/http/contentType/application/json\",\r\n \"/api/http/contentType/application/octetStream\",\r\n ],\r\n postUrls: [\r\n \"/api/http/contentType/json\",\r\n \"/api/http/contentType/xWwwFormUrlencoded\",\r\n ],\r\n //自动化测试例专用\r\n jest_result: false\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload() {\r\n uni.hideLoading();\r\n this.task?.abort();\r\n },\r\n methods: {\r\n changeMethod(e : RequestMethod) {\r\n this.method = e;\r\n this.url = methodMap[e] as string;\r\n this.data = null;\r\n this.header = null;\r\n },\r\n changeUrl(e : string) {\r\n this.method = \"GET\";\r\n this.url = e;\r\n this.data = null;\r\n this.header = null;\r\n },\r\n changeUrlFromPost(e : string) {\r\n this.method = \"POST\";\r\n this.url = e;\r\n switch (e) {\r\n case \"/api/http/contentType/json\":\r\n this.header = {\r\n \"Content-Type\": \"application/json\"\r\n };\r\n this.data = {\r\n \"hello\": \"world\"\r\n };\r\n break;\r\n case \"/api/http/contentType/xWwwFormUrlencoded\":\r\n this.header = {\r\n \"Content-Type\": \"application/x-www-form-urlencoded\"\r\n };\r\n this.data = \"hello=world\";\r\n break;\r\n }\r\n },\r\n sendRequest() {\r\n uni.showLoading({\r\n title: \"请求中...\"\r\n })\r\n this.task = uni.request({\r\n url: this.host + this.url,\r\n // dataType: \"json\",\r\n // responseType: \"json\",\r\n method: this.method,\r\n data: this.data,\r\n header: this.header,\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: (res) => {\r\n console.log('request success', JSON.stringify(res.data))\r\n console.log('request success header is :', JSON.stringify(res.header))\r\n uni.showToast({\r\n title: '请求成功',\r\n icon: 'success',\r\n mask: true,\r\n duration: duration\r\n });\r\n this.res = '请求结果 : ' + JSON.stringify(res);\r\n },\r\n fail: (err) => {\r\n console.log('request fail', err);\r\n uni.showModal({\r\n content: err.errMsg,\r\n showCancel: false\r\n });\r\n },\r\n complete: () => {\r\n uni.hideLoading()\r\n },\r\n });\r\n },\r\n //自动化测试例专用\r\n jest_request() {\r\n uni.request({\r\n url: this.host + this.url,\r\n // dataType: \"json\",\r\n // responseType: \"json\",\r\n method: this.method,\r\n data: this.data,\r\n header: this.header,\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_set_cookie() {\r\n uni.request({\r\n url: this.host + \"/api/http/header/setCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_request(true)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_delete_cookie() {\r\n uni.request({\r\n url: this.host + \"/api/http/header/deleteCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_request(false)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_cookie_request(needCookie : boolean) {\r\n uni.request({\r\n url: this.host + \"/api/http/header/requestCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: (res) => {\r\n const requestCookie = (res.data as UTSJSONObject).getJSON(\"data\")?.getAny(\"requestCookie\")\r\n console.log(\"requestCookie \", requestCookie);\r\n if (requestCookie instanceof Array) {\r\n this.jest_result = needCookie ? requestCookie.length > 0 : requestCookie.length == 0\r\n } else {\r\n this.jest_result = needCookie ? (requestCookie as UTSJSONObject).toMap().size > 0 : (requestCookie as UTSJSONObject).toMap().size == 0\r\n }\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_timeout_null() {\r\n uni.request({\r\n url: this.host + (methodMap['GET'] as string),\r\n method: \"GET\",\r\n timeout: null,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\n jest_get_with_data() {\n uni.request({\n url: \"https://unidemo.dcloud.net.cn/api/banner/36kr\",\n method: \"GET\",\n data:{\n column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名\n },\n timeout: 6000,\n sslVerify: false,\n withCredentials: false,\n firstIpv4: false,\n success: () => {\n this.jest_result = true;\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n },\n jest_get_with_generics() {\n uni.request({\n url: this.host + (methodMap['GET'] as string),\n method: \"GET\",\n timeout: null,\n sslVerify: false,\n withCredentials: false,\n firstIpv4: false,\n success: (res: RequestSuccess) => {\n console.log(\"success :\", res.data?.data);\n this.jest_result = true;\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n }\r\n }\r\n }\r\n\n```\n:::"},"uploadFile":{"name":"## uni.uploadFile(options) @uploadfile","description":"将本地资源上传到开发者服务器。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [UploadFileOptions](#uploadfileoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 开发者服务器 url |\n@| filePath | string \\| null | 否 | null | 要上传文件资源的路径, 支持uni.env |\n@| name | string \\| null | 否 | null | 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 |\n@| files | Array\\<[UploadFileOptionFiles](#uploadfileoptionfiles-values)\\> \\| null | 否 | null | 需要上传的文件列表。 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| name | string \\| null | 否 | \"file\" | multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。 |\n@@| uri | string | 是 | - | 要上传文件资源的路径 |\n@@| file | any \\| null | 否 | - | 要上传的文件对象 |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | HTTP 请求 Header, header 中不能设置 Referer |\n@| formData | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | HTTP 请求中其他额外的 form data |\n@| timeout | number \\| null | 否 | 120000 | 超时时间,单位 ms |\n@| success | (result: [UploadFileSuccess](#uploadfilesuccess-values)) => void \\| null | 否 | null | 成功返回的回调函数 |\n@| fail | (result: [UploadFileFail](#uploadfilefail-values)) => void \\| null | 否 | null | 失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 结束的回调函数(调用成功、失败都会执行) | \n\n###### UploadFileOptionFiles 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| file | 3.9 | 4.11 | 4.0 |\n\n##### UploadFileSuccess 的属性值 @uploadfilesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | string | 是 | - | 开发者服务器返回的数据 |\n| statusCode | number | 是 | - | 开发者服务器返回的 HTTP 状态码 |\n\n##### UploadFileFail 的属性值 @uploadfilefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 5 \\| 1000 \\| 100001 \\| 100002 \\| 600003 \\| 600009 \\| 602001 | 是 | - | 错误码
- 5 接口超时
- 1000 服务端系统错误
- 100001 json数据解析错误
- 100002 错误信息json解析失败
- 600003 网络中断
- 600009 URL格式不合法
- 602001 request系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [UploadTask](#uploadtask-values) |\n\n#### UploadTask 的方法 @uploadtask-values \n\n#### abort() @abort\n中断上传任务。\n\n\n##### abort 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[abort](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n\n#### onProgressUpdate(callback) @onprogressupdate\n监听上传进度变化。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnProgressUpdateResult](#onprogressupdateresult-values)) => void | 是 | - | | \n\n##### OnProgressUpdateResult 的属性值 @onprogressupdateresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| progress | number | 是 | - | 上传进度百分比 |\n| totalBytesSent | number | 是 | - | 已经上传的数据长度,单位 Bytes |\n| totalBytesExpectedToSend | number | 是 | - | 预期需要上传的数据总长度,单位 Bytes |\n\n\n##### onProgressUpdate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onProgressUpdate](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n \n","compatibility":"### uploadFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[uploadFile](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.upload-file)\n"},"upload-file":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/upload-file/upload-file.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/upload-file/upload-file\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'uploadFile',\r\n imageSrc: '',\r\n task: null as UploadTask | null,\r\n //自动化测试例专用\r\n jest_result: false,\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload() {\r\n this.imageSrc = '';\r\n uni.hideLoading();\r\n this.task?.abort();\r\n },\r\n methods: {\r\n chooseImage: function () {\r\n uni.chooseImage({\r\n count: 1,\r\n sizeType: ['compressed'],\r\n sourceType: ['album'],\r\n success: (res) => {\r\n console.log('chooseImage success, temp path is', res.tempFilePaths[0])\r\n var imageSrc = res.tempFilePaths[0]\r\n uni.showLoading({\r\n title: '上传中'\r\n })\r\n this.task = uni.uploadFile({\r\n url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址\r\n filePath: imageSrc,\r\n name: 'file',\r\n formData: {\r\n 'user': 'test'\r\n },\r\n success: (res) => {\r\n console.log('uploadImage success, res is:', res)\r\n uni.hideLoading();\r\n uni.showToast({\r\n title: '上传成功',\r\n icon: 'success',\r\n duration: 1000\r\n })\r\n this.imageSrc = imageSrc\r\n },\r\n fail: (err) => {\r\n console.log('uploadImage fail', err);\r\n uni.hideLoading();\r\n uni.showModal({\r\n content: err.errMsg,\r\n showCancel: false\r\n });\r\n },\r\n });\r\n },\r\n fail: (err) => {\r\n console.log('chooseImage fail', err)\r\n }\r\n })\r\n },\r\n //自动化测试例专用\r\n jest_uploadFile() {\r\n const imageSrc = \"/static/uni.png\";\r\n this.task = uni.uploadFile({\r\n url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址\r\n filePath: imageSrc,\r\n name: 'file',\r\n formData: {\r\n 'user': 'test'\r\n },\r\n success: () => {\r\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n })\r\n },\r\n jest_set_cookie() {\r\n uni.request({\r\n url: \"https://request.dcloud.net.cn/api/http/header/setCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_upload(true)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n\r\n jest_delete_cookie() {\r\n uni.request({\r\n url: \"https://request.dcloud.net.cn/api/http/header/deleteCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_upload(false)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_cookie_upload(needCookie : boolean) {\r\n const imageSrc = \"/static/uni.png\";\r\n this.task = uni.uploadFile({\r\n url: 'https://request.dcloud.net.cn/api/http/header/upload',\r\n filePath: imageSrc,\r\n name: 'file',\r\n success: (res : UploadFileSuccess) => {\r\n const data = JSON.parseObject(res.data)\r\n const errCode = data?.getNumber(\"errCode\")\r\n if (errCode != null && errCode == 1000) {\r\n this.jest_result = needCookie ? false : true;\r\n } else {\r\n this.jest_result = needCookie ? true : false;\r\n }\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n })\r\n },\r\n jest_files_upload() {\r\n const imageSrc = \"/static/uni.png\";\r\n this.task = uni.uploadFile({\r\n url: 'https://unidemo.dcloud.net.cn/upload',\r\n files: [\r\n {\r\n name: \"file1\",\r\n uri: imageSrc\r\n } as UploadFileOptionFiles,\r\n {\r\n name: \"file2\",\r\n uri: imageSrc\r\n } as UploadFileOptionFiles\r\n ],\r\n success: (res : UploadFileSuccess) => {\r\n if (res.statusCode == 200) {\r\n this.jest_result = true;\r\n }\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"downloadFile":{"name":"## uni.downloadFile(options) @downloadfile","description":"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [DownloadFileOptions](#downloadfileoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 下载资源的 url |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | HTTP 请求 Header,header 中不能设置 Referer |\n@| filePath | string \\| null | 否 | null | 指定文件下载路径
支持相对路径与绝对路径,例:
`/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`
并且支持指定下载目录,例:
`/imgs/`
支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env |\n@| timeout | number \\| null | 否 | 120000 | 超时时间,单位 ms |\n@| success | (result: [DownloadFileSuccess](#downloadfilesuccess-values)) => void \\| null | 否 | null | 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} |\n@| fail | (result: [DownloadFileFail](#downloadfilefail-values)) => void \\| null | 否 | null | 失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 结束的回调函数(调用成功、失败都会执行) | \n\n##### DownloadFileSuccess 的属性值 @downloadfilesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tempFilePath | string | 是 | - | 临时文件路径,下载后的文件会存储到一个临时文件 |\n| statusCode | number | 是 | - | 开发者服务器返回的 HTTP 状态码 |\n\n##### DownloadFileFail 的属性值 @downloadfilefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 5 \\| 1000 \\| 100001 \\| 100002 \\| 600003 \\| 600009 \\| 602001 | 是 | - | 错误码
- 5 接口超时
- 1000 服务端系统错误
- 100001 json数据解析错误
- 100002 错误信息json解析失败
- 600003 网络中断
- 600009 URL格式不合法
- 602001 request系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [DownloadTask](#downloadtask-values) |\n\n#### DownloadTask 的方法 @downloadtask-values \n\n#### abort() @abort\n中断下载任务。\n\n\n##### abort 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[abort](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n\n#### onProgressUpdate(callback) @onprogressupdate\n监听下载进度变化。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnProgressDownloadResult](#onprogressdownloadresult-values)) => void | 是 | - | | \n\n##### OnProgressDownloadResult 的属性值 @onprogressdownloadresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| progress | number | 是 | - | 下载进度百分比 |\n| totalBytesWritten | number | 是 | - | 已经下载的数据长度,单位 Bytes |\n| totalBytesExpectedToWrite | number | 是 | - | 预期需要下载的数据总长度,单位 Bytes |\n\n\n##### onProgressUpdate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onProgressUpdate](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n \n","compatibility":"### downloadFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[downloadFile](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.download-file)\n"},"download-file":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/download-file/download-file.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/download-file/download-file\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'downloadFile',\r\n imageSrc: '',\r\n task: null as DownloadTask | null,\r\n //自动化测试例专用\r\n jest_result: false\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload() {\r\n // this.imageSrc = '';\r\n uni.hideLoading();\r\n this.task?.abort();\r\n },\r\n methods: {\r\n downloadImage: function () {\r\n uni.showLoading({\r\n title: '下载中'\r\n })\r\n var self = this\r\n this.task = uni.downloadFile({\r\n url: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png\",\r\n success: (res) => {\r\n console.log('downloadFile success, res is', res.tempFilePath)\r\n self.imageSrc = res.tempFilePath;\r\n uni.hideLoading();\r\n },\r\n fail: (err) => {\r\n console.log('downloadFile fail, err is:', err)\r\n uni.hideLoading();\r\n }\r\n });\r\n this.task?.onProgressUpdate((update) => {\r\n console.log(\"progress : \", update.progress);\r\n })\r\n },\r\n //自动化测试例专用\r\n jest_downloadFile() {\r\n uni.downloadFile({\r\n url: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png\",\r\n success: () => {\r\n this.jest_result = true\r\n },\r\n fail: () => {\r\n this.jest_result = false\r\n }\r\n });\r\n },\n\n jest_set_cookie(){\n uni.request({\n url: \"https://request.dcloud.net.cn/api/http/header/setCookie\",\n method: \"GET\",\n timeout: 6000,\n sslVerify: false,\n withCredentials: true,\n firstIpv4: false,\n success: () => {\n this.jest_cookie_download(true)\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n },\n\n jest_delete_cookie(){\n uni.request({\n url: \"https://request.dcloud.net.cn/api/http/header/deleteCookie\",\n method: \"GET\",\n timeout: 6000,\n sslVerify: false,\n withCredentials: true,\n firstIpv4: false,\n success: () => {\n this.jest_cookie_download(false)\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n },\n jest_cookie_download(needCookie: boolean){\n uni.downloadFile({\n url: \"https://request.dcloud.net.cn/api/http/header/download\",\n success: () => {\n this.jest_result = needCookie ? true : false;\n },\n fail: () => {\n this.jest_result = needCookie ? false : true;\n }\n });\n }\r\n }\r\n }\r\n\n```\n:::"},"getNetworkType":{"name":"## uni.getNetworkType(options) @getnetworktype","description":"获取网络类型","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetNetworkTypeOptions](#getnetworktypeoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: [GetNetworkTypeSuccess](#getnetworktypesuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetNetworkTypeSuccess 的属性值 @getnetworktypesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| networkType | string | 是 | - | 网络类型 |\n","returnValue":"","compatibility":"### getNetworkType 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.06 | 4.0 |\n","tutorial":"\n### 参见\n[getNetworkType](http://uniapp.dcloud.io/api/system/network?id=getnetworktype)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.get-network-type)\n"},"get-network-type":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-network-type/get-network-type.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-network-type/get-network-type\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'getNetworkType',\r\n hasNetworkType: false,\r\n networkType: '',\r\n connectedWifi: '',\r\n //自动化测试例专用\r\n jest_result: false,\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload: function () {\r\n this.networkType = '';\r\n this.hasNetworkType = false;\r\n },\r\n methods: {\r\n getNetworkType: function () {\r\n uni.getNetworkType({\r\n success: (res) => {\r\n console.log(res)\r\n this.hasNetworkType = true;\r\n this.networkType = res.networkType\r\n },\r\n fail: () => {\r\n uni.showModal({\r\n content: '获取失败!',\r\n showCancel: false\r\n })\r\n }\r\n })\r\n },\r\n clear: function () {\r\n this.hasNetworkType = false;\r\n this.networkType = '';\r\n this.connectedWifi = '';\r\n },\r\n //自动化测试例专用\r\n jest_getNetworkType() {\r\n uni.getNetworkType({\r\n success: () => {\r\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n }\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"connectSocket":{"name":"## connectSocket(options) @connectsocket","description":"创建一个 WebSocket 连接。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ConnectSocketOptions](#connectsocketoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | 如果属性名存在,且类型为UTSJSONObject返回对应的结果,不存在返回null |\n@| protocols | Array\\ \\| null | 否 | null | 子协议数组 |\n@| success | (result: [ConnectSocketSuccess](#connectsocketsuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [ConnectSocketFail](#connectsocketfail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ConnectSocketSuccess 的属性值 @connectsocketsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### ConnectSocketFail 的属性值 @connectsocketfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 - 600009 URL格式不合法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [SocketTask](#sockettask-values) |\n\n#### SocketTask 的方法 @sockettask-values \n\n#### send(options) @send\n通过 WebSocket 连接发送数据\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SendSocketMessageOptions](#sendsocketmessageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| data | any | 是 | - | 需要发送的内容 |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [SendSocketMessageFail](#sendsocketmessagefail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SendSocketMessageFail 的属性值 @sendsocketmessagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 10001 \\| 10002 \\| 602001 | 是 | - | 错误码
- 10001 发送数据超限,发送队列不能超过16M大小。
- 10002 websocket未连接
- 602001 websocket系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n##### send 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[send](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send)\n\n#### close(options) @close\n关闭 WebSocket 连接\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CloseSocketOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| code | number \\| null | 否 | 1000 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |\n@| reason | string \\| null | 否 | \"\" | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### close 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[close](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close)\n\n#### onOpen(callback) @onopen\n监听 WebSocket 连接打开事件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | **OnSocketOpenCallbackResult** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| header | any | 是 | - | 连接成功的 HTTP 响应 Header | \n\n\n##### onOpen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onOpen](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen)\n\n#### onClose(callback) @onclose\n监听 WebSocket 连接关闭事件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | | \n\n\n##### onClose 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onClose](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose)\n\n#### onError(callback) @onerror\n监听 WebSocket 错误\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 是 | - | | \n\n\n##### onError 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onError](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror)\n\n#### onMessage(callback) @onmessage\n监听 WebSocket 接受到服务器的消息事件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketMessageCallbackResult](#onsocketmessagecallbackresult-values)) => void | 是 | - | | \n\n##### OnSocketMessageCallbackResult 的属性值 @onsocketmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any | 是 | - | 服务器返回的消息 |\n\n\n##### onMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onMessage](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage)\n \n","compatibility":"### connectSocket 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[connectSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.connectSocket)\n"},"onSocketOpen":{"name":"## onSocketOpen(options) @onsocketopen","description":"监听WebSocket连接打开事件。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | (result: [OnSocketOpenCallbackResult](#onsocketopencallbackresult-values)) => void | 是 | - | | \n","returnValue":"","compatibility":"### onSocketOpen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketOpen](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketOpen)\n"},"onSocketError":{"name":"## onSocketError(callback) @onsocketerror","description":"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketErrorCallbackResult](#onsocketerrorcallbackresult-values)) => void | 是 | - | | \n\n#### OnSocketErrorCallbackResult 的属性值 @onsocketerrorcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 错误信息 |\n","returnValue":"","compatibility":"### onSocketError 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketError](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketError)\n"},"sendSocketMessage":{"name":"## sendSocketMessage(options) @sendsocketmessage","description":"通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SendSocketMessageOptions](#sendsocketmessageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| data | any | 是 | - | 需要发送的内容 |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [SendSocketMessageFail](#sendsocketmessagefail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SendSocketMessageFail 的属性值 @sendsocketmessagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 10001 \\| 10002 \\| 602001 | 是 | - | 错误码
- 10001 发送数据超限,发送队列不能超过16M大小。
- 10002 websocket未连接
- 602001 websocket系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### sendSocketMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[sendSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.sendSocketMessage)\n"},"onSocketMessage":{"name":"## onSocketMessage(callback) @onsocketmessage","description":"监听WebSocket接受到服务器的消息事件。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketMessageCallbackResult](#onsocketmessagecallbackresult-values)) => void | 是 | - | | \n\n#### OnSocketMessageCallbackResult 的属性值 @onsocketmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any | 是 | - | 服务器返回的消息 |\n","returnValue":"","compatibility":"### onSocketMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketMessage)\n"},"closeSocket":{"name":"## closeSocket(options) @closesocket","description":"关闭 WebSocket 连接。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CloseSocketOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| code | number \\| null | 否 | 1000 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |\n@| reason | string \\| null | 否 | \"\" | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n","returnValue":"","compatibility":"### closeSocket 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[closeSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.closeSocket)\n"},"onSocketClose":{"name":"## onSocketClose(callback) @onsocketclose","description":"监听WebSocket关闭。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketCloseCallbackResult](#onsocketclosecallbackresult-values)) => void | 是 | - | | \n\n#### OnSocketCloseCallbackResult 的属性值 @onsocketclosecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| code | number | 是 | - | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。\t |\n| reason | string | 是 | - | 一个可读的字符串,表示连接被关闭的原因。\t |\n","returnValue":"","compatibility":"### onSocketClose 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketClose](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketClose)\n"},"websocket-global":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/websocket-global/websocket-global.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/websocket-global/websocket-global\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n connected: false,\r\n connecting: false,\r\n msg: '',\r\n roomId: '',\r\n platform: '',\r\n }\r\n },\r\n computed: {\r\n showMsg() : string {\r\n if (this.connected) {\r\n if (this.msg.length > 0) {\r\n return '收到消息:' + this.msg\r\n } else {\r\n return '等待接收消息'\r\n }\r\n } else {\r\n return '尚未连接'\r\n }\r\n },\r\n },\r\n onLoad() {\r\n this.platform = uni.getSystemInfoSync().platform\r\n },\r\n onUnload() {\r\n uni.closeSocket({\r\n code: 1000,\r\n reason: 'close reason from client',\r\n success: (res : any) => {\r\n console.log('uni.closeSocket success', res)\r\n },\r\n fail: (err : any) => {\r\n console.log('uni.closeSocket fail', err)\r\n },\r\n } as CloseSocketOptions)\r\n uni.hideLoading()\r\n },\r\n methods: {\r\n connect() {\r\n if (this.connected || this.connecting) {\r\n uni.showModal({\r\n content: '正在连接或者已经连接,请勿重复连接',\r\n showCancel: false,\r\n })\r\n return\r\n }\r\n this.connecting = true\r\n uni.showLoading({\r\n title: '连接中...',\r\n })\r\n uni.connectSocket({\r\n url: 'ws://websocket.dcloud.net.cn',\r\n header: null,\r\n protocols: null,\r\n success: (res : any) => {\r\n // 这里是接口调用成功的回调,不是连接成功的回调,请注意\r\n console.log('uni.connectSocket success', res)\r\n },\r\n fail: (err : any) => {\r\n // 这里是接口调用失败的回调,不是连接失败的回调,请注意\r\n console.log('uni.connectSocket fail', err)\r\n },\r\n })\r\n uni.onSocketOpen((res) => {\r\n this.connecting = false\r\n this.connected = true\r\n uni.hideLoading()\r\n\r\n uni.showToast({\r\n icon: 'none',\r\n title: '连接成功',\r\n })\r\n console.log('onOpen', res)\r\n })\r\n uni.onSocketError((err) => {\r\n this.connecting = false\r\n this.connected = false\r\n uni.hideLoading()\r\n\r\n uni.showModal({\r\n content: '连接失败,可能是websocket服务不可用,请稍后再试',\r\n showCancel: false,\r\n })\r\n console.log('onError', err)\r\n })\r\n uni.onSocketMessage((res) => {\r\n this.msg = res.data as string\r\n console.log('onMessage', res)\r\n })\r\n uni.onSocketClose((res) => {\r\n this.connected = false\r\n this.msg = ''\r\n console.log('onClose', res)\r\n })\r\n },\r\n send() {\r\n uni.sendSocketMessage({\r\n data:\r\n 'from ' +\r\n this.platform +\r\n ' : ' +\r\n parseInt((Math.random() * 10000).toString()).toString(),\r\n success: (res : any) => {\r\n console.log(res)\r\n },\r\n fail: (err : any) => {\r\n console.log(err)\r\n },\r\n } as SendSocketMessageOptions)\r\n },\r\n close() {\r\n uni.closeSocket({\r\n code: 1000,\r\n reason: 'close reason from client',\r\n success: (res : any) => {\r\n console.log('uni.closeSocket success', res)\r\n },\r\n fail: (err : any) => {\r\n console.log('uni.closeSocket fail', err)\r\n },\r\n } as CloseSocketOptions)\r\n },\r\n },\r\n }\r\n\n```\n:::"},"getSystemInfo":{"name":"## uni.getSystemInfo(options) @getsysteminfo","description":"异步获取系统信息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetSystemInfoOptions](#getsysteminfooptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: [GetSystemInfoResult](#getsysteminforesult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetSystemInfoResult 的属性值 @getsysteminforesult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| SDKVersion | string | 是 | - | 客户端基础库版本 |\n| appId | string | 是 | - | `manifest.json` 中应用appid。 |\n| appLanguage | string | 是 | - | 应用设置的语言。 |\n| appName | string | 是 | - | `manifest.json` 中应用名称。 |\n| appVersion | string | 是 | - | `manifest.json` 中应用版本名称。 |\n| appVersionCode | string | 是 | - | `manifest.json` 中应用版本名号。 |\n| brand | string | 是 | - | 手机品牌。 |\n| browserName | string | 是 | - | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空 |\n| browserVersion | string | 是 | - | 浏览器版本、webview 版本。 |\n| deviceId | string | 是 | - | 设备 ID |\n| deviceBrand | string | 是 | - | 设备品牌。如:`apple`、`huawei`。 |\n| deviceModel | string | 是 | - | 设备型号 |\n| deviceType | \"phone\" \\| \"pad\" \\| \"tv\" \\| \"watch\" \\| \"pc\" \\| \"undefined\" \\| \"car\" \\| \"vr\" \\| \"appliance\" | 是 | - | 设备类型。 |\n| devicePixelRatio | number | 是 | - | 设备像素比 |\n| deviceOrientation | \"portrait\" \\| \"landscape\" | 是 | - | 设备方向。 |\n| language | string | 是 | - | 程序设置的语言 |\n| model | string | 是 | - | 手机型号 |\n| osName | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 系统名称\t |\n| osVersion | string | 是 | - | 操作系统版本。如 ios 版本,andriod 版本 |\n| osLanguage | string | 是 | - | 操作系统语言 |\n| osTheme | \"light\" \\| \"dark\" | 否 | - | 操作系统主题
|\n| pixelRatio | number | 是 | - | 设备像素比 |\n| platform | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 客户端平台 |\n| screenWidth | number | 是 | - | 屏幕宽度,单位为px |\n| screenHeight | number | 是 | - | 屏幕高度,单位为px |\n| statusBarHeight | number | 是 | - | 状态栏的高度,单位为px |\n| system | string | 是 | - | 操作系统版本 |\n| safeArea | **SafeArea** | 是 | - | 在竖屏正方向下的安全区域 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| left | number | 是 | - | 安全区域左上角横坐标,单位为px |\n@| right | number | 是 | - | 安全区域右下角横坐标,单位为px |\n@| top | number | 是 | - | 安全区域左上角纵坐标,单位为px |\n@| bottom | number | 是 | - | 安全区域右下角纵坐标,单位为px |\n@| width | number | 是 | - | 安全区域的宽度,单位为px |\n@| height | number | 是 | - | 安全区域的高度,单位为px |\n| safeAreaInsets | **SafeAreaInsets** | 是 | - | 在竖屏正方向下的安全区域插入位置 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| left | number | 是 | - | 安全区域左侧插入位置,单位为px |\n@| right | number | 是 | - | 安全区域右侧插入位置,单位为px |\n@| top | number | 是 | - | 安全区顶部插入位置,单位为px |\n@| bottom | number | 是 | - | 安全区域底部插入位置,单位为px |\n| ua | string | 是 | - | 用户标识。小程序端为空 |\n| ~~uniCompileVersion~~ | string | 是 | - | uni 编译器版本 **已废弃,仅为了向下兼容保留** |\n| uniCompilerVersion | string | 是 | - | uni 编译器版本 |\n| uniPlatform | \"app-android\" \\| \"app-ios\" \\| \"web\" \\| \"mp-weixin\" \\| \"mp-alipay\" \\| \"mp-baidu\" \\| \"mp-toutiao\" \\| \"mp-lark\" \\| \"mp-qq\" \\| \"mp-kuaishou\" \\| \"mp-jd\" \\| \"mp-360\" \\| \"quickapp-webview\" \\| \"quickapp-webview-union\" \\| \"quickapp-webview-huawei\" | 是 | - | uni-app 运行平台。 |\n| uniRuntimeVersion | string | 是 | - | uni 运行时版本 |\n| ~~uniCompileVersionCode~~ | number | 是 | - | uni 编译器版本号 **已废弃,仅为了向下兼容保留** |\n| uniCompilerVersionCode | number | 是 | - | uni 编译器版本号 |\n| uniRuntimeVersionCode | number | 是 | - | uni 运行时版本号 |\n| ~~version~~ | string | 是 | - | 引擎版本号。已废弃,仅为了向下兼容保留 **已废弃,仅为了向下兼容保留** |\n| romName | string | 是 | - | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios` |\n| romVersion | string | 是 | - | rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号` |\n| windowWidth | number | 是 | - | 可使用窗口宽度,单位为px |\n| windowHeight | number | 是 | - | 可使用窗口高度,单位为px |\n| windowTop | number | 是 | - | 可使用窗口的顶部位置,单位为px |\n| windowBottom | number | 是 | - | 可使用窗口的底部位置,单位为px |\n| osAndroidAPILevel | number \\| null | 否 | - | Android 系统API库的版本。
|\n\n###### GetSystemInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| osTheme | √ | 4.11 | - |\n| osAndroidAPILevel | √ | x | - |\n","returnValue":"","compatibility":"### getSystemInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getSystemInfo](http://uniapp.dcloud.io/api/system/info?id=getsysteminfo)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-system-info.getSystemInfo)\n"},"getSystemInfoSync":{"name":"## uni.getSystemInfoSync() @getsysteminfosync","description":"同步获取系统信息","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetSystemInfoResult](#getsysteminforesult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SDKVersion | string | 是 | - | 客户端基础库版本 |\n@| appId | string | 是 | - | `manifest.json` 中应用appid。 |\n@| appLanguage | string | 是 | - | 应用设置的语言。 |\n@| appName | string | 是 | - | `manifest.json` 中应用名称。 |\n@| appVersion | string | 是 | - | `manifest.json` 中应用版本名称。 |\n@| appVersionCode | string | 是 | - | `manifest.json` 中应用版本名号。 |\n@| brand | string | 是 | - | 手机品牌。 |\n@| browserName | string | 是 | - | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空 |\n@| browserVersion | string | 是 | - | 浏览器版本、webview 版本。 |\n@| deviceId | string | 是 | - | 设备 ID |\n@| deviceBrand | string | 是 | - | 设备品牌。如:`apple`、`huawei`。 |\n@| deviceModel | string | 是 | - | 设备型号 |\n@| deviceType | \"phone\" \\| \"pad\" \\| \"tv\" \\| \"watch\" \\| \"pc\" \\| \"null\" \\| \"car\" \\| \"vr\" \\| \"appliance\" | 是 | - | 设备类型。 |\n@| devicePixelRatio | number | 是 | - | 设备像素比 |\n@| deviceOrientation | \"portrait\" \\| \"landscape\" | 是 | - | 设备方向。 |\n@| language | string | 是 | - | 程序设置的语言 |\n@| model | string | 是 | - | 手机型号 |\n@| osName | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 系统名称\t |\n@| osVersion | string | 是 | - | 操作系统版本。如 ios 版本,andriod 版本 |\n@| osLanguage | string | 是 | - | 操作系统语言 |\n@| osTheme | \"light\" \\| \"dark\" | 否 | - | 操作系统主题
|\n@| pixelRatio | number | 是 | - | 设备像素比 |\n@| platform | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 客户端平台 |\n@| screenWidth | number | 是 | - | 屏幕宽度,单位为px |\n@| screenHeight | number | 是 | - | 屏幕高度,单位为px |\n@| statusBarHeight | number | 是 | - | 状态栏的高度,单位为px |\n@| system | string | 是 | - | 操作系统版本 |\n@| safeArea | **SafeArea** | 是 | - | 在竖屏正方向下的安全区域 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左上角横坐标,单位为px |\n@@| right | number | 是 | - | 安全区域右下角横坐标,单位为px |\n@@| top | number | 是 | - | 安全区域左上角纵坐标,单位为px |\n@@| bottom | number | 是 | - | 安全区域右下角纵坐标,单位为px |\n@@| width | number | 是 | - | 安全区域的宽度,单位为px |\n@@| height | number | 是 | - | 安全区域的高度,单位为px |\n@| safeAreaInsets | **SafeAreaInsets** | 是 | - | 在竖屏正方向下的安全区域插入位置 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左侧插入位置,单位为px |\n@@| right | number | 是 | - | 安全区域右侧插入位置,单位为px |\n@@| top | number | 是 | - | 安全区顶部插入位置,单位为px |\n@@| bottom | number | 是 | - | 安全区域底部插入位置,单位为px |\n@| ua | string | 是 | - | 用户标识。小程序端为空 |\n@| ~~uniCompileVersion~~ | string | 是 | - | uni 编译器版本 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersion | string | 是 | - | uni 编译器版本 |\n@| uniPlatform | \"app-android\" \\| \"app-ios\" \\| \"web\" \\| \"mp-weixin\" \\| \"mp-alipay\" \\| \"mp-baidu\" \\| \"mp-toutiao\" \\| \"mp-lark\" \\| \"mp-qq\" \\| \"mp-kuaishou\" \\| \"mp-jd\" \\| \"mp-360\" \\| \"quickapp-webview\" \\| \"quickapp-webview-union\" \\| \"quickapp-webview-huawei\" | 是 | - | uni-app 运行平台。 |\n@| uniRuntimeVersion | string | 是 | - | uni 运行时版本 |\n@| ~~uniCompileVersionCode~~ | number | 是 | - | uni 编译器版本号 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersionCode | number | 是 | - | uni 编译器版本号 |\n@| uniRuntimeVersionCode | number | 是 | - | uni 运行时版本号 |\n@| ~~version~~ | string | 是 | - | 引擎版本号。已废弃,仅为了向下兼容保留 **已废弃,仅为了向下兼容保留** |\n@| romName | string | 是 | - | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios` |\n@| romVersion | string | 是 | - | rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号` |\n@| windowWidth | number | 是 | - | 可使用窗口宽度,单位为px |\n@| windowHeight | number | 是 | - | 可使用窗口高度,单位为px |\n@| windowTop | number | 是 | - | 可使用窗口的顶部位置,单位为px |\n@| windowBottom | number | 是 | - | 可使用窗口的底部位置,单位为px |\n@| osAndroidAPILevel | number \\| null | 否 | - | Android 系统API库的版本。
|\n##### GetSystemInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| osTheme | √ | 4.11 | - |\n| osAndroidAPILevel | √ | x | - |\n \n","compatibility":"### getSystemInfoSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getSystemInfoSync](http://uniapp.dcloud.io/api/system/info?id=getsysteminfosync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-system-info.getSystemInfoSync)\n"},"get-system-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-system-info/get-system-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-system-info/get-system-info\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n type Item = {\r\n label : string,\r\n value : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'getSystemInfo',\r\n items: [] as Item[],\r\n }\r\n },\r\n onUnload: function () {\r\n },\r\n methods: {\r\n getSystemInfo: function () {\r\n uni.getSystemInfo({\r\n success: (res) => {\r\n this.items = [] as Item[];\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\r\n },\r\n })\r\n },\r\n getSystemInfoSync: function () {\r\n this.items = [] as Item[];\r\n const res = uni.getSystemInfoSync()\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\r\n },\r\n //自动化测试例专用\r\n jest_getSystemInfo() : GetSystemInfoResult {\r\n return uni.getSystemInfoSync();\r\n },\r\n }\r\n }\r\n\n```\n:::"},"getDeviceInfo":{"name":"## uni.getDeviceInfo(options?) @getdeviceinfo","description":"获取设备信息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **GetDeviceInfoOptions** | 否 | 包含所有字段的过滤对象 | [options=包含所有字段的过滤对象\\] 过滤的字段对象, 不传参数默认为获取全部字段。 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filter | Array\\ | 是 | - | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetDeviceInfoResult](#getdeviceinforesult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| brand | string | 否 | - | 设备品牌 |\n@| deviceBrand | string | 否 | - | 设备品牌 |\n@| deviceId | string | 否 | - | 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 |\n@| model | string | 否 | - | 设备型号\t |\n@| deviceModel | string | 否 | - | 设备型号\t |\n@| deviceType | string | 否 | - | 设备类型phone、pad、pc\t |\n@| deviceOrientation | string | 否 | - | 设备方向 竖屏 portrait、横屏 landscape\t |\n@| devicePixelRatio | string | 否 | - | 设备像素比\t |\n@| system | string | 否 | - | 操作系统及版本\t |\n@| platform | string | 否 | - | 客户端平台\t |\n@| isRoot | boolean | 否 | - | 是否root |\n@| isSimulator | boolean | 否 | - | 是否是模拟器 |\n@| isUSBDebugging | boolean | 否 | - | adb是否开启 |\n##### GetDeviceInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| isUSBDebugging | √ | x | - |\n \n","compatibility":"### getDeviceInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getDeviceInfo](https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-device-info)\n"},"get-device-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-device-info/get-device-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-device-info/get-device-info\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { setDevicePixelRatio } from '@/store/index.uts'\r\n\r\n type Item = {\r\n label : string,\r\n value : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'getDeviceInfo',\r\n items: [] as Item[],\r\n }\r\n },\r\n onUnload: function () {\r\n },\r\n methods: {\r\n getDeviceInfo: function () {\r\n const res = uni.getDeviceInfo();\r\n // 获取像素比, 供截图对比使用\r\n setDevicePixelRatio(res.devicePixelRatio !== null ? parseFloat(res.devicePixelRatio!) : 1)\r\n this.items = [] as Item[];\n\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\r\n }\r\n }\r\n }\r\n\n```\n:::"},"getWindowInfo":{"name":"## uni.getWindowInfo() @getwindowinfo","description":"同步获取窗口信息","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetWindowInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| pixelRatio | number | 是 | - | 设备像素比 |\n@| screenWidth | number | 是 | - | 屏幕宽度,单位为px |\n@| screenHeight | number | 是 | - | 屏幕高度,单位为px |\n@| windowWidth | number | 是 | - | 可使用窗口宽度,单位为px |\n@| windowHeight | number | 是 | - | 可使用窗口高度,单位为px |\n@| statusBarHeight | number | 是 | - | 状态栏的高度,单位为px |\n@| windowTop | number | 是 | - | 可使用窗口的顶部位置,单位为px |\n@| windowBottom | number | 是 | - | 可使用窗口的底部位置,单位为px |\n@| safeArea | **SafeArea** | 是 | - | 在竖屏正方向下的安全区域 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左上角横坐标,单位为px |\n@@| right | number | 是 | - | 安全区域右下角横坐标,单位为px |\n@@| top | number | 是 | - | 安全区域左上角纵坐标,单位为px |\n@@| bottom | number | 是 | - | 安全区域右下角纵坐标,单位为px |\n@@| width | number | 是 | - | 安全区域的宽度,单位为px |\n@@| height | number | 是 | - | 安全区域的高度,单位为px |\n@| safeAreaInsets | **SafeAreaInsets** | 是 | - | 在竖屏正方向下的安全区域插入位置 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左侧插入位置,单位为px |\n@@| right | number | 是 | - | 安全区域右侧插入位置,单位为px |\n@@| top | number | 是 | - | 安全区顶部插入位置,单位为px |\n@@| bottom | number | 是 | - | 安全区域底部插入位置,单位为px |\n@| screenTop | number | 是 | - | 窗口上边缘的 y 值,单位为px | \n","compatibility":"### getWindowInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getWindowInfo](http://uniapp.dcloud.io/api/system/getWindowInfo.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-window-info)\n"},"get-window-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-window-info/get-window-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-window-info/get-window-info\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { setStatusBarHeight, setSafeArea } from '@/store/index.uts'\r\n // #ifdef APP-ANDROID\r\n import type { SafeArea } from '@/store/index.uts'\r\n // #endif\r\n\r\n type Item = {\r\n label : string,\r\n value : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'getWindowInfo',\r\n items: [] as Item[],\r\n }\r\n },\r\n onUnload: function () {\r\n },\r\n onReady() {\r\n this.getWindowInfo()\r\n },\r\n methods: {\r\n getWindowInfo: function () {\r\n const res = uni.getWindowInfo();\r\n // 获取状态栏高度, 供截图对比使用\r\n setStatusBarHeight(res.statusBarHeight);\r\n // 获取安全区信息,供截图使用\r\n // #ifdef APP-ANDROID\r\n setSafeArea({\r\n top: res.safeArea.top,\r\n left: res.safeArea.left,\r\n right: res.safeArea.right,\r\n bottom: res.safeArea.bottom,\r\n width: res.safeArea.width,\r\n height: res.safeArea.height,\r\n } as SafeArea);\r\n // #endif\r\n // #ifdef APP-IOS\r\n setSafeArea({\r\n top: res.safeArea.top,\r\n left: res.safeArea.left,\r\n right: res.safeArea.right,\r\n bottom: res.safeArea.bottom,\r\n width: res.safeArea.width,\r\n height: res.safeArea.height,\r\n });\r\n // #endif\r\n this.items = [] as Item[];\r\n\r\n const res_str = JSON.stringify(res);\r\n const res_obj = JSON.parseObject(res_str);\r\n const res_map = res_obj!.toMap();\r\n let keys = [] as string[]\r\n res_map.forEach((_, key) => {\r\n keys.push(key);\r\n });\r\n keys.sort().forEach(key => {\r\n const value = res[key];\r\n if (value != null) {\r\n const item = {\r\n label: key,\r\n value: \"\" + ((typeof value == \"object\") ? JSON.stringify(value) : value)\r\n } as Item;\r\n this.items.push(item);\r\n }\r\n });\r\n },\r\n //自动化测试例专用\r\n jest_getWindowInfo() : GetWindowInfoResult {\r\n return uni.getWindowInfo();\r\n },\r\n }\r\n }\r\n\n```\n:::"},"getAppBaseInfo":{"name":"## uni.getAppBaseInfo(options?) @getappbaseinfo","description":"获取app基本信息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **GetAppBaseInfoOptions** | 否 | 包含所有字段的过滤对象 | [options=包含所有字段的过滤对象\\] 过滤的字段对象, 不传参数默认为获取全部字段。 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filter | Array\\ | 是 | - | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetAppBaseInfoResult](#getappbaseinforesult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| appId | string | 否 | - | manifest.json 中应用appid,即DCloud appid。\t |\n@| appName | string | 否 | - | `manifest.json` 中应用名称。 |\n@| appVersion | string | 否 | - | `manifest.json` 中应用版本名称。 |\n@| appVersionCode | string | 否 | - | `manifest.json` 中应用版本名号。 |\n@| appLanguage | string | 否 | - | 应用设置的语言en、zh-Hans、zh-Hant、fr、es\t |\n@| language | string | 否 | - | 应用设置的语言\t |\n@| ~~version~~ | string | 否 | - | 引擎版本号。已废弃,仅为了向下兼容保留 **已废弃,仅为了向下兼容保留** |\n@| isUniAppX | boolean | 否 | - | 是否uni-app x |\n@| ~~uniCompileVersion~~ | string | 否 | - | uni 编译器版本 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersion | string | 否 | - | uni 编译器版本 |\n@| uniPlatform | \"app\" \\| \"web\" \\| \"mp-weixin\" \\| \"mp-alipay\" \\| \"mp-baidu\" \\| \"mp-toutiao\" \\| \"mp-lark\" \\| \"mp-qq\" \\| \"mp-kuaishou\" \\| \"mp-jd\" \\| \"mp-360\" \\| \"quickapp-webview\" \\| \"quickapp-webview-union\" \\| \"quickapp-webview-huawei\" | 否 | - | uni-app 运行平台。 |\n@| uniRuntimeVersion | string | 否 | - | uni 运行时版本 |\n@| ~~uniCompileVersionCode~~ | number | 否 | - | uni 编译器版本号 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersionCode | number | 否 | - | uni 编译器版本号 |\n@| uniRuntimeVersionCode | number | 否 | - | uni 运行时版本号 |\n@| packageName | string | 否 | - | Android的包名 |\n@| bundleId | string | 否 | - | iOS的bundleId |\n@| signature | string | 否 | - | Android: 应用签名证书的SHA1值(全部为小写,中间不包含“:”)。 为了保证应用的安全性,请使用自己生成的证书(不要使用公共测试证书)。 iOS: 应用签名证书中绑定的Bundle ID(AppleID)的md5值(全部为小写)。 |\n##### GetAppBaseInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| uniCompilerVersion | 4.0 | 4.11 | 4.0 |\n| uniCompilerVersionCode | 4.0 | 4.11 | 4.0 |\n| packageName | 3.97 | x | x |\n| bundleId | x | 4.11 | x |\n| signature | 3.97 | 4.11 | x |\n \n","compatibility":"### getAppBaseInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getAppBaseInfo](https://uniapp.dcloud.net.cn/api/system/getAppBaseInfo.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-app-base-info)\n"},"get-app-base-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-app-base-info/get-app-base-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-app-base-info/get-app-base-info\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n```\n>Script\n```uts\n\n\ttype Item = {\n\t\tlabel : string,\n\t\tvalue : string,\n\t}\n\texport default {\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\ttitle: 'getAppBaseInfo',\n\t\t\t\titems: [] as Item[],\r\n\t\t\t}\r\n\t\t},\r\n\t\tonUnload:function(){\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\tgetAppBaseInfo: function () {\n\t\t\t\tconst res = uni.getAppBaseInfo();\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n\n this.items = [] as Item[];\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\n\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\n```\n:::"},"getAppAuthorizeSetting":{"name":"## uni.getAppAuthorizeSetting() @getappauthorizesetting","description":"获取 APP 授权设置。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetAppAuthorizeSettingResult](#getappauthorizesettingresult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| albumAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" | 否 | - | 允许 App 使用相册的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@| bluetoothAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 使用蓝牙的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `BlueTooth(低功耗蓝牙)` 模块 |\n@| cameraAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 使用摄像头的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台:表示没有配置 `android.permission.CAMERA` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值 |\n@| locationAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 使用定位的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台:表示没有配置 `android.permission.ACCESS_COARSE_LOCATION` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块 |\n@| locationAccuracy | \"reduced\" \\| \"full\" \\| \"unsupported\" | 否 | - | 定位准确度。
- reduced: 模糊定位
- full: 精准定位
- unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块) |\n@| locationReducedAccuracy | boolean \\| null | 否 | - | 定位准确度(推荐使用 locationAccuracy 属性)。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) |\n@| microphoneAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 使用麦克风的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台:表示没有配置 `android.permission.RECORD_AUDIO` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值 |\n@| notificationAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 通知的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n@| notificationAlertAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 通知带有提醒的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n@| notificationBadgeAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 通知带有标记的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n@| notificationSoundAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 通知带有声音的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n##### GetAppAuthorizeSettingResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| albumAuthorized | x | 4.11 | - |\n| bluetoothAuthorized | x | 4.11 | - |\n| locationReducedAccuracy | x | 4.11 | - |\n| notificationAlertAuthorized | x | 4.11 | - |\n| notificationBadgeAuthorized | x | 4.11 | - |\n| notificationSoundAuthorized | x | 4.11 | - |\n \n","compatibility":"### getAppAuthorizeSetting 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | x |\n","tutorial":"\n### 参见\n[getAppAuthorizeSetting](http://uniapp.dcloud.io/api/system/getappauthorizesetting)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-app-authorize-setting)\n"},"get-app-authorize-setting":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-app-authorize-setting/get-app-authorize-setting.uvue) \n ```uvue\n\r\n\r\n\r\n\n\n```"},"getSystemSetting":{"name":"## uni.getSystemSetting() @getsystemsetting","description":"获取系统设置","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetSystemSettingResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| bluetoothEnabled | boolean | 否 | - | 蓝牙是否开启 |\n@| bluetoothError | string | 否 | - | 蓝牙的报错信息 |\n@| locationEnabled | boolean | 是 | - | 位置是否开启 |\n@| wifiEnabled | boolean | 否 | - | wifi是否开启 |\n@| wifiError | string | 否 | - | wifi的报错信息 |\n@| deviceOrientation | \"portrait\" \\| \"landscape\" | 是 | - | 设备方向 | \n","compatibility":"### getSystemSetting 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[getSystemSetting](https://uniapp.dcloud.net.cn/api/system/getsystemsetting.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-system-setting)\n"},"get-system-setting":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-system-setting/get-system-setting.uvue) \n ```uvue\n\n\r\n\r\n\r\n\n\n```"},"installApk":{"name":"## uni.installApk(options) @installapk","description":"安装apk","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [InstallApkOptions](#installapkoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | string | 是 | - | apk文件地址 |\n@| success | (res: [InstallApkSuccess](#installapksuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (err: [InstallApkFail](#installapkfail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### InstallApkSuccess 的属性值 @installapksuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 安装成功消息 |\n\n##### InstallApkFail 的属性值 @installapkfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 - 1300002 找不到文件 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### installApk 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.94 | x | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.install-apk)\n"},"install-apk":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/install-apk/install-apk.uvue) \n ```uvue\n\r\n\r\n\n\n```"},"getPushClientId":{"name":"## uni.getPushClientId(options) @getpushclientid","description":"获取客户端唯一的推送标识","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetPushClientIdOptions](#getpushclientidoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: [GetPushClientIdSuccess](#getpushclientidsuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetPushClientIdSuccess 的属性值 @getpushclientidsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| cid | string | 是 | - | 个推客户端推送id,对应uni-id-device表的push_clientid |\n| errMsg | string | 是 | - | 错误描述 |\n","returnValue":"","compatibility":"### getPushClientId 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[getPushClientId](http://uniapp.dcloud.io/api/plugins/push.html#getpushclientid)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getPushClientId)\n"},"onPushMessage":{"name":"## uni.onPushMessage(callback) @onpushmessage","description":"启动监听推送消息事件","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnPushMessageCallbackResult](#onpushmessagecallbackresult-values)) => void | 是 | - | | \n\n#### OnPushMessageCallbackResult 的属性值 @onpushmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | \"click\" \\| \"receive\" | 是 | - | 事件类型
- click 从系统推送服务点击消息启动应用事件
- receive 应用从推送服务器接收到推送消息事件 |\n| data | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) | 是 | - | 消息内容 |\n","returnValue":"","compatibility":"### onPushMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[onPushMessage](http://uniapp.dcloud.io/api/plugins/push.html#onpushmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.onPushMessage)\n"},"offPushMessage":{"name":"## uni.offPushMessage(callback) @offpushmessage","description":"关闭推送消息监听事件","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnPushMessageCallbackResult](#onpushmessagecallbackresult-values)) => void | 是 | - | | \n\n#### OnPushMessageCallbackResult 的属性值 @onpushmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | \"click\" \\| \"receive\" | 是 | - | 事件类型
- click 从系统推送服务点击消息启动应用事件
- receive 应用从推送服务器接收到推送消息事件 |\n| data | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) | 是 | - | 消息内容 |\n","returnValue":"","compatibility":"### offPushMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[offPushMessage](http://uniapp.dcloud.io/api/plugins/push.html#offpushmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.offPushMessage)\n"},"getChannelManager":{"name":"## uni.getChannelManager() @getchannelmanager","description":"获取通知渠道管理器,Android 8系统以上才可以设置通知渠道,Android 8系统以下返回null。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [ChannelManager](#channelmanager-values) |\n\n#### ChannelManager 的方法 @channelmanager-values \n\n#### setPushChannel(options) @setpushchannel\n\n设置推送渠道\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **SetPushChannelOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| soundName | string \\| null | 否 | null | 添加的声音文件,注意raw目录下必须要有 ,不传此字段将使用默认铃音。 |\n@| channelId | string | 是 | - | 通知渠道id |\n@| channelDesc | string | 是 | - | 通知渠道描述 |\n@| enableLights | boolean \\| null | 否 | false | 呼吸灯闪烁 |\n@| enableVibration | boolean \\| null | 否 | false | 震动 |\n@| importance | number \\| null | 否 | 3 | 通知的重要性级别,可选范围IMPORTANCE_LOW:2、IMPORTANCE_DEFAULT:3、IMPORTANCE_HIGH:4 。 |\n@| lockscreenVisibility | number \\| null | 否 | -1000 | 锁屏可见性,可选范围VISIBILITY_PRIVATE:0、VISIBILITY_PUBLIC:1、VISIBILITY_SECRET:-1、VISIBILITY_NO_OVERRIDE:-1000。 | \n\n\n##### setPushChannel 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n\n\n#### getAllChannels() @getallchannels\n\n获取当前应用注册的所有的通知渠道。\n\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Array\\ |\n \n\n##### getAllChannels 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n\n \n","compatibility":"### getChannelManager 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getChannelManager)\n"},"createPushMessage":{"name":"## uni.createPushMessage(options) @createpushmessage","description":"创建本地通知栏消息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [CreatePushMessageOptions](#createpushmessageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| cover | boolean \\| null | 否 | false | 是否覆盖上一次提示的消息 |\n@| delay | number \\| null | 否 | 0 | 提示消息延迟显示的时间,单位为s |\n@| icon | string \\| null | 否 | null | 推送消息的图标 |\n@| sound | string \\| null | 否 | \"system\" | 推送消息的提示音
- system: 使用系统通知提示音(默认值)
- none: 不使用提示音 |\n@| title | string \\| null | 否 | App的名称 | 推送消息的标题 |\n@| content | string | 是 | - | 消息显示的内容,在系统通知中心中显示的文本内容 |\n@| payload | any \\| null | 否 | null | 消息承载的数据,可根据业务逻辑自定义数据格式 |\n@| when | number \\| null | 否 | 当前时间 | 消息上显示的提示时间 |\n@| channelId | string \\| null | 否 | \"DcloudChannelID\" | 渠道id |\n@| category | string \\| null | 否 | null | 通知类别 |\n@| success | (result: CreatePushMessageSuccess) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### CreatePushMessageOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| channelId | 3.98 | x | - |\n| category | 3.98 | x | - |\n","returnValue":"","compatibility":"### createPushMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[createPushMessage](http://uniapp.dcloud.io/api/plugins/push.html#createpushmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.createPushMessage)\n"},"getBatteryInfo":{"name":"## uni.getBatteryInfo(options) @getbatteryinfo","description":"获取电池电量信息\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-getbatteryinfo](https://ext.dcloud.net.cn/plugin?name=uni-getbatteryinfo)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetBatteryInfoOptions](#getbatteryinfooptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [GetBatteryInfoSuccess](#getbatteryinfosuccess-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) |\n@| fail | (res: UniError) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | 接口调用成功的回调 | \n\n##### GetBatteryInfoSuccess 的属性值 @getbatteryinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n| level | number | 是 | - | 设备电量,范围1 - 100 |\n| isCharging | boolean | 是 | - | 是否正在充电中 |\n","returnValue":"","compatibility":"### getBatteryInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-battery-info.getBatteryInfo)\n"},"getBatteryInfoSync":{"name":"## uni.getBatteryInfoSync() @getbatteryinfosync","description":"获取电池电量信息\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-getbatteryinfo](https://ext.dcloud.net.cn/plugin?name=uni-getbatteryinfo)\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetBatteryInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| level | number | 是 | - | 设备电量,范围1 - 100 |\n@| isCharging | boolean | 是 | - | 是否正在充电中 | \n","compatibility":"### getBatteryInfoSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-battery-info.getBatteryInfoSync)\n"},"get-battery-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-battery-info/get-battery-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-battery-info/get-battery-info\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tlevel: 0,\n\t\t\t\tisCharging: false\n\t\t\t}\n\t\t},\n\t\tonLoad() {\n\t\t\tuni.getBatteryInfo({\n\t\t\t\tsuccess: res => {\n\t\t\t\t\tthis.level = res.level;\n\t\t\t\t\tthis.isCharging = res.isCharging;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n```\n:::"},"startWifi":{"name":"## uni.startWifi(option) @startwifi","description":"\n初始化Wi-Fi模块\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiOption](#wifioption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### startWifi 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[startWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.startWifi)\n"},"stopWifi":{"name":"## uni.stopWifi(option) @stopwifi","description":"\n关闭 Wi-Fi 模块\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiOption](#wifioption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### stopWifi 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| x | 4.11 | - |\n","tutorial":"\n### 参见\n[stopWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.stopWifi)\n"},"connectWifi":{"name":"## uni.connectWifi(option) @connectwifi","description":"","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiConnectOption](#wificonnectoption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 否 | - | - |\n@| BSSID | string | 否 | - | - |\n@| password | string | 否 | - | - |\n@| maunal | boolean | 否 | - | - |\n@| partialInfo | boolean | 否 | - | - |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### connectWifi 兼容性 \n| Android 系统版本 | Android | iOS | web |\n| :- | :- | :- | :- |\n| >=4.4 && <10.0 | 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[connectWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#connectWifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.connectWifi)\n"},"getWifiList":{"name":"## uni.getWifiList(option) @getwifilist","description":"\n请求获取 Wi-Fi 列表。wifiList 数据会在 onGetWifiList 注册的回调中返回。\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiOption](#wifioption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### getWifiList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[getWifiList](https://uniapp.dcloud.net.cn/api/system/wifi.html#getWifiList)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.getWifiList)\n"},"onGetWifiList":{"name":"## uni.onGetWifiList(callback) @ongetwifilist","description":"\n监听获取到 Wi-Fi 列表数据事件。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (wifiInfo: any) => void | 是 | - | | \n","returnValue":"","compatibility":"### onGetWifiList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onGetWifiList](https://uniapp.dcloud.net.cn/api/system/wifi.html#onGetWifiList)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onGetWifiList)\n"},"offGetWifiList":{"name":"## uni.offGetWifiList(callback) @offgetwifilist","description":"\n移除获取到 Wi-Fi 列表数据事件的监听函数。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | () => void | 是 | - | | \n","returnValue":"","compatibility":"### offGetWifiList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offGetWifiList](https://uniapp.dcloud.net.cn/api/system/wifi.html#offGetWifiList)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.offGetWifiList)\n"},"getConnectedWifi":{"name":"## uni.getConnectedWifi(option) @getconnectedwifi","description":"\n获取已连接的 Wi-Fi 信息\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [GetConnectedWifiOptions](#getconnectedwifioptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| partialInfo | boolean | 否 | - | - |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### getConnectedWifi 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[getConnectedWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#getConnectedWifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.getConnectedWifi)\n"},"onWifiConnected":{"name":"## uni.onWifiConnected(callback) @onwificonnected","description":"\n监听连接上 Wi-Fi 的事件\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (wifiInfo: [UniWifiResult](#uniwifiresult-values)) => void | 是 | - | | \n\n#### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### onWifiConnected 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onWifiConnected](https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnected)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onWifiConnected)\n"},"onWifiConnectedWithPartialInfo":{"name":"## uni.onWifiConnectedWithPartialInfo(callback) @onwificonnectedwithpartialinfo","description":"\n监听连接上 Wi-Fi 的事件。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (wifiInfo: [UniWifiInfoWithPartialInfo](#uniwifiinfowithpartialinfo-values)) => void | 是 | - | | \n\n#### UniWifiInfoWithPartialInfo 的属性值 @uniwifiinfowithpartialinfo-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| SSID | string | 是 | - | - |\n","returnValue":"","compatibility":"### onWifiConnectedWithPartialInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onWifiConnectedWithPartialInfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnectedWithPartialInfo)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onWifiConnectedWithPartialInfo)\n"},"offWifiConnected":{"name":"## uni.offWifiConnected(callback?) @offwificonnected","description":"\n移除连接上 Wi-Fi 的事件的监听函数。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | () => void \\| null | 否 | - | | \n","returnValue":"","compatibility":"### offWifiConnected 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offWifiConnected](https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnected)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.offWifiConnected)\n"},"onMemoryWarning":{"name":"## uni.onMemoryWarning(callback) @onmemorywarning","description":"\n开启监听内存警告\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-memorywarning](https://ext.dcloud.net.cn/plugin?name=uni-memorywarning)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [MemoryWarningCallbackResult](#memorywarningcallbackresult-values)) => void | 是 | - | | \n\n#### MemoryWarningCallbackResult 的属性值 @memorywarningcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| level | number | 是 | - | 内存警告等级(仅安卓平台有效,iOS始终是0) |\n","returnValue":"","compatibility":"### onMemoryWarning 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onMemoryWarning](https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.memory.onMemoryWarning)\n"},"offMemoryWarning":{"name":"## uni.offMemoryWarning(callback?) @offmemorywarning","description":"\n取消监听内存不足告警事件\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-memorywarning](https://ext.dcloud.net.cn/plugin?name=uni-memorywarning)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [MemoryWarningCallbackResult](#memorywarningcallbackresult-values)) => void \\| null | 否 | - | | \n\n#### MemoryWarningCallbackResult 的属性值 @memorywarningcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| level | number | 是 | - | 内存警告等级(仅安卓平台有效,iOS始终是0) |\n","returnValue":"","compatibility":"### offMemoryWarning 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offMemoryWarning](https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.memory.offMemoryWarning)\n"},"onUserCaptureScreen":{"name":"## uni.onUserCaptureScreen(callback?) @onusercapturescreen","description":"\n开启截屏监听\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-usercapturescreen](https://ext.dcloud.net.cn/plugin?name=uni-usercapturescreen)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [OnUserCaptureScreenCallbackResult](#onusercapturescreencallbackresult-values)) => void \\| null | 否 | - | | \n\n#### OnUserCaptureScreenCallbackResult 的属性值 @onusercapturescreencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 否 | - | 截屏文件路径(仅Android返回) |\n","returnValue":"","compatibility":"### onUserCaptureScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onUserCaptureScreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.captureScreen.onUserCaptureScreen)\n"},"offUserCaptureScreen":{"name":"## uni.offUserCaptureScreen(callback?) @offusercapturescreen","description":"\n关闭截屏监听\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-usercapturescreen](https://ext.dcloud.net.cn/plugin?name=uni-usercapturescreen)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [OnUserCaptureScreenCallbackResult](#onusercapturescreencallbackresult-values)) => void \\| null | 否 | - | | \n\n#### OnUserCaptureScreenCallbackResult 的属性值 @onusercapturescreencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 否 | - | 截屏文件路径(仅Android返回) |\n","returnValue":"","compatibility":"### offUserCaptureScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offUserCaptureScreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.captureScreen.offUserCaptureScreen)\n"},"createRequestPermissionListener":{"name":"## uni.createRequestPermissionListener() @createrequestpermissionlistener","description":"创建一个监听权限申请的对象。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [RequestPermissionListener](#requestpermissionlistener-values) |\n\n#### RequestPermissionListener 的方法 @requestpermissionlistener-values \n\n#### onRequest(callback) @onrequest\n\n监听申请系统权限\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (permissions: Array\\) => void | 是 | - | 申请系统权限回调,permissions为触发权限申请的所有权限 | \n\n\n\n\n#### onConfirm(callback) @onconfirm\n\n监听弹出系统权限授权框\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (permissions: Array\\) => void | 是 | - | 弹出系统权限授权框回调,permissions为触发弹出权限授权框的所有权限 | \n\n\n\n\n#### onComplete(callback) @oncomplete\n\n监听权限申请完成\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (permissions: Array\\) => void | 是 | - | 权限申请完成回调,permissions为申请完成的所有权限 | \n\n\n\n\n#### stop() @stop\n\n取消所有监听\n\n\n\n \n","compatibility":"### createRequestPermissionListener 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.0 | - | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.createRequestPermissionListener)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/create-request-permission-listener/create-request-permission-listener.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"chooseImage":{"name":"## uni.chooseImage(options) @chooseimage","description":"从本地相册选择图片或使用相机拍照","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ChooseImageOptions](#chooseimageoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| count | number \\| null | 否 | 9 | 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。 |\n@| sizeType | Array\\ \\| null | 否 | ['original','compressed'\\] | original 原图,compressed 压缩图,默认二者都有 |\n@| sourceType | Array\\ \\| null | 否 | ['album','camera'\\] | album 从相册选图,camera 使用相机,默认二者都有 |\n@| crop | **ChooseImageCropOptions** \\| null | 否 | - | 图像裁剪参数,设置后 sizeType 失效。 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| width | number | 是 | - | 裁剪的宽度,单位为px,用于计算裁剪宽高比。 |\n@@| height | number | 是 | - | 裁剪的高度,单位为px,用于计算裁剪宽高比。 |\n@@| quality | number \\| null | 否 | 80 | 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。 |\n@@| resize | boolean \\| null | 否 | - | 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。 |\n@| success | (callback: [ChooseImageSuccess](#chooseimagesuccess-values)) => void \\| null | 否 | - | 成功则返回图片的本地文件路径列表 tempFilePaths |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ChooseImageSuccess 的属性值 @chooseimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errSubject | string | 是 | - | 调用API的名称 |\n| errMsg | string | 是 | - | 描述信息 |\n| tempFilePaths | Array\\ | 是 | - | 图片的本地文件路径列表 |\n| tempFiles | any | 是 | - | 图片的本地文件列表 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### chooseImage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[chooseImage](http://uniapp.dcloud.io/api/media/image?id=chooseimage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.choose-image)\n"},"choose-image":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/choose-image/choose-image.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/choose-image/choose-image\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n var sourceTypeArray = [\n ['camera'],\n ['album'],\n ['camera', 'album']\n ]\n var sizeTypeArray = [\n ['compressed'],\n ['original'],\n ['compressed', 'original']\n ]\n export default {\n data() {\n return {\n title: 'choose/previewImage',\n imageList: [] as Array,\n sourceTypeIndex: 2,\n sourceType: ['拍照', '相册', '拍照或相册'],\n sizeTypeIndex: 2,\n sizeType: ['压缩', '原图', '压缩或原图'],\n countIndex: 8,\n count: [1, 2, 3, 4, 5, 6, 7, 8, 9],\n isCrop: false,\n cropPercent: 80,\n cropWidth: 100,\n cropHeight: 100,\n cropResize: false\n }\n },\n onUnload() {\n this.imageList = [];\n this.sourceTypeIndex = 2\n this.sourceType = ['拍照', '相册', '拍照或相册']\n this.sizeTypeIndex = 2\n this.sizeType = ['压缩', '原图', '压缩或原图']\n this.countIndex = 8\n },\n methods: {\n cropHeightConfim(e : InputConfirmEvent) {\n let value = parseInt(e.detail.value)\n if (value > 0) {\n this.cropHeight = value\n } else {\n uni.showToast({\n position: \"bottom\",\n title: \"裁剪高度需要大于0\"\n })\n }\n },\n cropWidthConfim(e : InputConfirmEvent) {\n let value = parseInt(e.detail.value)\n if (value > 0) {\n this.cropWidth = value\n } else {\n uni.showToast({\n position: \"bottom\",\n title: \"裁剪宽度需要大于0\"\n })\n }\n },\n cropPercentConfim(e : InputConfirmEvent) {\n let value = parseInt(e.detail.value)\n if (value > 0 && value <= 100) {\n this.cropPercent = value\n } else {\n uni.showToast({\n position: \"bottom\",\n title: \"请输入0~100之间的值\"\n })\n }\n },\n cropResizeChange(e : UniSwitchChangeEvent) {\n this.cropResize = e.detail.value\n },\n switchCrop(e : UniSwitchChangeEvent) {\n this.isCrop = e.detail.value\n },\n removeImage(index : number) {\n this.imageList.splice(index, 1)\n },\n chooseImageSource() {\n uni.showActionSheet({\n itemList: ['拍照', '相册', '拍照或相册'],\n success: (e) => {\n this.sourceTypeIndex = e.tapIndex!\n }\n })\n },\n chooseImageType() {\n uni.showActionSheet({\n itemList: ['压缩', '原图', '压缩或原图'],\n success: (e) => {\n this.sizeTypeIndex = e.tapIndex!\n }\n })\n },\n chooseImageCount(event : InputConfirmEvent) {\n let count = parseInt(event.detail.value) - 1\n if (count < 0) {\n uni.showToast({\n position: \"bottom\",\n title: \"图片数量应该大于0\"\n })\n return\n }\n this.countIndex = count\n },\n chooseImage: function () {\n // var cropOption:ChooseImageCropOptions|null = this.isCrop ? null : new ChooseImageCropOptions( )\n if (this.imageList.length >= 9) {\n uni.showToast({\n position: \"bottom\",\n title: \"已经有9张图片了,请删除部分图片之后重新选择\"\n })\n return\n }\n uni.chooseImage({\n sourceType: sourceTypeArray[this.sourceTypeIndex],\n sizeType: sizeTypeArray[this.sizeTypeIndex],\n crop: this.isCrop ? { \"quality\": this.cropPercent, \"width\": this.cropWidth, \"height\": this.cropHeight, \"resize\": this.cropResize } as ChooseImageCropOptions : null,\n count: this.imageList.length + this.count[this.countIndex] > 9 ? 9 - this.imageList.length : this.count[this.countIndex],\n success: (res) => {\n this.imageList = this.imageList.concat(res.tempFilePaths);\n },\n fail: (err) => {\n console.log(\"err: \", JSON.stringify(err));\n }\n })\n },\n previewImage: function (index : number) {\n uni.previewImage({\n current: index,\n urls: this.imageList\n })\n }\n }\n }\n\n```\n:::"},"previewImage":{"name":"## uni.previewImage(options) @previewimage","description":"预览图片","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [PreviewImageOptions](#previewimageoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| current | any \\| null | 否 | - | current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。 |\n@| urls | Array\\<[string.ImageURIString](/uts/data-type.md#ide-string)\\> | 是 | - | 需要预览的图片链接列表 |\n@| indicator | string \\| null | 否 | - | 图片指示器样式
- default: 底部圆点指示器
- number: 顶部数字指示器
- none: 不显示指示器 |\n@| loop | boolean \\| null | 否 | - | 是否可循环预览 |\n@| success | (callback: [PreviewImageSuccess](#previewimagesuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### PreviewImageSuccess 的属性值 @previewimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errSubject | string | 是 | - | 调用API的名称 |\n| errMsg | string | 是 | - | 描述信息 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### previewImage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[previewImage](http://uniapp.dcloud.io/api/media/image?id=previewimage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.preview-image.previewImage)\n"},"closePreviewImage":{"name":"## uni.closePreviewImage(options) @closepreviewimage","description":"关闭图片预览","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ClosePreviewImageOptions](#closepreviewimageoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (callback: [ClosePreviewImageSuccess](#closepreviewimagesuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ClosePreviewImageSuccess 的属性值 @closepreviewimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 错误信息 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### closePreviewImage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[closePreviewImage](http://uniapp.dcloud.io/api/media/image?id=closepreviewimage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.preview-image.closePreviewImage)\n"},"preview-image":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/preview-image/preview-image.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/preview-image/preview-image\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : string,\n name : string\n }\n\n export default {\n data() {\n return {\n imageList: [\"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png\", \"/static/uni.png\"],\n indicator: [{\n value: \"default\",\n name: \"圆点\"\n }, {\n value: \"number\",\n name: \"数字\"\n }, {\n value: \"none\",\n name: \"不显示\"\n }] as ItemType[],\n currentIndicator: \"default\",\n isLoop: true\n }\n },\n methods: {\n previewImage(index : number) {\n uni.previewImage({\n urls: this.imageList,\n current: index,\n indicator: this.currentIndicator,\n loop: this.isLoop\n })\n },\n chooseImage() {\n uni.chooseImage({\n sourceType: ['album'],\n success: (e) => {\n this.imageList = this.imageList.concat(e.tempFilePaths)\n },\n fail(_) {\n }\n })\n },\n onIndicatorChanged(e : UniRadioGroupChangeEvent) {\n this.currentIndicator = e.detail.value\n },\n onCheckboxChange(_ : UniCheckboxGroupChangeEvent) {\n this.isLoop = !this.isLoop\n }\n }\n }\n\n```\n:::"},"saveImageToPhotosAlbum":{"name":"## uni.saveImageToPhotosAlbum(options) @saveimagetophotosalbum","description":"保存图片到系统相册","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SaveImageToPhotosAlbumOptions](#saveimagetophotosalbumoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.ImageURIString](/uts/data-type.md#ide-string) | 是 | - | 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径 |\n@| success | (callback: [SaveImageToPhotosAlbumSuccess](#saveimagetophotosalbumsuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SaveImageToPhotosAlbumSuccess 的属性值 @saveimagetophotosalbumsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 是 | - | 保存到相册的图片路径 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### saveImageToPhotosAlbum 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[saveImageToPhotosAlbum](http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.save-image-to-photos-album)\n"},"save-image-to-photos-album":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"getLocation":{"name":"## uni.getLocation(options) @getlocation","description":"获取当前的地理位置、速度","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetLocationOptions](#getlocationoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| type | \"wgs84\" \\| \"gcj02\" \\| \"gps\" | 否 | wgs84 | 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标,web端需配置定位 SDK 信息才可支持 gcj02 |\n@| altitude | boolean \\| null | 否 | false | 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 |\n@| geocode | boolean \\| null | 否 | false | 传入 true 会解析地址 |\n@| highAccuracyExpireTime | number \\| null | 否 | 3000 | 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 |\n@| isHighAccuracy | boolean \\| null | 否 | false | 开启高精度定位 |\n@| success | (result: [GetLocationSuccess](#getlocationsuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [IGetLocationFail](#igetlocationfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetLocationSuccess 的属性值 @getlocationsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| latitude | number | 是 | 0 | 纬度,浮点数,范围为-90~90,负数表示南纬 |\n| longitude | number | 是 | 0 | 经度,范围为-180~180,负数表示西经 |\n| speed | number | 是 | 0 | 速度,浮点数,单位m/s |\n| accuracy | number | 是 | - | 位置的精确度 |\n| altitude | number | 是 | 0 | 高度,单位 m |\n| verticalAccuracy | number | 是 | 0 | 垂直精度,单位 m(Android 无法获取,返回 0) |\n| horizontalAccuracy | number | 是 | 0 | 水平精度,单位 m |\n| address | any \\| null | 否 | null | 地址信息 |\n\n##### IGetLocationFail 的属性值 @igetlocationfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1505004 \\| 1505005 \\| 1505021 \\| 1505022 \\| 1505023 \\| 1505024 \\| 1505025 \\| 1505026 | 是 | - | 错误码
- 1505004 缺失权限
- 1505005 缺失高精度权限授权(iOS特有)
- 1505021 超时
- 1505022 不支持的定位类型
- 1505023 不支持逆地理编码
- 1505024 没有找到具体的定位引擎,请定位开关是否已打开
- 1505025 逆地理编码捕获失败
- 1505026 捕获定位失败 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### getLocation 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | x | 4.0 |\n","tutorial":"\n### 参见\n[getLocation](http://uniapp.dcloud.io/api/location/location?id=getlocation)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.location.get-location)\n"},"get-location":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-location/get-location.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-location/get-location\n>Template\n```vue\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : 'wgs84' | 'gcj02',\n name : string,\n }\n export default {\n data() {\n return {\n title: 'get-location',\n altitudeSelect: false,\n isHighAccuracySelect: false,\n geocodeSelect: false,\n exeRet: '',\n items: [\n {\n value: 'wgs84',\n name: 'wgs84'\n },\n {\n value: 'gcj02',\n name: 'gcj02'\n }\n ] as ItemType[],\n current: 0,\n }\n },\n methods: {\n altitudeChange: function (e : UniSwitchChangeEvent) {\n this.altitudeSelect = e.detail.value\n },\n geocodeChange: function (e : UniSwitchChangeEvent) {\n this.geocodeSelect = e.detail.value\n },\n highAccuracySelectChange: function (e : UniSwitchChangeEvent) {\n this.isHighAccuracySelect = e.detail.value\n },\n radioChange(e : UniRadioGroupChangeEvent) {\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].value === e.detail.value) {\n this.current = i;\n break;\n }\n }\n },\n getLocationTap: function () {\n uni.showLoading({\n title: '定位中'\n })\n uni.getLocation(({\n type: this.items[this.current].value,\n altitude: this.altitudeSelect,\n isHighAccuracy: this.isHighAccuracySelect,\n geocode: this.geocodeSelect,\n success: (res : any) => {\n uni.hideLoading()\n console.log(res);\n this.exeRet = JSON.stringify(res)\n },\n fail: (res : any) => {\n uni.hideLoading()\n console.log(res);\n this.exeRet = JSON.stringify(res)\n },\n complete: (res : any) => {\n uni.hideLoading()\n console.log(res);\n this.exeRet = JSON.stringify(res)\n }\n }));\n\n\n }\n\n }\n }\n\n```\n:::"},"getStorageInfo":{"name":"## uni.getStorageInfo(options) @getstorageinfo","description":"\nuni.getStorageInfo函数定义\n异步获取当前 storage 的相关信息。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetStorageInfoOptions](#getstorageinfooptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [GetStorageInfoSuccess](#getstorageinfosuccess-values)) => void \\| null | 否 | - | uni.getStorageInfo成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.getStorageInfo失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.getStorageInfo完成回调函数定义 | \n\n##### GetStorageInfoSuccess 的属性值 @getstorageinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| keys | Array\\ | 是 | - | 当前 storage 中所有的 key |\n| currentSize | number | 是 | - | 当前占用的空间大小, 单位:kb |\n| limitSize | number | 是 | - | 限制的空间大小, 单位:kb |\n","returnValue":"","compatibility":"### getStorageInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorageInfo](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfo)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageInfo)\n"},"getStorageInfoSync":{"name":"## uni.getStorageInfoSync() @getstorageinfosync","description":"\nuni.getStorageInfoSync函数定义\n同步获取当前 storage 的相关信息。\n\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetStorageInfoSuccess** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| keys | Array\\ | 是 | - | 当前 storage 中所有的 key |\n@| currentSize | number | 是 | - | 当前占用的空间大小, 单位:kb |\n@| limitSize | number | 是 | - | 限制的空间大小, 单位:kb | \n","compatibility":"### getStorageInfoSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorageInfoSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfosync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageInfoSync)\n"},"getStorage":{"name":"## uni.getStorage(options) @getstorage","description":"\nuni.getStorage函数定义\n从本地存储中异步获取指定 key 对应的内容。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetStorageOptions](#getstorageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| key | string | 是 | - | 本地存储中的指定的 key |\n@| success | (res: [GetStorageSuccess](#getstoragesuccess-values)) => void \\| null | 否 | - | uni.getStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.getStorage失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.getStorage完成回调函数定义 | \n\n##### GetStorageSuccess 的属性值 @getstoragesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any \\| null | 否 | - | key 对应的内容 |\n","returnValue":"","compatibility":"### getStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorage)\n"},"getStorageSync":{"name":"## uni.getStorageSync(key) @getstoragesync","description":"\nuni.getStorageSync函数定义\n从本地存储中同步获取指定 key 对应的内容。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| key | string | 是 | - | 本地存储中的指定的 key | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| any \\| null | 否 |\n \n","compatibility":"### getStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageSync)\n"},"setStorage":{"name":"## uni.setStorage(options) @setstorage","description":"\nuni.setStorage函数定义\n将数据存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。 \n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **SetStorageOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| key | string | 是 | - | 本地存储中的指定的 key |\n@| data | any | 是 | - | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 |\n@| success | (res: SetStorageSuccess) => void \\| null | 否 | - | uni.setStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.setStorage失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.setStorage完成回调函数定义 | \n","returnValue":"","compatibility":"### setStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.setStorage)\n"},"setStorageSync":{"name":"## uni.setStorageSync(key, data) @setstoragesync","description":"\nuni.setStorageSync函数定义\n将 data 存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| key | string | 是 | - | 本地storage存储中的指定的 key |\n| data | any | 是 | - | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 | \n","returnValue":"","compatibility":"### setStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.setStorageSync)\n"},"removeStorage":{"name":"## uni.removeStorage(options) @removestorage","description":"\nuni.removeStorage函数定义\n从本地存储中异步移除指定 key。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RemoveStorageOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| key | string | 是 | - | 本地存储中的指定的 key |\n@| success | (res: RemoveStorageSuccess) => void \\| null | 否 | - | uni.removeStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.removeStorage失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.removeStorage完成回调函数定义 | \n","returnValue":"","compatibility":"### removeStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[removeStorage](hhttps://uniapp.dcloud.net.cn/api/storage/storage.html#removestorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.removeStorage)\n"},"removeStorageSync":{"name":"## uni.removeStorageSync(key) @removestoragesync","description":"\nuni.removeStorageSync函数定义\n从本地存储中同步移除指定 key。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| key | string | 是 | - | 本地存储中的指定的 key | \n","returnValue":"","compatibility":"### removeStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[removeStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.removeStorageSync)\n"},"clearStorage":{"name":"## uni.clearStorage(option?) @clearstorage","description":"\nuni.clearStorage函数定义\n清除本地数据存储。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | **ClearStorageOptions** \\| null | 否 | - | uni.removeStorage参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: ClearStorageSuccess) => void \\| null | 否 | - | uni.clearStorage 成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.clearStorage 失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.clearStorage 完成回调函数定义 | \n","returnValue":"","compatibility":"### clearStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[clearStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.clearStorage)\n"},"clearStorageSync":{"name":"## uni.clearStorageSync() @clearstoragesync","description":"\nuni.clearStorageSync函数定义\n清除本地数据存储。\n","param":"","returnValue":"","compatibility":"### clearStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[clearStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.clearStorageSync)\n"},"storage":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/storage/storage.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/storage/storage\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'get/set/clearStorage',\n key: '',\n data: '' as any,\n apiGetData: '' as any | null,\n storageInfo: '',\n }\n },\n methods: {\n getStorageInfo() {\n uni.getStorageInfo({\n success: (res) => {\n this.apiGetData = res\n this.storageInfo = JSON.stringify(res)\n },\n })\n },\n getStorageInfoSync() {\n try {\n const res = uni.getStorageInfoSync()\n this.apiGetData = res\n this.storageInfo = JSON.stringify(res)\n } catch (e) {\n // error\n console.log(e)\n }\n },\n jsonLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = JSON.stringify({\n name: \"james\",\n age: 12,\n from: \"american\"\n });\n\n },\n longLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = \"1234567890\"\n },\n floatLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = \"321456.1234567890\"\n },\n negativeLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = \"-321456\"\n },\n strMock() {\n this.key = 'key_' + Math.random()\n this.data = '测试字符串数据,长度为16个字符'\n },\n complexMock() {\n this.key = 'key_' + Math.random()\n let jsonObj = {\n name: '张三',\n age: 12,\n classMate: [\n {\n id: 1001,\n name: '李四',\n },\n {\n id: 1002,\n name: 'jack ma',\n },\n ],\n }\n this.data = jsonObj\n },\n numberMock() {\n this.key = 'key_' + Math.random()\n this.data = 10011\n },\n floatMock() {\n this.key = 'key_' + Math.random()\n this.data = 3.1415926535893384626\n },\n\n keyChange: function (e : InputEvent) {\n this.key = e.detail.value\n },\n dataChange: function (e : InputEvent) {\n this.data = e.detail.value\n },\n getStorage: function () {\n var key = this.key\n if (key.length == 0) {\n uni.showModal({\n title: '读取数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n let that = this\n uni.getStorage({\n key: key,\n success: (res) => {\n\n that.apiGetData = res.data\n let desc : string = typeof this.apiGetData\n if (\"object\" == desc) {\n desc = desc + \": \" + JSON.stringify(this.apiGetData)\n } else {\n desc = desc + \": \" + this.apiGetData\n }\n\n uni.showModal({\n title: '读取数据成功',\n content: desc,\n showCancel: false,\n })\n },\n fail: () => {\n uni.showModal({\n title: '读取数据失败',\n content: '找不到 key 对应的数据',\n showCancel: false,\n })\n },\n })\n }\n },\n getStorageSync: function () {\n var key = this.key\n if (key.length == 0) {\n uni.showModal({\n title: '读取数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n this.apiGetData = uni.getStorageSync(key)\n\n let desc : string = typeof this.apiGetData\n if (\"object\" == desc) {\n desc = desc + \": \" + JSON.stringify(this.apiGetData)\n } else {\n desc = desc + \": \" + this.apiGetData\n }\n\n uni.showModal({\n title: '读取数据成功',\n content: desc,\n showCancel: false,\n })\n }\n },\n setStorage: function () {\n var key = this.key\n var data = this.data\n if (key.length == 0) {\n uni.showModal({\n title: '保存数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n uni.setStorage({\n key: key,\n data: data,\n success: () => {\n uni.showModal({\n title: '存储数据成功',\n showCancel: false,\n })\n },\n fail: () => {\n uni.showModal({\n title: '储存数据失败!',\n showCancel: false,\n })\n },\n })\n }\n },\n setStorageSync: function () {\n var key = this.key\n var data = this.data\n if (key.length == 0) {\n uni.showModal({\n title: '保存数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n uni.setStorageSync(key, data)\n uni.showModal({\n title: '存储数据成功',\n showCancel: false,\n })\n }\n },\n removeStorage: function () {\n uni.removeStorage({\n key: this.key,\n success: () => {\n uni.showModal({\n title: '移除数据成功',\n showCancel: false,\n })\n },\n fail: () => {\n uni.showModal({\n title: '移除数据失败',\n showCancel: false,\n })\n },\n })\n },\n removeStorageSync: function () {\n uni.removeStorageSync(this.key)\n uni.showModal({\n title: '移除数据成功',\n showCancel: false,\n })\n },\n clearStorage: function () {\n this.key = ''\n this.data = ''\n uni.clearStorage({\n success: function (_) {\n uni.showModal({\n title: '清除数据成功',\n showCancel: false,\n })\n },\n fail: function (_) {\n uni.showModal({\n title: '清除数据失败',\n showCancel: false,\n })\n },\n })\n },\n clearStorageSync: function () {\n this.key = ''\n this.data = ''\n uni.clearStorageSync()\n uni.showModal({\n title: '清除数据成功',\n content: ' ',\n showCancel: false,\n })\n },\n },\n }\n\n```\n:::"},"getFileSystemManager":{"name":"## uni.getFileSystemManager() @getfilesystemmanager","description":"\n获取文件管理器","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [FileSystemManager](#filesystemmanager-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| close | any | 是 | - | 关闭文件 |\n#### FileSystemManager 的方法 @filesystemmanager-values \n\n#### readFile(options) @readfile\n\n读取本地文件内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadFileOptions](#readfileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| encoding | \"base64\" \\| \"utf-8\" | 是 | - | base64 / utf-8 |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件路径,支持相对地址和绝对地址 |\n@| success | (res: [ReadFileSuccessResult](#readfilesuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 通用的错误返回结果回调 |\n@| complete | (res: any) => void \\| null | 否 | - | 通用的结束返回结果回调 | \n\n##### ReadFileSuccessResult 的属性值 @readfilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | string | 是 | - | - |\n\n\n##### readFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### readFileSync(filePath, encoding?) @readfilesync\n\nFileSystemManager.readFile 的同步版本参数\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| encoding | string \\| null | 否 | - | | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### readFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### writeFile(options) @writefile\n\n写文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [WriteFileOptions](#writefileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件路径,只支持绝对地址 |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| data | string | 是 | - | 写入的文本内容 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 通用的正确返回结果回调 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### FileManagerSuccessResult 的属性值 @filemanagersuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n\n##### writeFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### writeFileSync(filePath, data, encoding) @writefilesync\n\nFileSystemManager.writeFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| data | string | 是 | - | - |\n| encoding | string | 是 | - | - | \n\n\n##### writeFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### unlink(options) @unlink\n\n删除文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **UnLinkOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件路径,只支持绝对地址 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### unlink 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### unlinkSync(filePath) @unlinksync\n\nFileSystemManager.unlink 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - | \n\n\n##### unlinkSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### mkdir(options) @mkdir\n\n创建目录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **MkDirOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 创建的目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### mkdir 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### mkdirSync(dirPath, recursive) @mkdirsync\n\nFileSystemManager.mkdir 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| dirPath | string | 是 | - | - |\n| recursive | boolean | 是 | - | - | \n\n\n##### mkdirSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### rmdir(options) @rmdir\n\n删除目录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RmDirOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要删除的目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### rmdir 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### rmdirSync(dirPath, recursive) @rmdirsync\n\nFileSystemManager.rmdir 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| dirPath | string | 是 | - | - |\n| recursive | boolean | 是 | - | - | \n\n\n##### rmdirSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readdir(options) @readdir\n\n读取目录内文件列表\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadDirOptions](#readdiroptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的目录路径 (本地路径) |\n@| success | (res: [ReadDirSuccessResult](#readdirsuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ReadDirSuccessResult 的属性值 @readdirsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| files | Array\\ | 是 | - | - |\n\n\n##### readdir 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### readdirSync(dirPath) @readdirsync\n\nFileSystemManager.readdir 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| dirPath | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Array\\ \\| null | 否 |\n \n\n##### readdirSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### access(options) @access\n\n判断文件/目录是否存在\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **AccessOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要删除的目录路径 (本地路径) |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### access 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### accessSync(path) @accesssync\n\nFileSystemManager.access 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 是 | - | - | \n\n\n##### accessSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### rename(options) @rename\n\n重命名文件。可以把文件从 oldPath 移动到 newPath\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RenameOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| oldPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 源文件路径,支持本地路径 |\n@| newPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 新文件路径,支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### rename 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### renameSync(oldPath, newPath) @renamesync\n\nFileSystemManager.rename 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| oldPath | string | 是 | - | - |\n| newPath | string | 是 | - | - | \n\n\n##### renameSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### copyFile(options) @copyfile\n\n复制文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CopyFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| srcPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 源文件路径,支持本地路径 |\n@| destPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 新文件路径,支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### copyFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### copyFileSync(srcPath, destPath) @copyfilesync\n\nFileSystemManager.copyFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| srcPath | string | 是 | - | - |\n| destPath | string | 是 | - | - | \n\n\n##### copyFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### getFileInfo(options) @getfileinfo\n\n获取该本地临时文件 或 本地缓存文件 信息\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetFileInfoOptions](#getfileinfooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的文件路径 (本地路径) |\n@| digestAlgorithm | \"md5\" \\| \"sha1\" | 是 | - | md5 / sha1 |\n@| success | (res: [GetFileInfoSuccessResult](#getfileinfosuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetFileInfoSuccessResult 的属性值 @getfileinfosuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| digest | string | 是 | - | - |\n| size | number | 是 | - | - |\n| errMsg | string | 是 | - | - |\n\n\n##### getFileInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### stat(options) @stat\n\n获取文件 Stats 对象\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [StatOptions](#statoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件/目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | 是否递归获取目录下的每个文件的 Stats 信息 |\n@| success | (res: [StatSuccessResult](#statsuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### StatSuccessResult 的属性值 @statsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n| stats | Array\\<[FileStats](#filestats-values)\\> | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | string | 是 | - | - |\n@| stats | [Stats](#stats-values) | 是 | - | - |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| mode | number | 是 | - | 文件的类型和存取的权限,对应 POSIX stat.st_mode 注意android中,文件类型只包含是否是目录与文件, 另外在android中这里的权限指的是当前进程对文件或者文件夹是否有读,写,执行的权限, 这里没有与 POSIX stat.st_mode对应的组,其他人等相关权限的数据返回,只有所有者的相关权限 |\n@@| size | number | 是 | - | 文件大小,单位:B,对应 POSIX stat.st_size |\n@@| lastAccessedTime | number | 是 | - | 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime 注意:android中由于系统限制无法获取该数据 |\n@@| lastModifiedTime | number | 是 | - | 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime |\n\n##### Stats 的方法 @stats-values \n\n##### isDirectory() @isdirectory\n\n判断当前文件是否一个目录\n\n###### 返回值 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n\n\n##### isFile() @isfile\n\n判断当前文件是否一个普通文件\n\n###### 返回值 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n\n\n\n##### stat 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### statSync(path, recursive) @statsync\n\nFileSystemManager.stat 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 是 | - | - |\n| recursive | boolean | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Array\\<[FileStats](#filestats-values)\\> |\n \n\n##### statSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### appendFile(options) @appendfile\n\n在文件结尾追加内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **AppendFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要追加内容的文件路径 (本地路径) |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| data | string | 是 | - | 要追加的文本 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### appendFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### appendFileSync(filePath, data, encoding) @appendfilesync\n\nFileSystemManager.appendFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| data | string | 是 | - | - |\n| encoding | string | 是 | - | - | \n\n\n##### appendFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### saveFile(options) @savefile\n\n保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SaveFileOptions](#savefileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| tempFilePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 临时存储文件路径 (本地路径) |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) \\| null | 否 | - | 要存储的文件路径 (本地路径) |\n@| success | (res: [SaveFileSuccessResult](#savefilesuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SaveFileSuccessResult 的属性值 @savefilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| savedFilePath | string | 是 | - | 存储后的文件路径 (本地路径) |\n\n\n##### saveFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### saveFileSync(tempFilePath, filePath?) @savefilesync\n\nFileSystemManager.saveFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tempFilePath | string | 是 | - | - |\n| filePath | string \\| null | 否 | - | | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### saveFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### removeSavedFile(options) @removesavedfile\n\n删除该小程序下已保存的本地缓存文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RemoveSavedFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 需要删除的文件路径 (本地路径) |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### removeSavedFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### unzip(options) @unzip\n\n解压文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **UnzipFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| zipFilePath | string | 是 | - | 源文件路径,支持本地路径, 只可以是 zip 压缩文件 |\n@| targetPath | string | 是 | - | 目标目录路径, 支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### unzip 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### getSavedFileList(options) @getsavedfilelist\n\n获取该已保存的本地缓存文件列表\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetSavedFileListOptions](#getsavedfilelistoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [GetSavedFileListResult](#getsavedfilelistresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetSavedFileListResult 的属性值 @getsavedfilelistresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fileList | Array\\ | 是 | - | - |\n\n\n##### getSavedFileList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### truncate(options) @truncate\n\n对文件内容进行截断操作\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **TruncateFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要截断的文件路径 (本地路径) |\n@| length | number | 是 | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除; 如果 length 大于文件长度,不做处理 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### truncate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### truncateSync(filePath, length?) @truncatesync\n\n对文件内容进行截断操作 (truncate 的同步版本)\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| length | number | 否 | - | - | \n\n\n##### truncateSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readCompressedFile(options) @readcompressedfile\n\n读取指定压缩类型的本地文件内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadCompressedFileOptions](#readcompressedfileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的文件的路径 (本地用户文件或代码包文件) |\n@| compressionAlgorithm | string | 是 | - | 文件压缩类型,目前仅支持 'br'。 |\n@| success | (res: [ReadCompressedFileResult](#readcompressedfileresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ReadCompressedFileResult 的属性值 @readcompressedfileresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | string | 是 | - | - |\n\n\n##### readCompressedFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readCompressedFileSync(filePath, compressionAlgorithm) @readcompressedfilesync\n\n同步读取指定压缩类型的本地文件内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| compressionAlgorithm | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### readCompressedFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### open(options) @open\n\n打开文件,返回文件描述符\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [OpenFileOptions](#openfileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要追加内容的文件路径 (本地路径) |\n@| flag | \"a\" \\| \"ax\" \\| \"a+\" \\| \"ax+\" \\| \"r\" \\| \"r+\" \\| \"w\" \\| \"wx\" \\| \"w+\" \\| \"wx\" \\| \"wx+\" | 是 | - | 文件系统标志,默认值: 'r' |\n@| success | (res: [OpenFileSuccessResult](#openfilesuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### OpenFileSuccessResult 的属性值 @openfilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fd | string | 是 | - | - |\n\n\n##### open 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### openSync(options) @opensync\n\n同步打开文件,返回文件描述符\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **OpenFileSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要追加内容的文件路径 (本地路径) |\n@| flag | \"a\" \\| \"ax\" \\| \"a+\" \\| \"ax+\" \\| \"r\" \\| \"r+\" \\| \"w\" \\| \"wx\" \\| \"w+\" \\| \"wx\" \\| \"wx+\" | 是 | - | 文件系统标志,默认值: 'r' | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### openSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### write(options) @write\n\n写入文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [WriteOptions](#writeoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| data | string | 是 | - | 写入的内容 |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| success | (res: [WriteResult](#writeresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### WriteResult 的属性值 @writeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| bytesWritten | number | 是 | - | 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) |\n\n\n##### write 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### writeSync(options) @writesync\n\n同步写入文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **WriteSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| data | string | 是 | - | 写入的内容 |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [WriteResult](#writeresult-values) |\n \n\n##### writeSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### closeSync(options) @closesync\n\n同步关闭文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CloseSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 | \n\n\n##### closeSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### fstat(options) @fstat\n\n获取文件的状态信息\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [FStatOptions](#fstatoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| success | (res: [FStatSuccessResult](#fstatsuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### FStatSuccessResult 的属性值 @fstatsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| stats | [Stats](#stats-values) | 是 | - | Stats 对象,包含了文件的状态信息 |\n\n\n##### fstat 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### fstatSync(options) @fstatsync\n\n同步获取文件的状态信息\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **FStatSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [Stats](#stats-values) |\n \n\n##### fstatSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### ftruncate(options) @ftruncate\n\n对文件内容进行截断操作\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **FTruncateFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 是 | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除; 如果 length 大于文件长度,不做处理 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### ftruncate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### ftruncateSync(options) @ftruncatesync\n\n同步对文件内容进行截断操作\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **FTruncateFileSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 是 | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除; 如果 length 大于文件长度,不做处理 | \n\n\n##### ftruncateSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readZipEntry(options) @readzipentry\n\n读取压缩包内的文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadZipEntryOptions](#readzipentryoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的压缩包的路径 (本地路径) |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 统一指定读取文件的字符编码,只在 entries 值为\"all\"时有效。
如果 entries 值为\"all\"且不传 encoding,则以 string 格式读取文件的内容 |\n@| entries | Array\\<**EntryItem**\\> \\| null | 否 | - | 要读取的压缩包内的文件列表(当不传入时表示读取压缩包内所有文件) |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| path | string | 是 | - | 压缩包内文件路径 |\n@@| encoding | \"ascii\" \\| \"base64\" \\| \"base64\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| success | (res: [EntriesResult](#entriesresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### EntriesResult 的属性值 @entriesresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| result | Map\\ | 是 | - | 文件路径 |\n\n\n##### readZipEntry 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n##### FileSystemManager 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| close | 4.13 | x | x |\n \n","compatibility":"### getFileSystemManager 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.file.filemanager.getFileSystemManager)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-file-system-manager/get-file-system-manager.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"getUniverifyManager":{"name":"## uni.getUniverifyManager() @getuniverifymanager","description":"获取一键登录管理对象","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [UniverifyManager](#univerifymanager-values) |\n\n#### UniverifyManager 的方法 @univerifymanager-values \n\n#### preLogin(options) @prelogin\n预登录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [PreLoginOptions](#preloginoptions-values) | 是 | - | 预登录参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | () => void | 否 | - | - |\n@| fail | (err: [PreLoginFail](#preloginfail-values)) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### PreLoginFail 的属性值 @preloginfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1000 \\| 1001 \\| 1002 \\| 1004 \\| 4001 \\| 30004 \\| 30005 \\| 30006 | 是 | - | 1000 当前应用appid尚未开通uni一键登录
1001 应用所有者账号信息异常,请检查账号一键登录服务是否正常
1002 应用所有者账号信息异常,请检查账号余额是否充足
1004 uni一键登录应用不存在
4001 参数异常
30004 其他错误
30005 预登录失败
30006 一键登录失败 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n##### preLogin 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n\n#### login(options) @login\n登录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [LoginOptions](#loginoptions-values) | 是 | - | 登录参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| univerifyStyle | **UniverifyStyle** | 否 | - | 登录页样式 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| fullScreen | boolean | 否 | - | 是否全屏 |\n@@| logoPath | string | 否 | - | logo路径 |\n@@| backgroundColor | string | 否 | - | 登录页背景色 |\n@@| loginBtnText | string | 否 | - | 登录按钮文字 |\n@| success | (res: [LoginSuccess](#loginsuccess-values)) => void | 否 | - | - |\n@| fail | (err: [LoginFail](#loginfail-values)) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### LoginSuccess 的属性值 @loginsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| openId | string | 是 | - | 登录授权唯一标识 |\n| accessToken | string | 是 | - | token |\n\n##### LoginFail 的属性值 @loginfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1000 \\| 1001 \\| 1002 \\| 1004 \\| 4001 \\| 30004 \\| 30005 \\| 30006 | 是 | - | 1000 当前应用appid尚未开通uni一键登录
1001 应用所有者账号信息异常,请检查账号一键登录服务是否正常
1002 应用所有者账号信息异常,请检查账号余额是否充足
1004 uni一键登录应用不存在
4001 参数异常
30004 其他错误
30005 预登录失败
30006 一键登录失败 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n##### login 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n\n#### close() @close\n关闭登录页\n\n\n##### close 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n\n#### isPreLoginValid() @ispreloginvalid\n预登录是否有效\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n##### isPreLoginValid 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n \n","compatibility":"### getUniverifyManager 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n","tutorial":"\n### 参见\n[getUniverifyManager](https://uniapp.dcloud.net.cn/univerify.html#univerifymanager)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.login_verify.univerify.getUniverifyManager)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-univerify-manager/get-univerify-manager.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"getFacialRecognitionMetaInfo":{"name":"## uni.getFacialRecognitionMetaInfo() @getfacialrecognitionmetainfo","description":"获取阿里云实人认证meta info","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n","compatibility":"### getFacialRecognitionMetaInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.login_verify.facial-recognition-verify.getFacialRecognitionMetaInfo)\n"},"startFacialRecognitionVerify":{"name":"## uni.startFacialRecognitionVerify(faceStyle) @startfacialrecognitionverify","description":"启动人脸识别","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| faceStyle | [StartFacialRecognitionVerifyOptions](#startfacialrecognitionverifyoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| certifyId | string | 是 | - | certifyId 调用实人认证的id |\n@| progressBarColor | string \\| null | 否 | - | 活体检测页面的进度条颜色。 |\n@| screenOrientation | \"land\" \\| \"port\" | 否 | \"port\" | 认证时屏幕方向
- land 横屏
- port 竖屏 |\n@| success | (res: [StartFacialRecognitionVerifySuccess](#startfacialrecognitionverifysuccess-values)) => void \\| null | 否 | - | 成功回调 |\n@| fail | (res: [IFacialRecognitionVerifyError](#ifacialrecognitionverifyerror-values)) => void \\| null | 否 | - | 失败回调 |\n@| complete | (res: any) => void \\| null | 否 | - | 完成回调 | \n\n##### StartFacialRecognitionVerifySuccess 的属性值 @startfacialrecognitionverifysuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 |\n| errSubject | string | 是 | - | 调用API的名称 |\n| errMsg | string | 是 | - | 错误的详细信息 |\n| cause | **SourceError** | 否 | - | 错误来源 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| subject | string \\| null | 否 | - | 源错误模块名称 |\n@| message | string | 是 | - | 源错误描述信息 |\n@| code | number | 是 | - | 源错误的错误码 |\n@| name | string | 是 | - | - |\n@| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | |\n\n##### IFacialRecognitionVerifyError 的属性值 @ifacialrecognitionverifyerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 10010 \\| 10012 \\| 10011 \\| 10013 \\| 10020 \\| 10001 \\| 10002 | 是 | - | 错误码
- 10001 certifyId 不能为空
- 10002 \"当前设备不支持\"
- 10010 刷脸异常
- 10012 网络异常
- 10011 验证中断
- 10013 刷脸验证失败
- 10020 设备设置时间异常 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### StartFacialRecognitionVerifyOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| screenOrientation | 3.9 | 4.11 | - |\n","returnValue":"","compatibility":"### startFacialRecognitionVerify 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.login_verify.facial-recognition-verify.startFacialRecognitionVerify)\n"},"facial-recognition-verify":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/facial-recognition-verify/facial-recognition-verify.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"createRewardedVideoAd":{"name":"## uni.createRewardedVideoAd(option) @createrewardedvideoad","description":"创建激励视频广告对象","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | **CreateRewardedVideoAdOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| adpid | string | 是 | - | 广告位 id |\n@| urlCallback | **UrlCallbackOptions** \\| null | 否 | - | 服务器回调透传参数 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| userId | string \\| null | 否 | - | 透传到服务器端的userId |\n@@| extra | string \\| null | 否 | - | 透传到服务器端的extra,不推荐设置过于复杂的字符串 | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [RewardedVideoAd](#rewardedvideoad-values) |\n\n#### RewardedVideoAd 的方法 @rewardedvideoad-values \n\n#### show() @show\n\n广告加载成功之后,调用此方法展示广告\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Promise\\ |\n \n\n\n\n#### load() @load\n\n加载广告\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Promise\\ |\n \n\n\n\n#### destroy() @destroy\n\n销毁广告\n\n\n\n\n#### onLoad(callback) @onload\n\n绑定广告 load 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n\n\n\n#### offLoad(callback) @offload\n\n解除绑定 load 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n\n\n\n#### onError(callback) @onerror\n\n绑定 error 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | \n\n##### IUniAdError 的属性值 @iuniaderror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 - -5001 广告位标识adpid为空,请传入有效的adpid - -5002 无效的广告位标识adpid,请使用正确的adpid - -5003 广告位未开通广告,请在广告平台申请并确保已审核通过 - -5004 无广告模块,打包时请配置要使用的广告模块 - -5005 广告加载失败,请稍后重试 - -5006 广告已经展示过了,请重新加载 - -5007 广告不可用或已过期,请重新请求 - -5008 广告不可用或已过期,请重新请求 - -5009 广告类型不符,请检查后再试 - -5011 打包或开通的渠道,不支持此类型广告 - -5013 广告播放失败,请重新加载 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n\n\n#### offError(callback) @offerror\n\n解除绑定 error 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | \n\n\n\n\n#### onClose(callback) @onclose\n\n绑定 close 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [VideoAdClose](#videoadclose-values)) => void | 是 | - | - | \n\n##### VideoAdClose 的属性值 @videoadclose-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| isEnded | boolean | 是 | - | true标识广告播放完毕或者达到发放奖励的条件 |\n\n\n\n\n#### offClose(callback) @offclose\n\n解除绑定 close 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [VideoAdClose](#videoadclose-values)) => void | 是 | - | - | \n\n\n\n\n#### onAdClicked(callback) @onadclicked\n\n绑定广告可点击屏幕区域事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n\n\n\n#### onVerify(callback) @onverify\n\n绑定 verify 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md)) => void | 是 | - | - | \n\n\n\n \n","compatibility":"### createRewardedVideoAd 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.0 | - | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ad.createRewardedVideoAd)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/rewarded-video-ad/rewarded-video-ad.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"requestPayment":{"name":"## uni.requestPayment(options) @requestpayment","description":"请求支付","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [RequestPaymentOptions](#requestpaymentoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| provider | string | 是 | - | 支付服务提供商,通过 [uni.getProvider](https://doc.dcloud.net.cn/uni-app-x/api/get-provider.html) 获取,目前支持支付宝支付(alipay),微信支付(wxpay) |\n@| orderInfo | string | 是 | - | 订单数据 |\n@| success | (result: [RequestPaymentSuccess](#requestpaymentsuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [IRequestPaymentFail](#irequestpaymentfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### RequestPaymentSuccess 的属性值 @requestpaymentsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any \\| null | 否 | - | |\n\n##### IRequestPaymentFail 的属性值 @irequestpaymentfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 700710 \\| 700711 \\| 700712 \\| 700713 \\| 700714 \\| 700715 \\| 700716 | 是 | - | 错误码
- 700710 正在处理中,支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态
- 700711 订单支付失败。
- 700712 重复请求。
- 700713 用户中途取消。
- 700714 网络连接出错。
- 700715 支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。
- 700716 其它支付错误。 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### requestPayment 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.02 | x | x |\n","tutorial":"\n### 参见\n[requestPayment](https://uniapp.dcloud.net.cn/api/plugins/payment.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.payment.requestPayment)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/request-payment/request-payment.uvue) \n ```uvue\n\r\n\r\n\r\n\r\n\n\n```"},"createWebviewContext":{"name":"## uni.createWebviewContext(webviewId, component?) @createwebviewcontext","description":"创建 web-view 组件的上下文对象,用于操作 web-view 的行为。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| webviewId | [string.WebviewIdString](/uts/data-type.md#ide-string) | 是 | - | - |\n| component | ComponentPublicInstance \\| null | 否 | - | | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [WebviewContext](#webviewcontext-values) \\| null | 否 |\n\n#### WebviewContext 的方法 @webviewcontext-values \n\n#### back() @back\n后退到 web-view 组件网页加载历史的上一页,如果不存在上一页则没有任何效果。\n\n\n##### back 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### forward() @forward\n前进到 web-view 组件网页加载历史的下一页,如果不存在下一页则没有任何效果。\n\n\n##### forward 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### reload() @reload\n重新加载 web-view 组件当前页面。\n\n\n##### reload 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### stop() @stop\n停止加载 web-view 组件当前网页,该方法不能阻止已经加载的 html 文档,但是能够阻止未完成的图片及延迟加载的资源。\n\n\n##### stop 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### evalJS(js) @evaljs\n在网页中执行指定的js脚本,在 uvue 页面中可通过此方法向 web-view 组件加载的页面发送数据\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| js | string | 是 | - | - | \n\n\n##### evalJS 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n \n","compatibility":"### createWebviewContext 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.create-webview-context)\n"},"createVideoContext":{"name":"## uni.createVideoContext(videoId, component?) @createvideocontext","description":"创建并返回 video 上下文 videoContext 对象","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| videoId | [string.VideoIdString](/uts/data-type.md#ide-string) | 是 | - | - |\n| component | ComponentPublicInstance \\| null | 否 | - | | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [VideoContext](#videocontext-values) \\| null | 否 |\n\n#### VideoContext 的方法 @videocontext-values \n\n#### play() @play\n播放\n\n\n##### play 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### pause() @pause\n暂停\n\n\n##### pause 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### seek(position) @seek\n跳转到指定位置\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| position | number | 是 | - | 跳转到指定位置(秒) | \n\n\n##### seek 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### stop() @stop\n停止视频\n\n\n##### stop 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### sendDanmu(danmu) @senddanmu\n发送弹幕\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| danmu | **Danmu** | 是 | - | text, color |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| text | string \\| null | 否 | - | 弹幕文字 |\n@| color | string \\| null | 否 | - | 弹幕颜色 |\n@| time | number \\| null | 否 | - | 显示时刻 | \n\n\n##### sendDanmu 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### playbackRate(rate) @playbackrate\n设置倍速播放\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| rate | number | 是 | - | , 支持倍率 0.5/0.8/1.0/1.25/1.5 | \n\n\n##### playbackRate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### requestFullScreen(direction?) @requestfullscreen\n进入全屏\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| direction | [RequestFullScreenOptions](#requestfullscreenoptions-values) | 否 | - | , 0\\|正常竖向, 90\\|屏幕逆时针90度, -90\\|屏幕顺时针90度 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| direction | number \\| null | 否 | - | direction
- 0: 正常竖向
- 90: 屏幕逆时针90度
- -90: 屏幕顺时针90度 | \n\n###### RequestFullScreenOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| direction | 3.9.0 | 4.11 | x |\n\n\n##### requestFullScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### exitFullScreen() @exitfullscreen\n退出全屏\n\n\n##### exitFullScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n \n","compatibility":"### createVideoContext 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[createVideoContext](http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.create-video-context)\n"},"getProvider":{"name":"## uni.getProvider(options) @getprovider","description":"\n获取服务供应商","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetProviderOptions](#getprovideroptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| service | \"oauth\" \\| \"share\" \\| \"payment\" \\| \"push\" \\| \"location\" | 是 | - | 服务类型,可取值“oauth”、“share”、“payment”、“push”、“location”
- oauth: 授权登录
- share: 分享
- payment: 支付
- push: 推送
- location: 定位 |\n@| success | (result: [GetProviderSuccess](#getprovidersuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetProviderSuccess 的属性值 @getprovidersuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| service | \"oauth\" \\| \"share\" \\| \"payment\" \\| \"push\" \\| \"location\" | 是 | - | 服务类型
- oauth: 授权登录
- share: 分享
- payment: 支付
- push: 推送
- location: 定位 |\n| provider | Array\\ | 是 | - | 得到的服务供应商 |\n| errMsg | string | 是 | - | 描述信息 |\n","returnValue":"","compatibility":"### getProvider 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.11 | x | 4.05 |\n","tutorial":"\n### 参见\n[getProvider](https://doc.dcloud.net.cn/uni-app-x/api/get-provider.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.tripartite.get-provider)\n"},"get-provider":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-provider/get-provider.uvue) \n ```uvue\n\r\n\r\n\r\n\r\n\n\n```"},"general_type":{"name":"## 通用类型\n","param":"### GeneralCallbackResult \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 错误信息 |\n"}} \ No newline at end of file +{"getApp":{"name":"## getApp() @getapp","description":"\n`getApp()` 函数用于获取当前应用实例,可通过应用实例调用 App.uvue methods 中定义的方法。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| any |\n \n","compatibility":"","tutorial":"\n### 参见\n[getApp](https://uniapp.dcloud.net.cn/tutorial/page.html#getapp)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.global.get-app)\n"},"get-app":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-app/get-app.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-app/get-app\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { state, setLifeCycleNum } from '@/store/index.uts'\r\n\r\n type MyGlobalData = {\r\n str : string,\r\n num : number,\r\n bool : boolean,\r\n obj : UTSJSONObject,\r\n null : string | null,\r\n arr : number[],\r\n mySet : string[],\r\n myMap : UTSJSONObject,\r\n func : () => string\r\n }\r\n\r\n export default {\r\n data() {\r\n return {\r\n originGlobalData: {\r\n str: '',\r\n num: 0,\r\n bool: false,\r\n obj: {\r\n str: '',\r\n num: 0,\r\n bool: false\r\n } as UTSJSONObject,\r\n null: null,\r\n arr: [] as number[],\r\n mySet: [] as string[],\r\n myMap: {},\r\n func: () : string => ''\r\n } as MyGlobalData,\r\n originGlobalDataFuncRes: '',\r\n newGlobalData: {\r\n str: '',\r\n num: 0,\r\n bool: false,\r\n obj: {\r\n str: '',\r\n num: 0,\r\n bool: false\r\n } as UTSJSONObject,\r\n null: null,\r\n arr: [] as number[],\r\n mySet: [] as string[],\r\n myMap: {},\r\n func: () : string => ''\r\n } as MyGlobalData,\r\n newGlobalDataFuncRes: '',\r\n lifeCycleNum: 0,\r\n }\r\n },\r\n onReady() {\r\n this.lifeCycleNum = state.lifeCycleNum\r\n },\r\n methods: {\r\n getGlobalData() {\r\n const app = getApp()\r\n\r\n this.originGlobalData.str = app.globalData.str\r\n this.originGlobalData.num = app.globalData.num\r\n this.originGlobalData.bool = app.globalData.bool\r\n this.originGlobalData.obj = app.globalData.obj\r\n this.originGlobalData.null = app.globalData.null\r\n this.originGlobalData.arr = app.globalData.arr\r\n app.globalData.mySet.forEach((value : string) => {\r\n this.originGlobalData.mySet.push(value)\r\n })\r\n app.globalData.myMap.forEach((value : any, key : string) => {\r\n this.originGlobalData.myMap[key] = value\r\n })\r\n this.originGlobalData.func = app.globalData.func\r\n this.originGlobalDataFuncRes = this.originGlobalData.func()\r\n },\r\n setGlobalData() {\r\n const app = getApp()\r\n\r\n app.globalData.str = 'new globalData str'\r\n app.globalData.num = 100\r\n app.globalData.bool = true\r\n app.globalData.obj = {\r\n str: 'new globalData obj str',\r\n num: 200,\r\n bool: true\r\n }\r\n app.globalData.null = 'not null'\r\n app.globalData.arr = [1, 2, 3]\r\n app.globalData.mySet = new Set(['a', 'b', 'c'])\r\n app.globalData.myMap = new Map([\r\n ['a', 1],\r\n ['b', 2],\r\n ['c', 3]\r\n ])\r\n app.globalData.func = () : string => {\r\n return 'new globalData func'\r\n }\r\n\r\n this.newGlobalData.str = app.globalData.str\r\n this.newGlobalData.num = app.globalData.num\r\n this.newGlobalData.bool = app.globalData.bool\r\n this.newGlobalData.obj = app.globalData.obj\r\n this.newGlobalData.null = app.globalData.null\r\n this.newGlobalData.arr = app.globalData.arr\r\n app.globalData.mySet.forEach((value : string) => {\r\n this.newGlobalData.mySet.push(value)\r\n })\r\n app.globalData.myMap.forEach((value : any, key : string) => {\r\n this.newGlobalData.myMap[key] = value\r\n })\r\n this.newGlobalData.func = app.globalData.func\r\n this.newGlobalDataFuncRes = this.newGlobalData.func()\r\n },\r\n _increasetLifeCycleNum: function () {\r\n const app = getApp()\r\n app.increasetLifeCycleNum()\r\n this.lifeCycleNum = state.lifeCycleNum\r\n },\r\n // 自动化测试\r\n setLifeCycleNum(num : number) {\r\n setLifeCycleNum(num)\r\n }\r\n },\r\n }\r\n\n```\n:::"},"getCurrentPages":{"name":"## getCurrentPages() @getcurrentpages","description":"\n`getCurrentPages()` 函数用于获取当前页面栈的实例,以数组形式按栈的顺序给出,数组中的元素为页面实例,第一个元素为首页,最后一个元素为当前页面。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| Array\\<[Page](#page-values)\\> |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| route | string | 是 | - | 页面的路由地址 |\n@| options | Map\\ | 是 | - | 页面的路由参数信息,目前web端options类型为Object,后续可能会调整 |\n#### Page 的方法 @page-values \n\n#### $getPageStyle() @$getpagestyle\n\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) |\n \n\n##### $getPageStyle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 参见\n[$getPageStyle](https://doc.dcloud.net.cn/uni-app-x/api/get-current-pages.html#getPageStyle)\n\n#### $setPageStyle(style) @$setpagestyle\n\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| style | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) | 是 | - | 如果属性名存在,且类型为UTSJSONObject返回对应的结果,不存在返回null | \n\n\n##### $setPageStyle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 参见\n[$setPageStyle](https://doc.dcloud.net.cn/uni-app-x/api/get-current-pages.html#setPageStyle)\n \n","compatibility":"","tutorial":"\n### 参见\n[getCurrentPages](https://uniapp.dcloud.net.cn/tutorial/page.html#getcurrentpages)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.global.get-current-pages)\n"},"get-current-pages":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-current-pages/get-current-pages.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-current-pages/get-current-pages\n>Template\n```vue\n\r\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n class Page {\r\n constructor(public route : string) {\r\n }\r\n }\r\n\r\n export default {\r\n data() {\r\n return {\r\n checked: false,\r\n pages: [] as Page[],\r\n currentPageStyle: {} as UTSJSONObject\r\n }\r\n },\r\n computed: {\r\n pageStyleText() : string {\r\n return JSON.stringify(this.currentPageStyle)\r\n }\r\n },\r\n onPullDownRefresh() {\r\n setTimeout(() => {\r\n uni.stopPullDownRefresh()\r\n }, 3000)\r\n },\r\n methods: {\r\n _getCurrentPages: function () {\r\n this.pages.length = 0\r\n const pages = getCurrentPages()\r\n this.pages.push(new Page(pages[0].route))\r\n if (this.pages[0].route.includes('/tabBar/')) {\r\n this.checked = true\r\n }\r\n for (let i = 1; i < pages.length; i++) {\r\n this.pages.push(new Page(pages[i].route))\r\n if (pages[i].route.includes('/tabBar/')) {\r\n this.checked = false\r\n }\r\n }\r\n },\r\n getPageStyle() {\r\n const pages = getCurrentPages();\r\n const currentPage = pages[pages.length - 1];\r\n this.currentPageStyle = currentPage.$getPageStyle();\r\n },\r\n setPageStyle(epr : boolean) {\r\n // 目前仅支持 enablePullDownRefresh\r\n const pages = getCurrentPages();\r\n const currentPage = pages[pages.length - 1];\r\n currentPage.$setPageStyle({\r\n enablePullDownRefresh: epr\r\n });\r\n },\r\n // getCurrentPage(): Page {\r\n // const pages = getCurrentPages();\r\n // const currentPage = pages[pages.length - 1];\r\n // return currentPage;\r\n // }\r\n },\r\n }\r\n\n```\n:::"},"$on":{"name":"## uni.$on(eventName, callback) @$on","description":"\n监听自定义事件。事件可以由 uni.$emit 触发。回调函数会接收 uni.$emit 传递的参数。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| callback | () => void | 是 | - | - | \n","returnValue":"","compatibility":"### $on 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$on](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#on)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$on)\n"},"$once":{"name":"## uni.$once(eventName, callback) @$once","description":"\n监听一个自定义事件。事件只触发一次,在第一次触发之后移除事件监听器。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| callback | () => void | 是 | - | - | \n","returnValue":"","compatibility":"### $once 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$once](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#once)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$once)\n"},"$off":{"name":"## uni.$off(eventName, callback?) @$off","description":"\n移除自定义事件监听器。如果提供了事件名和回调,则只移除这个回调的监听器。\n4.13+ 开始支持第二个参数为可选,如果仅提供事件名,则移除该事件的所有监听器。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| callback | () => void \\| null | 否 | - | | \n","returnValue":"","compatibility":"### $off 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$off](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#off)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$off)\n"},"$emit":{"name":"## uni.$emit(eventName, args?) @$emit","description":"\n触发自定义事件,附加的参数会传递给事件监听器。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| eventName | string | 是 | - | - |\n| args | any \\| null | 否 | - | | \n","returnValue":"","compatibility":"### $emit 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[$emit](https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#emit)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.event-bus.$emit)\n"},"event-bus":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/event-bus/event-bus.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/event-bus/event-bus\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n log: [] as string[],\r\n }\r\n },\r\n methods: {\r\n fn(res : string) {\r\n this.log.push(res)\r\n },\n fn2(res : string) {\n this.log.push(res)\n },\r\n on() {\r\n uni.$on('test', this.fn)\r\n },\n on2() {\n uni.$on('test', this.fn2)\n },\r\n once() {\r\n uni.$once('test', this.fn)\r\n },\r\n off() {\r\n uni.$off('test', this.fn)\r\n },\n offAll() {\n // TODO 第二个参数为可选,后续优化后可不传递\n //uni.$off('test', null)\n },\r\n emit() {\r\n uni.$emit('test', 'msg:' + Date.now())\r\n },\r\n clear() {\r\n this.log.length = 0\r\n },\r\n },\r\n }\r\n\n```\n:::"},"addInterceptor":{"name":"## uni.addInterceptor(name, interceptor) @addinterceptor","description":"\n添加拦截器","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string | 是 | - | 需要拦截的 API 名称 |\n| interceptor | Interceptor | 是 | - | 拦截器 | \n","returnValue":"","compatibility":"### addInterceptor 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.97 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.interceptor.addInterceptor)\n"},"removeInterceptor":{"name":"## uni.removeInterceptor(name, interceptor?) @removeinterceptor","description":"\n删除拦截器","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string | 是 | - | 需要删除拦截器的 API 名称 |\n| interceptor | Interceptor \\| null | 否 | - | 拦截器 | \n","returnValue":"","compatibility":"### removeInterceptor 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.97 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.interceptor.removeInterceptor)\n"},"interceptor":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/interceptor/interceptor.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/interceptor/interceptor\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n const interceptor = {\r\n invoke: function (options : NavigateToOptions) {\r\n console.log('拦截 navigateTo 接口传入参数为:', options)\r\n const url = './page2'\r\n uni.showToast({\r\n title: `重定向到页面:${url}`\r\n })\r\n options.url = url\r\n },\r\n success: function (res : NavigateBackSuccess) {\r\n console.log('拦截 navigateTo 接口 success 返回参数为:', res)\r\n },\r\n fail: function (err : NavigateToFail) {\r\n console.log('拦截 navigateTo 接口 fail 返回参数为:', err)\r\n },\r\n complete: function (res : NavigateToComplete) {\r\n console.log('拦截 navigateTo 接口 complete 返回参数为:', res)\r\n }\r\n } as Interceptor\r\n export default {\r\n data() {\r\n return {\r\n msg: \"会跳转到测试页面1\"\r\n }\r\n },\r\n beforeUnmount() {\r\n // 移除 navigateTo 所有拦截器\r\n uni.removeInterceptor('navigateTo')\r\n },\r\n methods: {\r\n addInterceptor() {\r\n uni.addInterceptor('navigateTo', interceptor)\r\n uni.showToast({\r\n title: '页面跳转已拦截'\r\n })\r\n this.msg = \",路由被劫持到测试页面2\"\r\n },\r\n removeInterceptor() {\r\n uni.removeInterceptor('navigateTo', interceptor)\r\n uni.showToast({\r\n title: '拦截器已移除'\r\n })\r\n this.msg = \"会跳转到测试页面1\"\r\n },\r\n navigateTo() {\r\n uni.navigateTo({\r\n url: './page1',\r\n success(res) {\r\n console.log('res:', res)\r\n },\r\n fail(err) {\r\n console.error('err:', err)\r\n },\r\n complete(res) {\r\n console.log('res:', res)\r\n }\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"getLaunchOptionsSync":{"name":"## uni.getLaunchOptionsSync() @getlaunchoptionssync","description":"\n获取本次启动时的参数。返回值与App.onLaunch的回调参数一致\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **OnLaunchOptions** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | string | 是 | - | - | \n","compatibility":"### getLaunchOptionsSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getLaunchOptionsSync](https://doc.dcloud.net.cn/uni-app-x/api/get-launch-options-sync.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.get-launch-options-sync)\n"},"get-launch-options-sync":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-launch-options-sync/get-launch-options-sync.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-launch-options-sync/get-launch-options-sync\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\nexport default {\n data() {\n return {\n checked: false,\n homePagePath: 'pages/tabBar/component',\n launchOptionsPath: '',\n }\n },\n methods: {\n getLaunchOptionsSync() {\n const launchOptions = uni.getLaunchOptionsSync()\n this.launchOptionsPath = launchOptions.path\n\n if (launchOptions.path == this.homePagePath) {\n this.checked = true\n }\n },\n },\n}\n\n```\n:::"},"exit":{"name":"## uni.exit(options?) @exit","description":"\n退出当前应用","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ExitOptions](#exitoptions-values) \\| null | 否 | - | uni.exit参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [ExitSuccess](#exitsuccess-values)) => void \\| null | 否 | - | uni.exit成功回调函数定义 |\n@| fail | (res: [IExitError](#iexiterror-values)) => void \\| null | 否 | - | uni.exit失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.exit完成回调函数定义 | \n\n##### ExitSuccess 的属性值 @exitsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### IExitError 的属性值 @iexiterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 12001 \\| 12002 | 是 | - | 错误码
- 12001: 系统不支持
- 12002: 未知错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### exit 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | x | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.exit)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/exit/exit.uvue) \n ```uvue\n\n\n\n\n\n```"},"env":{"name":"## env","description":"","param":"### env 的属性值 @env-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| USER_DATA_PATH | string | 是 | - | 应用专属存储空间的外置存储空间根目录下的files目录 |\n| CACHE_PATH | string | 是 | - | 应用专属存储空间的外置存储空间根目录下的cache目录 |\n| SANDBOX_PATH | string | 是 | - | 应用专属存储空间的外置存储空间根目录(caches/files) |\n","compatibility":"#### env 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| USER_DATA_PATH | 3.99 | 4.11 | - |\n| CACHE_PATH | 3.99 | 4.11 | - |\n| SANDBOX_PATH | 3.99 | 4.11 | - |\n","returnValue":"","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.env)\n"},"navigateTo":{"name":"## uni.navigateTo(options) @navigateto","description":"\n保留当前页面,跳转到应用内的某个页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [NavigateToOptions](#navigatetooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| animationType | string \\| null | 否 | - | 窗口显示的动画类型
- auto: 自动选择动画效果
- none: 无动画效果
- slide-in-right: 从右侧横向滑动效果
- slide-in-left: 左侧横向滑动效果
- slide-in-top: 从上侧竖向滑动效果
- slide-in-bottom: 从下侧竖向滑动效果
- fade-in: 从透明到不透明逐渐显示效果
- zoom-out: 从小到大逐渐放大显示效果
- zoom-fade-out: 从小到大逐渐放大并且从透明到不透明逐渐显示效果
- pop-in: 从右侧平移入栈动画效果
- UnionType => 'auto' \\| 'none' \\| 'slide-in-right' \\| 'slide-in-left' \\| 'slide-in-top' \\| 'slide-in-bottom' \\| 'fade-in' \\| 'zoom-out' \\| 'zoom-fade-out' \\| 'pop-in' |\n@| animationDuration | number \\| null | 否 | - | 窗口显示动画的持续时间,单位为 ms |\n@| events | any \\| null | 否 | - | 页面间通信接口,用于监听被打开页面发送到当前页面的数据 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [NavigateToFail](#navigatetofail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### NavigateToFail 的属性值 @navigatetofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 路由错误码 - 4: 框架内部异常 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### NavigateToOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| animationType | x | x | 4.0 |\n| animationDuration | x | x | 4.0 |\n| events | x | x | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### navigateTo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[navigateTo](http://uniapp.dcloud.io/api/router?id=navigateto)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.navigateTo)\n"},"reLaunch":{"name":"## uni.reLaunch(options) @relaunch","description":"\n关闭所有页面,打开到应用内的某个页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReLaunchOptions](#relaunchoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的应用内页面路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [ReLaunchFail](#relaunchfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ReLaunchFail 的属性值 @relaunchfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### ReLaunchOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### reLaunch 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[reLaunch](http://uniapp.dcloud.io/api/router?id=relaunch)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.reLaunch)\n"},"navigateBack":{"name":"## uni.navigateBack(options?) @navigateback","description":"\n关闭当前页面,返回上一页面或多级页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [NavigateBackOptions](#navigatebackoptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| delta | number \\| null | 否 | - | 返回的页面数,如果 delta 大于现有页面数,则返回到首页 |\n@| animationType | string \\| null | 否 | - | 窗口关闭的动画类型
- auto: 自动选择动画效果
- none: 无动画效果
- slide-out-right: 横向向右侧滑出屏幕动画
- slide-out-left: 横向向左侧滑出屏幕动画
- slide-out-top: 竖向向上侧滑出屏幕动画
- slide-out-bottom: 竖向向下侧滑出屏幕动画
- fade-out: 从不透明到透明逐渐隐藏动画
- zoom-in: 从大逐渐缩小关闭动画
- zoom-fade-in: 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画
- pop-out: 从右侧平移出栈动画效果
- UnionType => 'auto' \\| 'none' \\| 'slide-out-right' \\| 'slide-out-left' \\| 'slide-out-top' \\| 'slide-out-bottom' \\| 'fade-out' \\| 'zoom-in' \\| 'zoom-fade-in' \\| 'pop-out' |\n@| animationDuration | number \\| null | 否 | - | 窗口关闭动画的持续时间,单位为 ms |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [NavigateBackFail](#navigatebackfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### NavigateBackFail 的属性值 @navigatebackfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### NavigateBackOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| delta | √ | 4.11 | 4.0 |\n| animationType | x | x | 4.0 |\n| animationDuration | x | x | 4.0 |\n| success | √ | x | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### navigateBack 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[navigateBack](http://uniapp.dcloud.io/api/router?id=navigateback)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.navigateBack)\n"},"redirectTo":{"name":"## uni.redirectTo(options) @redirectto","description":"\n关闭当前页面,跳转到应用内的某个页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [RedirectToOptions](#redirecttooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [RedirectToFail](#redirecttofail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### RedirectToFail 的属性值 @redirecttofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### RedirectToOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### redirectTo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[redirectTo](http://uniapp.dcloud.io/api/router?id=redirectto)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.redirectTo)\n"},"switchTab":{"name":"## uni.switchTab(options) @switchtab","description":"\n跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SwitchTabOptions](#switchtaboptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | 需要跳转的 tabBar 页面的路径,路径后不能带参数 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SwitchTabFail](#switchtabfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SwitchTabFail 的属性值 @switchtabfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### SwitchTabOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| url | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### switchTab 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[switchTab](http://uniapp.dcloud.io/api/router?id=switchtab)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.switchTab)\n"},"navigator":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/navigator/navigator.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/navigator/navigator\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { state, setLifeCycleNum } from '@/store/index.uts'\r\n\r\n export default {\r\n data() {\r\n return {\r\n onLoadTime: 0,\r\n onShowTime: 0,\r\n onReadyTime: 0,\r\n onHideTime: 0,\r\n }\r\n },\r\n onLoad() {\r\n this.onLoadTime = Date.now()\r\n console.log('onLoad', this.onLoadTime)\r\n },\r\n onShow() {\r\n this.onShowTime = Date.now()\r\n console.log('onShow', this.onShowTime)\r\n },\r\n onReady() {\r\n this.onReadyTime = Date.now()\r\n console.log('onReady', this.onReadyTime)\r\n },\r\n onHide() {\r\n this.onHideTime = Date.now()\r\n console.log('onHide', this.onHideTime)\r\n },\r\n onBackPress(options : OnBackPressOptions) : boolean | null {\r\n console.log('onBackPress', Date.now())\r\n console.log('onBackPress from', options.from)\r\n return null\r\n },\r\n onUnload() {\r\n console.log('onUnload', Date.now())\r\n },\r\n methods: {\r\n reLaunch() {\r\n uni.reLaunch({\r\n url: '/pages/tabBar/component',\r\n success(result) {\r\n console.log('reLaunch success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('reLaunch fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('reLaunch complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateTo() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=Hello',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateToErrorPage() {\r\n uni.navigateTo({\r\n url: '/pages/error-page/error-page',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n uni.showToast({\r\n title: error.errMsg,\r\n icon: 'none',\r\n })\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateToDebounce() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=debounce',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=debounce',\r\n success(result) {\r\n console.log('navigateTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n fail(error) {\r\n console.log('navigateTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n complete(result) {\r\n console.log('navigateTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n navigateToRelativePath1() {\r\n uni.navigateTo({\r\n url: 'new-page/new-page-1?data=new-page/new-page-1',\r\n success() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail() {\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n navigateToRelativePath2() {\r\n uni.navigateTo({\r\n url: './new-page/new-page-1?data=./new-page/new-page-1',\r\n success() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail() {\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n navigateToRelativePath3() {\r\n uni.navigateTo({\r\n url: '../navigator/new-page/new-page-1?data=../navigator/new-page/new-page-1',\r\n success() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail() {\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete() {\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateBack() {\r\n uni.navigateBack({\r\n success(result) {\r\n console.log('navigateBack success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateBack fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateBack complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n navigateBackWithDelta1() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1',\r\n success() {\r\n uni.navigateBack({\r\n delta: 1,\r\n success(result) {\r\n console.log('navigateBack success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateBack fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateBack complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n })\r\n },\r\n navigateBackWithDelta100() {\r\n uni.navigateTo({\r\n url: '/pages/API/navigator/new-page/new-page-1',\r\n success() {\r\n uni.navigateBack({\r\n delta: 100,\r\n success(result) {\r\n console.log('navigateBack success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('navigateBack fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('navigateBack complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n })\r\n },\r\n redirectTo() {\r\n uni.redirectTo({\r\n url: '/pages/API/navigator/new-page/new-page-1?data=Hello',\r\n success(result) {\r\n console.log('redirectTo success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('redirectTo fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('redirectTo complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n switchTab() {\r\n uni.switchTab({\r\n url: '/pages/tabBar/template',\r\n success(result) {\r\n console.log('switchTab success', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail(error) {\r\n console.log('switchTab fail', error.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete(result) {\r\n console.log('switchTab complete', result.errMsg)\r\n // 自动化测试\r\n setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n })\r\n },\r\n // 自动化测试\r\n getLifeCycleNum() : number {\r\n return state.lifeCycleNum\r\n },\r\n // 自动化测试\r\n setLifeCycleNum(num : number) {\r\n setLifeCycleNum(num)\r\n },\r\n },\r\n }\r\n\n```\n:::"},"setNavigationBarColor":{"name":"## uni.setNavigationBarColor(options) @setnavigationbarcolor","description":"\n设置导航条、状态栏颜色\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetNavigationBarColorOptions](#setnavigationbarcoloroptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| frontColor | \"#ffffff\" \\| \"#000000\" | 是 | - | 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 |\n@| backgroundColor | [string.ColorString](/uts/data-type.md#ide-string) | 是 | - | 背景颜色值,有效值为十六进制颜色 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (error: [SetNavigationBarColorFail](#setnavigationbarcolorfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetNavigationBarColorFail 的属性值 @setnavigationbarcolorfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### SetNavigationBarColorOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| frontColor | √ | 4.11 | 4.0 |\n| backgroundColor | √ | 4.11 | 4.0 |\n| success | √ | 4.11 | 4.0 |\n| fail | √ | 4.11 | 4.0 |\n| complete | √ | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setNavigationBarColor 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setNavigationBarColor](https://doc.dcloud.net.cn/uni-app-x/api/set-navigation-bar-color.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-navigation-bar-color)\n"},"set-navigation-bar-color":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/set-navigation-bar-color/set-navigation-bar-color\n>Template\n```vue\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { state, setLifeCycleNum } from '@/store/index.uts'\r\n\r\n export default {\r\n methods: {\r\n setNavigationBarColor1() {\r\n uni.setNavigationBarColor({\r\n frontColor: '#ffffff',\r\n backgroundColor: '#00ff00',\r\n success: () => {\r\n console.log('setNavigationBarColor success')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail: () => {\r\n console.log('setNavigationBarColor fail')\r\n this.setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete: () => {\r\n console.log('setNavigationBarColor complete')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n }\r\n })\r\n },\r\n setNavigationBarColor2() {\r\n uni.setNavigationBarColor({\r\n frontColor: '#000000',\r\n backgroundColor: '#ff0000',\r\n success: () => {\r\n console.log('setNavigationBarColor success')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n },\r\n fail: () => {\r\n console.log('setNavigationBarColor fail')\r\n this.setLifeCycleNum(state.lifeCycleNum - 1)\r\n },\r\n complete: () => {\r\n console.log('setNavigationBarColor complete')\r\n this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n }\r\n })\r\n },\r\n // 自动化测试\r\n getLifeCycleNum() : number {\r\n return state.lifeCycleNum\r\n },\r\n // 自动化测试\r\n setLifeCycleNum(num : number) {\r\n setLifeCycleNum(num)\r\n },\r\n goNavbarLite() {\r\n uni.navigateTo({\r\n url: '/pages/template/navbar-lite/navbar-lite'\r\n })\r\n }\r\n },\r\n }\r\n\n```\n:::"},"setNavigationBarTitle":{"name":"## uni.setNavigationBarTitle(options) @setnavigationbartitle","description":"\n动态设置当前页面的标题\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetNavigationBarTitleOptions](#setnavigationbartitleoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string | 是 | - | 页面标题 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (error: [SetNavigationBarTitleFail](#setnavigationbartitlefail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetNavigationBarTitleFail 的属性值 @setnavigationbartitlefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### SetNavigationBarTitleOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| title | 3.97 | 4.11 | 4.0 |\n| success | 3.97 | 4.11 | 4.0 |\n| fail | 3.97 | 4.11 | 4.0 |\n| complete | 3.97 | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setNavigationBarTitle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.97 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setNavigationBarTitle](https://doc.dcloud.net.cn/uni-app-x/api/set-navigation-bar-title.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-navigation-bar-title)\n"},"set-navigation-bar-title":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/set-navigation-bar-title/set-navigation-bar-title.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/set-navigation-bar-title/set-navigation-bar-title\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n import { state, setLifeCycleNum } from '@/store/index.uts'\n\n export default {\n data() {\n return {\n newTitle: 'new title',\n longTitle: 'long title long title long title long title long title long title long title long title long title long title'\n }\n },\n methods: {\n setNavigationBarNewTitle() {\n uni.setNavigationBarTitle({\n title: this.newTitle,\n success: () => {\n console.log('setNavigationBarTitle success')\n this.setLifeCycleNum(state.lifeCycleNum + 1)\n },\n fail: () => {\n console.log('setNavigationBarTitle fail')\n this.setLifeCycleNum(state.lifeCycleNum - 1)\n },\n complete: () => {\n console.log('setNavigationBarTitle complete')\n this.setLifeCycleNum(state.lifeCycleNum + 1)\n }\n })\n },\n setNavigationBarLongTitle() {\n uni.setNavigationBarTitle({\n title: this.longTitle,\n success() {\n console.log('setNavigationBarTitle success')\n },\n fail() {\n console.log('setNavigationBarTitle fail')\n },\n complete() {\n console.log('setNavigationBarTitle complete')\n }\n })\n },\n // 自动化测试\n getLifeCycleNum() : number {\n return state.lifeCycleNum\n },\n // 自动化测试\n setLifeCycleNum(num : number) {\n setLifeCycleNum(num)\n }\n },\n }\n\n```\n:::"},"showTabBar":{"name":"## uni.showTabBar(options?) @showtabbar","description":"\n显示 tabBar\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowTabBarOptions](#showtabbaroptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| animation | boolean | 否 | - | 是否需要动画效果 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### showTabBar 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showTabBar](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#showtabbar)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.showTabBar)\n"},"hideTabBar":{"name":"## uni.hideTabBar(options?) @hidetabbar","description":"\n隐藏 tabBar\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [HideTabBarOptions](#hidetabbaroptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| animation | boolean | 否 | - | 是否需要动画效果 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### hideTabBar 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[hideTabBar](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#hidetabbar)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.hideTabBar)\n"},"showTabBarRedDot":{"name":"## uni.showTabBarRedDot(options) @showtabbarreddot","description":"\n显示 tabBar 某一项的右上角的红点\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowTabBarRedDotOptions](#showtabbarreddotoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### showTabBarRedDot 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showTabBarRedDot](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#showtabbarreddot)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.showTabBarRedDot)\n"},"hideTabBarRedDot":{"name":"## uni.hideTabBarRedDot(options) @hidetabbarreddot","description":"\n隐藏 tabBar 某一项的右上角的红点\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [HideTabBarRedDotOptions](#hidetabbarreddotoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### hideTabBarRedDot 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[hideTabBarRedDot](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#hidetabbarreddot)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.hideTabBarRedDot)\n"},"setTabBarBadge":{"name":"## uni.setTabBarBadge(options) @settabbarbadge","description":"\n为 tabBar 某一项的右上角添加文本\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetTabBarBadgeOptions](#settabbarbadgeoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| text | string | 是 | - | 显示的文本,不超过 3 个半角字符 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setTabBarBadge 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setTabBarBadge](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#settabbarbadge)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.setTabBarBadge)\n"},"removeTabBarBadge":{"name":"## uni.removeTabBarBadge(options) @removetabbarbadge","description":"\n移除 tabBar 某一项右上角的文本\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [RemoveTabBarBadgeOptions](#removetabbarbadgeoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar的哪一项,从左边算起,索引从0开始 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### removeTabBarBadge 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[removeTabBarBadge](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#removetabbarbadge)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.removeTabBarBadge)\n"},"setTabBarStyle":{"name":"## uni.setTabBarStyle(options) @settabbarstyle","description":"\n动态设置 tabBar 的整体样式\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetTabBarStyleOptions](#settabbarstyleoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| color | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | tab 上的文字默认颜色 |\n@| selectedColor | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | tab 上的文字选中时的颜色 |\n@| backgroundColor | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | tab 的背景色 |\n@| backgroundImage | string | 否 | - | 图片背景 |\n@| backgroundRepeat | \"repeat\" \\| \"repeat-x\" \\| \"repeat-y\" \\| \"no-repeat\" | 否 | - | 背景图平铺方式
- repeat: 背景图片在垂直方向和水平方向平铺
- repeat-x: 背景图片在水平方向平铺,垂直方向拉伸
- repeat-y: 背景图片在垂直方向平铺,水平方向拉伸
- no-repeat: 背景图片在垂直方向和水平方向都拉伸 |\n@| borderStyle | string | 否 | - | tabbar上边框的颜色 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setTabBarStyle 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setTabBarStyle](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#settabbarstyle)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.setTabBarStyle)\n"},"setTabBarItem":{"name":"## uni.setTabBarItem(options) @settabbaritem","description":"\n动态设置 tabBar 某一项的内容\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SetTabBarItemOptions](#settabbaritemoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| index | number | 是 | - | tabBar 的哪一项,从左边算起,索引从0开始 |\n@| text | string | 否 | - | tab 上按钮文字 |\n@| iconPath | string | 否 | - | 图片路径 |\n@| selectedIconPath | string | 否 | - | 选中时的图片路径 |\n@| pagePath | string | 否 | - | 页面绝对路径 |\n@| iconfont | **SetTabBarItemIconFontOptions** | 否 | - | 字体图标,优先级高于 iconPath |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| text | string | 是 | - | 字库 Unicode 码 |\n@@| selectedText | string | 是 | - | 选中后字库 Unicode 码 |\n@@| fontSize | string | 否 | - | 字体图标字号(px) |\n@@| color | string | 否 | - | 字体图标颜色 |\n@@| selectedColor | string | 否 | - | 字体图标选中颜色 |\n@| visible | boolean | 否 | - | tab 是否显示 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [SetTabBarFail](#settabbarfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SetTabBarFail 的属性值 @settabbarfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 100 \\| 200 | 是 | - | 错误码
- 100: TabBar 不存在
- 200: 参数错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### setTabBarItem 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setTabBarItem](https://doc.dcloud.net.cn/uni-app-x/api/set-tabbar.html#settabbaritem)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.set-tabbar.setTabBarItem)\n"},"startPullDownRefresh":{"name":"## uni.startPullDownRefresh(options?) @startpulldownrefresh","description":"\n开始下拉刷新\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [StartPullDownRefreshOptions](#startpulldownrefreshoptions-values) \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [StartPullDownRefreshFail](#startpulldownrefreshfail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### StartPullDownRefreshFail 的属性值 @startpulldownrefreshfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### startPullDownRefresh 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[startPullDownRefresh](https://uniapp.dcloud.io/uni-app-x/api/pull-down-refresh.html#startpulldownrefresh)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pull-down-refresh.startPullDownRefresh)\n"},"stopPullDownRefresh":{"name":"## uni.stopPullDownRefresh() @stoppulldownrefresh","description":"\n停止当前页面下拉刷新\n","param":"","returnValue":"","compatibility":"### stopPullDownRefresh 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[stopPullDownRefresh](https://doc.dcloud.net.cn/uni-app-x/api/pull-down-refresh.html#stoppulldownrefresh)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pull-down-refresh.stopPullDownRefresh)\n"},"pull-down-refresh":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/pull-down-refresh/pull-down-refresh.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/pull-down-refresh/pull-down-refresh\n>Template\n```vue\n\n\n\n\n\n```\n>Script\n```uts\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tdata: [] as Array,\n\t\t\t\tloadMoreText: \"加载中...\",\n\t\t\t\tshowLoadMore: false,\n\t\t\t\tmax: 0\n\t\t\t}\n\t\t},\n\t\tonReady() {\n uni.startPullDownRefresh();\n\t\t\tthis.initData();\n\t\t},\n\t\tonReachBottom() {\n\t\t\tconsole.log(\"onReachBottom\");\n\t\t\tif (this.max > 40) {\n\t\t\t\tthis.loadMoreText = \"没有更多数据了!\"\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.showLoadMore = true;\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.setListData();\n\t\t\t}, 300);\n\t\t},\n\t\tonPullDownRefresh() {\n\t\t\tconsole.log('onPullDownRefresh');\n\t\t\tthis.initData();\n\t\t},\n\t\tmethods: {\n\t\t\tinitData(){\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tthis.max = 0;\n\t\t\t\t\tthis.data = [];\n\t\t\t\t\tlet data:Array = [];\n\t\t\t\t\tthis.max += 20;\n\t\t\t\t\tfor (let i:number = this.max - 19; i < this.max + 1; i++) {\n\t\t\t\t\t\tdata.push(i)\n\t\t\t\t\t}\n\t\t\t\t\tthis.data = this.data.concat(data);\n\t\t\t\t\tuni.stopPullDownRefresh();\n\t\t\t\t}, 1000);\n\t\t\t},\n\t\t\tsetListData() {\n\t\t\t\tlet data:Array = [];\n\t\t\t\tthis.max += 10;\n\t\t\t\tfor (let i:number = this.max - 9; i < this.max + 1; i++) {\n\t\t\t\t\tdata.push(i)\n\t\t\t\t}\n\t\t\t\tthis.data = this.data.concat(data);\n\t\t\t}\n\t\t}\n\t}\n\n```\n:::"},"pageScrollTo":{"name":"## uni.pageScrollTo(options) @pagescrollto","description":"\n将页面滚动到目标位置\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [PageScrollToOptions](#pagescrolltooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| scrollTop | number \\| null | 否 | - | 滚动到页面的目标位置 |\n@| selector | string \\| null | 否 | - | 选择器 |\n@| offsetTop | number \\| null | 否 | - | 偏移距离,可以滚动到 selector 加偏移距离的位置 |\n@| duration | number \\| null | 否 | - | 滚动动画的时长 |\n@| success | (result: AsyncApiSuccessResult) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [PageScrollToFail](#pagescrolltofail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### PageScrollToFail 的属性值 @pagescrolltofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### PageScrollToOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| offsetTop | 3.91 | 4.11 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### pageScrollTo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[pageScrollTo](https://doc.dcloud.net.cn/uni-app-x/api/page-scroll-to.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.page-scroll-to)\n"},"page-scroll-to":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/page-scroll-to/page-scroll-to.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/page-scroll-to/page-scroll-to\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'pageScrollTo',\n }\n },\n methods: {\n scrollTo() {\n uni.pageScrollTo({\n scrollTop: 100,\n duration: 300,\n success: () => {\n console.log('success')\n },\n })\n },\n scrollToElement() {\n uni.pageScrollTo({\n selector: '.custom-element',\n duration: 300,\n success: () => {\n console.log('success')\n },\n })\n },\n },\n }\n\n```\n:::"},"getElementById":{"name":"## uni.getElementById(id) @getelementbyid","description":"\n返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| id | [string.IDString](/uts/data-type.md#ide-string) \\| string | 是 | - | - | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) \\| null | 否 |\n \n","compatibility":"### getElementById 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getElementById](https://doc.dcloud.net.cn/uni-app-x/api/get-element.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.dom.get-element.getElementById)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-element-by-id/get-element-by-id.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-element-by-id/get-element-by-id\n>Template\n```vue\n\r\n\r\n\r\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n checked: false,\r\n homePagePath: '/pages/tabBar/component',\r\n launchOptionsPath: '',\r\n }\r\n },\r\n methods: {\r\n getElementByNotExistId() : Element | null {\r\n return uni.getElementById('not-exist-id')\r\n },\r\n changePageHeadBackgroundColor() {\r\n const pageHead = uni.getElementById('page-head')!\r\n pageHead.style.setProperty('background-color', 'red')\r\n },\r\n changeTextColor() {\r\n const text = uni.getElementById('text')!\r\n text.style.setProperty('color', 'red')\r\n },\r\n changeViewStyle() {\r\n const view = uni.getElementById('view')\r\n if (view !== null) {\r\n view.style.setProperty('width', '90%')\r\n view.style.setProperty('height', '50px')\r\n view.style.setProperty('background-color', '#007AFF')\r\n }\r\n },\r\n goMultipleRootNode() {\r\n uni.navigateTo({ url: '/pages/API/get-element-by-id/get-element-by-id-multiple-root-node' })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"createSelectorQuery":{"name":"## uni.createSelectorQuery() @createselectorquery","description":"\n返回一个SelectorQuery对象实例\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n\n#### SelectorQuery 的方法 @selectorquery-values \n\n#### in(component?) @in\n\n将选择器的选取范围更改为自定义组件component内\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| component | any \\| null | 否 | - | | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n#### select(selector) @select\n\n在当前页面下选择第一个匹配选择器selector的节点\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| selector | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n\n##### NodesRef 的方法 @nodesref-values \n\n##### boundingClientRect(callback?) @boundingclientrect\n\n添加节点的布局位置的查询请求,相对于显示区域,以像素为单位\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void \\| null | 否 | - | | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n##### scrollOffset(callback) @scrolloffset\n\n添加节点的滚动位置查询请求,以像素为单位\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n##### fields(fields, callback) @fields\n\n获取节点的相关信息,需要获取的字段在fields中指定\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fields | [NodeField](#nodefield-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| id | boolean \\| null | 否 | - | 是否返回节点 id |\n@| dataset | boolean \\| null | 否 | - | 是否返回节点 dataset |\n@| rect | boolean \\| null | 否 | - | 是否返回节点布局位置(left right top bottom) |\n@| size | boolean \\| null | 否 | - | 是否返回节点尺寸(width height) |\n@| scrollOffset | boolean \\| null | 否 | - | 是否返回节点的 scrollLeft scrollTop,节点必须是 scroll-view 或者 viewport |\n@| properties | Array\\ \\| null | 否 | - | 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) |\n@| computedStyle | Array\\ \\| null | 否 | - | 指定样式名列表,返回节点对应样式名的当前值 |\n@| context | boolean \\| null | 否 | - | 是否返回节点对应的 Context 对象 |\n| callback | (result: any) => void | 是 | - | | \n\n###### NodeField 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| context | x | x | 4.0 |\n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n\n##### context(callback) @context\n\n添加节点的 Context 对象查询请求\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n###### context 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| x | x | 4.0 |\n\n\n##### node(callback) @node\n\n获取 Node 节点实例。目前支持 Canvas 的获取。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n###### 返回值 \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n\n \n\n\n\n#### selectAll(selector) @selectall\n\n在当前页面下选择匹配选择器selector的所有节点\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| selector | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n \n\n\n\n#### selectViewport() @selectviewport\n\n选择显示区域\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n \n\n\n\n#### exec(callback) @exec\n\n执行所有的请求\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: Array\\) => void \\| null | 是 | - | - | \n\n##### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [NodesRef](#nodesref-values) \\| null | 否 |\n \n\n\n \n","compatibility":"### createSelectorQuery 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.91 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[createSelectorQuery](https://doc.dcloud.net.cn/uni-app-x/api/nodes-info.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.dom.nodes-info.createSelectorQuery)\n"},"nodes-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/nodes-info/nodes-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/nodes-info/nodes-info\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import nodeChild from './nodes-info-child.uvue'\r\n\r\n type NodeInfoType = {\r\n left : number | null,\r\n top : number | null,\r\n right : number | null,\r\n bottom : number | null,\r\n width : number | null,\r\n height : number | null,\r\n }\r\n\r\n export default {\r\n components: {\r\n nodeChild\r\n },\r\n data() {\r\n return {\r\n title: 'createSelectorQuery',\r\n nodeInfoList: [] as NodeInfoType[],\r\n // 仅用于自动化测试\r\n rootNodeInfo: null as NodeInfoType | null,\r\n //供自动化测试使用\r\n // resizeRectValid: false\r\n }\r\n },\r\n onResize() {\r\n //供自动化测试使用\r\n /* var rect12Element = uni.getElementById(\"rect-1-2\")\r\n if(rect12Element != null) {\r\n var domRect = rect12Element.getBoundingClientRect()\r\n if(domRect.width > 100) {\r\n this.resizeRectValid = true\r\n }\r\n } */\r\n },\r\n methods: {\r\n // 仅用于自动化测试\r\n getRootNodeInfo(selector : string) {\r\n uni.createSelectorQuery().select(selector).boundingClientRect().exec((ret) => {\r\n if (ret.length == 1) {\r\n const nodeInfo = ret[0] as NodeInfo;\r\n const nodeType = {\r\n left: nodeInfo.left,\r\n top: nodeInfo.top,\r\n right: nodeInfo.right,\r\n bottom: nodeInfo.bottom,\r\n width: nodeInfo.width,\r\n height: nodeInfo.height,\r\n } as NodeInfoType;\r\n this.rootNodeInfo = nodeType\r\n }\r\n })\r\n },\r\n getNodeInfo() {\r\n uni.createSelectorQuery().select('.rect1').boundingClientRect().exec((ret) => {\r\n this.nodeInfoList.length = 0\r\n const i = ret[0] as NodeInfo\r\n this.nodeInfoList.push({\r\n left: i.left,\r\n top: i.top,\r\n right: i.right,\r\n bottom: i.bottom,\r\n width: i.width,\r\n height: i.height,\r\n } as NodeInfoType)\r\n })\r\n },\r\n getAllNodeInfo() {\r\n uni.createSelectorQuery().selectAll('.rect').boundingClientRect().exec((ret) => {\r\n this.nodeInfoList.length = 0\r\n const array = ret[0] as NodeInfo[]\r\n array.forEach((i) => {\r\n this.nodeInfoList.push({\r\n left: i.left,\r\n top: i.top,\r\n right: i.right,\r\n bottom: i.bottom,\r\n width: i.width,\r\n height: i.height,\r\n } as NodeInfoType)\r\n })\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"showActionSheet":{"name":"## uni.showActionSheet(options) @showactionsheet","description":"从底部向上弹出操作菜单","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowActionSheetOptions](#showactionsheetoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string \\| null | 否 | - | 菜单标题 |\n@| alertText | string \\| null | 否 | - | 警示文案(同菜单标题, app无效) |\n@| itemList | Array\\ | 是 | - | 按钮的文字数组 |\n@| itemColor | [string.ColorString](/uts/data-type.md#ide-string) \\| null | 否 | - | 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色) |\n@| popover | **Popover** \\| null | 否 | - | 大屏设备弹出原生选择按钮框的指示区域,默认居中显示 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| top | number | 是 | - | 指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度 |\n@@| left | number | 是 | - | 指示区域坐标 |\n@@| width | number | 是 | - | 指示区域宽度 |\n@@| height | number | 是 | - | 指示区域高度 |\n@| success | (res: [ShowActionSheetSuccess](#showactionsheetsuccess-values)) => void \\| null | 否 | - | uni.showActionSheet成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showActionSheet成功回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showActionSheet成功回调函数定义 | \n\n##### ShowActionSheetSuccess 的属性值 @showactionsheetsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tapIndex | number \\| null | 否 | - | 用户点击的按钮,从上到下的顺序,从0开始 |\n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showActionSheet 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showActionSheet](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showActionSheet)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/action-sheet/action-sheet.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/action-sheet/action-sheet\n>Template\n```vue\n\r\n\n\n```\n>Script\n```uts\n\r\n type ItemType = {\r\n value : string,\r\n name : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'action-sheet',\r\n itemColorCustom: false,\r\n itemContentLarge: false,\r\n itemNumLargeSelect: false,\n showErrorToast:true,\r\n items: [{\r\n value: '标题',\r\n name: '有标题'\r\n },\r\n {\r\n value: '',\r\n name: '无标题'\r\n },\r\n {\r\n value: '超长标题测试内容,测试超过显示最大范围之后的样式-超长标题测试内容,测试超过显示最大范围之后的样式',\r\n name: '超长标题'\r\n }\r\n ] as ItemType[],\r\n current: 0,\r\n }\r\n },\n onLoad(){\n uni.showActionSheet({\n title: \"onLoad 调用示例,请手动取消\",\n itemList:['item1', 'item2'],\n })\n },\r\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\r\n radioChange(e : UniRadioGroupChangeEvent) {\r\n for (let i = 0; i < this.items.length; i++) {\r\n if (this.items[i].value === e.detail.value) {\r\n this.current = i;\r\n break;\r\n }\r\n }\r\n },\r\n itemContentLargeChange: function (e : UniSwitchChangeEvent) {\r\n this.itemContentLarge = e.detail.value\r\n },\r\n itemColorChange: function (e : UniSwitchChangeEvent) {\r\n this.itemColorCustom = e.detail.value\r\n },\r\n itemNumLargeChange: function (e : UniSwitchChangeEvent) {\r\n this.itemNumLargeSelect = e.detail.value\r\n },\r\n actionSheetTap() {\r\n\r\n let itemInfo = ['item1', 'item2', 'item3', 'item4']\r\n\r\n if (this.itemContentLarge) {\r\n itemInfo = ['两个黄鹂鸣翠柳,一行白鹭上青天。窗含西岭千秋雪,门泊东吴万里船', '水光潋滟晴方好,山色空蒙雨亦奇。 欲把西湖比西子,淡妆浓抹总相宜', '']\r\n }\n\n if (this.itemNumLargeSelect) {\r\n // 大量选项测试,不能超过6个元素 https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet\r\n itemInfo = []\n for (var i = 1; i <= 10; i++) {\r\n itemInfo.push('两个黄鹂鸣翠柳,一行白鹭上青天');\r\n }\r\n }\r\n\r\n const that = this\r\n if (this.itemColorCustom) {\r\n uni.showActionSheet({\r\n title: this.items[this.current].value,\r\n itemList: itemInfo,\r\n itemColor: \"#ff00ff\",\r\n success: (e) => {\r\n console.log(e.tapIndex);\r\n uni.showToast({\r\n title: \"点击了第\" + e.tapIndex + \"个选项\",\r\n icon: \"none\"\r\n })\r\n },\r\n fail: (e) => {\n if(this.showErrorToast){\n uni.showToast({\n title: e.errMsg,\n icon: \"none\"\n })\n }\r\n console.log(e);\r\n }\r\n })\r\n } else {\r\n uni.showActionSheet({\r\n title: this.items[this.current].value,\r\n itemList: itemInfo,\r\n success: (e) => {\r\n console.log(e.tapIndex);\r\n uni.showToast({\r\n title: \"点击了第\" + e.tapIndex + \"个选项\",\r\n icon: \"none\"\r\n })\r\n },\r\n fail: (e) => {\r\n console.log(e);\n if(this.showErrorToast){\n uni.showToast({\n title: e.errMsg,\n icon: \"none\"\n })\n }\n }\r\n })\r\n }\r\n },\r\n }\r\n }\r\n\n```\n:::"},"showLoading":{"name":"## uni.showLoading(options) @showloading","description":"显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowLoadingOptions](#showloadingoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string | 是 | - | 提示的内容,长度与 icon 取值有关。 |\n@| mask | boolean \\| null | 否 | - | 是否显示透明蒙层,防止触摸穿透,默认:false |\n@| success | (res: ShowLoadingSuccess) => void \\| null | 否 | - | uni.showLoading成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showLoading失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showLoading完成回调函数定义 | \n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showLoading 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showLoading](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showLoading)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/loading/loading.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/loading/loading\n>Template\n```vue\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : string\n name : string\n }\n export default {\n data() {\n return {\n title: 'loading',\n items: [\n {\n value: 'null',\n name: '无标题',\n },\n {\n value: '三秒后自动关闭',\n name: '普通标题',\n },\n {\n value: '超长文本内容,测试超出范围-超长文本内容,测试超出范围-三秒后自动关闭',\n name: '长标题',\n },\n ] as ItemType[],\n current: 0,\n maskSelect: false,\n titleSelect: \"null\"\n }\n },\n onLoad(){\n uni.showLoading({\n \ttitle:'onLoad 调用示例,2秒后消失'\n })\n setTimeout(function() {\n uni.hideLoading()\n }, 2000);\n },\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\n\n radioChange(e : UniRadioGroupChangeEvent) {\n const selected = this.items.find((item) : boolean => {\n return item.value == e.detail.value\n })\n if (selected != null) {\n this.titleSelect = selected.value\n }\n },\n maskChange: function (e : UniSwitchChangeEvent) {\n this.maskSelect = e.detail.value\n },\n showLoading: function () {\n\n console.log(this.titleSelect)\n if (this.titleSelect == \"null\") {\n uni.showLoading({\n title: \"\",\n mask: this.maskSelect\n });\n } else {\n uni.showLoading({\n title: this.titleSelect,\n mask: this.maskSelect\n });\n }\n setTimeout(() => {\n this.hideLoading();\n }, 3000);\n },\n hideLoading: function () {\n uni.hideLoading();\n }\n }\n }\n\n```\n:::"},"showModal":{"name":"## uni.showModal(options) @showmodal","description":"显示模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowModalOptions](#showmodaloptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string \\| null | 否 | - | 提示的标题 |\n@| content | string \\| null | 否 | - | 提示的内容 |\n@| showCancel | boolean \\| null | 否 | true
是否显示取消按钮,默认为 true | |\n@| cancelText | string \\| null | 否 | - | 取消按钮的文字,默认为\"取消\" |\n@| cancelColor | [string.ColorString](/uts/data-type.md#ide-string) \\| null | 否 | - | 取消按钮的文字颜色,默认为\"#000000\" |\n@| confirmText | string \\| null | 否 | - | 确定按钮的文字,默认为\"确定\" |\n@| confirmColor | [string.ColorString](/uts/data-type.md#ide-string) \\| null | 否 | - | 确定按钮的文字颜色 |\n@| editable | boolean \\| null | 否 | false
是否显示输入框 | |\n@| placeholderText | string \\| null | 否 | - | 显示输入框时的提示文本 |\n@| success | (res: [ShowModalSuccess](#showmodalsuccess-values)) => void \\| null | 否 | - | uni.showModal成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showModal失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showModal完成回调函数定义 | \n\n##### ShowModalSuccess 的属性值 @showmodalsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| confirm | boolean | 是 | - | 为 true 时,表示用户点击了确定按钮 |\n| cancel | boolean | 是 | - | 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) |\n| content | string \\| null | 否 | - | editable 为 true 时,用户输入的文本 |\n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showModal 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showModal](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showModal)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/modal/modal.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/modal/modal\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : string,\n name : string,\n }\n export default {\n data() {\n return {\n title: 'modal',\n showCancelSelect: false,\n cancelTextSelect: false,\n confirmTextSelect: false,\n editableSelect: false,\n placeholderTextSelect: false,\n exeRet: \"\",\n items: [{\n value: '标题',\n name: '有标题'\n },\n {\n value: '',\n name: '无标题'\n },\n {\n value: '超长标题测试内容,测试超过显示最大范围之后的样式-超长标题测试内容,测试超过显示最大范围之后的样式',\n name: '超长标题'\n }\n ] as ItemType[],\n current: 0\n }\n },\n onLoad() {\n uni.showModal({\n title: \"onLoad 调用示例,请手动取消\",\n showCancel: false\n })\n },\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\n showCancelChange: function (e : UniSwitchChangeEvent) {\n this.showCancelSelect = e.detail.value\n },\n cancelTextChange: function (e : UniSwitchChangeEvent) {\n this.cancelTextSelect = e.detail.value\n },\n confirmTextChange: function (e : UniSwitchChangeEvent) {\n this.confirmTextSelect = e.detail.value\n },\n editableChange: function (e : UniSwitchChangeEvent) {\n this.editableSelect = e.detail.value\n },\n placeholderTextChange: function (e : UniSwitchChangeEvent) {\n this.placeholderTextSelect = e.detail.value\n },\n radioChange(e : UniRadioGroupChangeEvent) {\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].value === e.detail.value) {\n this.current = i;\n break;\n }\n }\n },\n modalTap: function () {\n let cancelTextVal : string\n let cancelColorVal = ''\n if (this.cancelTextSelect) {\n cancelTextVal = \"修改后的取消文本\"\n cancelColorVal = \"#ff00ff\"\n } else {\n cancelTextVal = \"取消\"\n }\n\n let confirmTextVal = '确定'\n let confirmColorVal = ''\n if (this.confirmTextSelect) {\n confirmTextVal = \"修改后的确定文本\"\n confirmColorVal = \"#00ffff\"\n }\n\n let placeholderTextVal = ''\n let contentVal = \"弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内\"\n if (this.placeholderTextSelect) {\n placeholderTextVal = \"定制提示信息\"\n contentVal = \"\"\n }\n uni.showModal({\n title: this.items[this.current].value,\n editable: this.editableSelect,\n placeholderText: placeholderTextVal,\n content: contentVal,\n showCancel: this.showCancelSelect,\n cancelText: cancelTextVal,\n cancelColor: cancelColorVal,\n confirmText: confirmTextVal,\n confirmColor: confirmColorVal,\n success: (res) => {\n this.exeRet = JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = JSON.stringify(res)\n }\n })\n }\n }\n }\n\n```\n:::"},"showToast":{"name":"## uni.showToast(options) @showtoast","description":"显示消息提示框","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ShowToastOptions](#showtoastoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| title | string | 是 | - | 提示的内容,长度与 icon 取值有关。 |\n@| icon | \"success\" \\| \"error\" \\| \"fail\" \\| \"exception\" \\| \"loading\" \\| \"none\" | 否 | - | icon值说明 success: 显示成功图标,error: 显示错误图标; fail: 显示错误图标,此时title文本无长度显示; exception: 显示异常图标,此时title文本无长度显示; loading: 显示加载图标;none: 不显示图标。 |\n@| image | [string.ImageURIString](/uts/data-type.md#ide-string) \\| null | 否 | - | 自定义图标的本地路径(app端暂不支持gif) |\n@| mask | boolean \\| null | 否 | - | 是否显示透明蒙层,防止触摸穿透,默认:false |\n@| duration | number \\| null | 否 | - | 提示的延迟时间,单位毫秒,默认:1500 |\n@| position | \"top\" \\| \"center\" \\| \"bottom\" | 否 | - | position值说明(仅App生效) top: 居上显示; center: 居中显示;bottom: 居底显示 |\n@| success | (res: ShowToastSuccess) => void \\| null | 否 | - | uni.showToast成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void \\| null | 否 | - | uni.showToast失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.showToast完成回调函数定义 | \n\n##### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1 \\| 1001 | 是 | - | 错误码
- 1\t 撤销
- 1001 请求参数非法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### showToast 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[showToast](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.prompt.showToast)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/toast/toast.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/toast/toast\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'toast',\n exeRet: ''\n }\n },\n onLoad() {\n uni.showToast({\n title: 'onLoad 调用示例,2秒后消失'\n })\n setTimeout(function () {\n uni.hideToast()\n }, 2000);\n },\n methods: {\n //自动化测试例专用\n jest_getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n },\n toast1Tap: function () {\n uni.showToast({\n title: \"默认\",\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toastTapIconError: function () {\n uni.showToast({\n title: \"默认\",\n icon: 'error',\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toast2Tap: function () {\n uni.showToast({\n title: \"duration 3000\",\n duration: 3000,\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toast3Tap: function () {\n uni.showToast({\n title: \"loading\",\n icon: \"loading\",\n duration: 5000,\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n toast4Tap: function () {\n uni.showToast({\n title: \"logo\",\n image: \"/static/uni.png\",\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n // #ifdef APP\n toast5Tap: function () {\n uni.showToast({\n title: \"显示一段轻提示\",\n position: 'bottom',\n success: (res) => {\n this.exeRet = \"success:\" + JSON.stringify(res)\n },\n fail: (res) => {\n this.exeRet = \"fail:\" + JSON.stringify(res)\n },\n })\n },\n // #endif\n hideToast: function () {\n uni.hideToast()\n }\n }\n }\n\n```\n:::"},"loadFontFace":{"name":"## uni.loadFontFace(options) @loadfontface","description":"\n动态加载网络字体\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [LoadFontFaceOptions](#loadfontfaceoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| global | boolean | 否 | - | 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。 |\n@| family | string | 是 | - | 定义的字体名称 |\n@| source | string | 是 | - | 字体资源的地址, App-Android 平台不支持 woff、woff2 格式字体文件 |\n@| desc | **LoadFontFaceOptionDesc** | 否 | - | 可选的字体描述符 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| style | string \\| null | 否 | - | |\n@@| weight | string \\| null | 否 | - | |\n@@| variant | string \\| null | 否 | - | |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | 接口调用成功的回调函数 |\n@| fail | (error: [LoadFontFaceFail](#loadfontfacefail-values)) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### LoadFontFaceFail 的属性值 @loadfontfacefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 4 \\| 99 \\| 101 \\| 100001 \\| 100002 \\| 200001 \\| 300001 \\| 300002 | 是 | - | 错误码
- 4: 框架内部异常
- 99: page is not ready
- 101: 参数错误
- 100001: family is null
- 100002: source is null
- 200001: local font not found
- 300001: same source task is loading
- 300002: download fail |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### LoadFontFaceOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| global | √ | x | 4.0 |\n| family | √ | 4.10 | 4.0 |\n| source | √ | 4.10 | 4.0 |\n| desc | x | 4.10 | 4.0 |\n| success | √ | 4.10 | 4.0 |\n| fail | √ | 4.10 | 4.0 |\n| complete | √ | 4.10 | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise \\| null | 否 |\n \n","compatibility":"### loadFontFace 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.10 | 4.0 |\n","tutorial":"\n### 参见\n[loadFontFace](https://doc.dcloud.net.cn/uni-app-x/api/load-font-face.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.load-font-face)\n"},"load-font-face":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/load-font-face/load-font-face.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/load-font-face/load-font-face\n>Template\n```vue\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n uniIcon1: '\\ue100',\n uniIcon2: '\\ue101',\n }\n },\n onLoad() {\n uni.loadFontFace({\n global: true,\n family: 'UniFontFamily',\n source: \"url('/static/font/uni.ttf')\",\n success() {\n console.log('global loadFontFace uni.ttf success')\n },\n fail(error) {\n console.warn('global loadFontFace uni.ttf fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiTTF',\n source:\n \"url('https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf')\",\n success() {\n console.log('loadFontFace Remote AlimamaDaoLiTi.ttf success')\n },\n fail(error) {\n console.warn('loadFontFace Remote AlimamaDaoLiTi.ttf fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiOTF',\n source: \"url('/static/font/AlimamaDaoLiTi.otf')\",\n success() {\n console.log('loadFontFace AlimamaDaoLiTi.otf success')\n },\n fail(error) {\n console.warn('loadFontFace AlimamaDaoLiTi.otf fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiWOFF',\n source: \"url('/static/font/AlimamaDaoLiTi.woff')\",\n success() {\n console.log('loadFontFace AlimamaDaoLiTi.woff success')\n },\n fail(error) {\n console.warn('loadFontFace AlimamaDaoLiTi.woff fail', error.errMsg)\n },\n })\n uni.loadFontFace({\n family: 'AlimamaDaoLiTiWOFF2',\n source: \"url('/static/font/AlimamaDaoLiTi.woff2')\",\n success() {\n console.log('loadFontFace AlimamaDaoLiTi.woff2 success')\n },\n fail(error) {\n console.warn('loadFontFace AlimamaDaoLiTi.woff2 fail', error.errMsg)\n },\n })\n },\n methods: {\n navigateToChild() {\n uni.navigateTo({\n url: '/pages/API/load-font-face/load-font-face-child',\n })\n },\n },\n }\n\n```\n:::"},"rpx2px":{"name":"## uni.rpx2px(number) @rpx2px","description":"\n将rpx单位值转换成px","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| number | number | 是 | - | | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| number |\n \n","compatibility":"### rpx2px 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.02 | 4.11 | 4.02 |\n","tutorial":"\n### 参见\n[rpx2px](https://doc.dcloud.net.cn/uni-app-x/api/rpx2px.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.rpx2px)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/rpx2px/rpx2px.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/rpx2px/rpx2px\n>Template\n```vue\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'rpx2px',\n rpxValue: 750,\n pxValue: 0,\n result: false\n }\n },\n methods: {\n rpx2px: function () {\n this.pxValue = uni.rpx2px(this.rpxValue);\n\n // 仅限自动化测试\n const windowInfo = uni.getWindowInfo();\n if (windowInfo.windowWidth == this.pxValue) {\n this.result = true\n }\n }\n }\n }\n\n```\n:::"},"request":{"name":"## uni.request(param) @request","description":"发起网络请求。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| param | [RequestOptions\\](#requestoptions-values) | 是 | - | 网络请求参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 开发者服务器接口地址 |\n@| data | any \\| null | 否 | null | 请求的参数 UTSJSONObject\\|string类型 |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | 设置请求的 header,header 中不能设置 Referer |\n@| method | \"GET\" \\| \"POST\" \\| \"PUT\" \\| \"PATCH\" \\| \"DELETE\" \\| \"HEAD\" \\| \"OPTIONS\" | 否 | \"GET\" | 请求方法
- GET GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。
- POST POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。
- PUT PUT方法用有效载荷请求替换目标资源的所有当前表示。
- PATCH PATCH方法用于对资源应用部分修改。
- DELETE DELETE方法删除指定的资源。
- HEAD HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。
- OPTIONS OPTIONS 方法用于描述目标资源的通信选项。 |\n@| timeout | number \\| null | 否 | 60000 | 超时时间,单位 ms |\n@| withCredentials | boolean \\| null | 否 | - | 跨域请求时是否携带凭证(cookies)
|\n@| firstIpv4 | boolean \\| null | 否 | false | DNS解析时优先使用ipv4 |\n@| success | (option: [RequestSuccess\\](#requestsuccess-values)) => void \\| null | 否 | null | 网络请求成功回调。 |\n@| fail | (option: [RequestFail](#requestfail-values)) => void \\| null | 否 | null | 网络请求失败回调。 |\n@| complete | (option: any) => void \\| null | 否 | null | 网络请求完成回调,成功或者失败都会调用。 | \n\n##### RequestSuccess\\ 的属性值 @requestsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | T \\| null | 否 | - | 开发者服务器返回的数据 |\n| statusCode | number | 是 | - | 开发者服务器返回的 HTTP 状态码 |\n| header | any | 是 | - | 开发者服务器返回的 HTTP Response Header |\n| cookies | Array\\ | 是 | - | 开发者服务器返回的 cookies,格式为字符串数组 |\n\n##### RequestFail 的属性值 @requestfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 5 \\| 1000 \\| 100001 \\| 100002 \\| 600003 \\| 600009 \\| 602001 | 是 | - | 错误码
- 5 接口超时
- 1000 服务端系统错误
- 100001 json数据解析错误
- 100002 错误信息json解析失败
- 600003 网络中断
- 600009 URL格式不合法
- 602001 request系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### RequestOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| withCredentials | x | x | 4.0 |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [RequestTask](#requesttask-values) |\n\n#### RequestTask 的方法 @requesttask-values \n\n#### abort() @abort\n中断网络请求。\n\n\n##### abort 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[abort](https://uniapp.dcloud.net.cn/api/request/request.html#request)\n \n","compatibility":"### request 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[request](https://uniapp.dcloud.net.cn/api/request/request.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.request)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/request/request.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/request/request\n>Template\n```vue\n\r\n\r\n\n```\n>Script\n```uts\n\n class GETDataType {\n data: UTSJSONObject | null = null\n }\n\r\n const duration = 2000\r\n const methodMap = {\r\n \"GET\": \"/api/http/method/get\",\r\n \"POST\": \"/api/http/method/post\",\r\n \"PUT\": \"/api/http/method/put\",\r\n \"DELETE\": \"/api/http/method/delete\",\r\n \"PATCH\": \"/api/http/method/patch\",\r\n \"OPTIONS\": \"/api/http/method/options\",\r\n \"HEAD\": \"/api/http/method/head\"\r\n }\r\n\r\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'request',\r\n res: '',\r\n task: null as RequestTask | null,\r\n host: \"https://request.dcloud.net.cn\",\r\n url: \"/api/http/method/get\",\r\n method: \"GET\" as RequestMethod | null,\r\n data: null as any | null,\r\n header: null as UTSJSONObject | null,\r\n errorCodeUrls: [\r\n \"/api/http/statusCode/200\",\r\n \"/api/http/statusCode/204\",\r\n \"/api/http/statusCode/301\",\r\n \"/api/http/statusCode/302\",\r\n \"/api/http/statusCode/307\",\r\n \"/api/http/statusCode/400\",\r\n \"/api/http/statusCode/401\",\r\n \"/api/http/statusCode/403\",\r\n \"/api/http/statusCode/404\",\r\n \"/api/http/statusCode/405\",\r\n \"/api/http/statusCode/500\",\r\n \"/api/http/statusCode/502\",\r\n \"/api/http/statusCode/503\",\r\n \"/api/http/statusCode/504\",\r\n ],\r\n headerUrls: [\r\n \"/api/http/header/ua\",\r\n \"/api/http/header/referer\",\r\n \"/api/http/header/requestCookie\",\r\n \"/api/http/header/setCookie\",\r\n \"/api/http/header/deleteCookie\"\r\n ],\r\n contentTypeUrls: [\r\n \"/api/http/contentType/text/plain\",\r\n \"/api/http/contentType/text/html\",\r\n \"/api/http/contentType/text/xml\",\r\n \"/api/http/contentType/image/gif\",\r\n \"/api/http/contentType/image/jpeg\",\r\n \"/api/http/contentType/image/png\",\r\n \"/api/http/contentType/application/json\",\r\n \"/api/http/contentType/application/octetStream\",\r\n ],\r\n postUrls: [\r\n \"/api/http/contentType/json\",\r\n \"/api/http/contentType/xWwwFormUrlencoded\",\r\n ],\r\n //自动化测试例专用\r\n jest_result: false\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload() {\r\n uni.hideLoading();\r\n this.task?.abort();\r\n },\r\n methods: {\r\n changeMethod(e : RequestMethod) {\r\n this.method = e;\r\n this.url = methodMap[e] as string;\r\n this.data = null;\r\n this.header = null;\r\n },\r\n changeUrl(e : string) {\r\n this.method = \"GET\";\r\n this.url = e;\r\n this.data = null;\r\n this.header = null;\r\n },\r\n changeUrlFromPost(e : string) {\r\n this.method = \"POST\";\r\n this.url = e;\r\n switch (e) {\r\n case \"/api/http/contentType/json\":\r\n this.header = {\r\n \"Content-Type\": \"application/json\"\r\n };\r\n this.data = {\r\n \"hello\": \"world\"\r\n };\r\n break;\r\n case \"/api/http/contentType/xWwwFormUrlencoded\":\r\n this.header = {\r\n \"Content-Type\": \"application/x-www-form-urlencoded\"\r\n };\r\n this.data = \"hello=world\";\r\n break;\r\n }\r\n },\r\n sendRequest() {\r\n uni.showLoading({\r\n title: \"请求中...\"\r\n })\r\n this.task = uni.request({\r\n url: this.host + this.url,\r\n // dataType: \"json\",\r\n // responseType: \"json\",\r\n method: this.method,\r\n data: this.data,\r\n header: this.header,\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: (res) => {\r\n console.log('request success', JSON.stringify(res.data))\r\n console.log('request success header is :', JSON.stringify(res.header))\r\n uni.showToast({\r\n title: '请求成功',\r\n icon: 'success',\r\n mask: true,\r\n duration: duration\r\n });\r\n this.res = '请求结果 : ' + JSON.stringify(res);\r\n },\r\n fail: (err) => {\r\n console.log('request fail', err);\r\n uni.showModal({\r\n content: err.errMsg,\r\n showCancel: false\r\n });\r\n },\r\n complete: () => {\r\n uni.hideLoading()\r\n },\r\n });\r\n },\r\n //自动化测试例专用\r\n jest_request() {\r\n uni.request({\r\n url: this.host + this.url,\r\n // dataType: \"json\",\r\n // responseType: \"json\",\r\n method: this.method,\r\n data: this.data,\r\n header: this.header,\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_set_cookie() {\r\n uni.request({\r\n url: this.host + \"/api/http/header/setCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_request(true)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_delete_cookie() {\r\n uni.request({\r\n url: this.host + \"/api/http/header/deleteCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_request(false)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_cookie_request(needCookie : boolean) {\r\n uni.request({\r\n url: this.host + \"/api/http/header/requestCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: (res) => {\r\n const requestCookie = (res.data as UTSJSONObject).getJSON(\"data\")?.getAny(\"requestCookie\")\r\n console.log(\"requestCookie \", requestCookie);\r\n if (requestCookie instanceof Array) {\r\n this.jest_result = needCookie ? requestCookie.length > 0 : requestCookie.length == 0\r\n } else {\r\n this.jest_result = needCookie ? (requestCookie as UTSJSONObject).toMap().size > 0 : (requestCookie as UTSJSONObject).toMap().size == 0\r\n }\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_timeout_null() {\r\n uni.request({\r\n url: this.host + (methodMap['GET'] as string),\r\n method: \"GET\",\r\n timeout: null,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\n jest_get_with_data() {\n uni.request({\n url: \"https://unidemo.dcloud.net.cn/api/banner/36kr\",\n method: \"GET\",\n data:{\n column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名\n },\n timeout: 6000,\n sslVerify: false,\n withCredentials: false,\n firstIpv4: false,\n success: () => {\n this.jest_result = true;\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n },\n jest_get_with_generics() {\n uni.request({\n url: this.host + (methodMap['GET'] as string),\n method: \"GET\",\n timeout: null,\n sslVerify: false,\n withCredentials: false,\n firstIpv4: false,\n success: (res: RequestSuccess) => {\n console.log(\"success :\", res.data?.data);\n this.jest_result = true;\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n }\r\n }\r\n }\r\n\n```\n:::"},"uploadFile":{"name":"## uni.uploadFile(options) @uploadfile","description":"将本地资源上传到开发者服务器。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [UploadFileOptions](#uploadfileoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 开发者服务器 url |\n@| filePath | string \\| null | 否 | null | 要上传文件资源的路径, 支持uni.env |\n@| name | string \\| null | 否 | null | 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 |\n@| files | Array\\<[UploadFileOptionFiles](#uploadfileoptionfiles-values)\\> \\| null | 否 | null | 需要上传的文件列表。 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| name | string \\| null | 否 | \"file\" | multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。 |\n@@| uri | string | 是 | - | 要上传文件资源的路径 |\n@@| file | any \\| null | 否 | - | 要上传的文件对象 |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | HTTP 请求 Header, header 中不能设置 Referer |\n@| formData | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | HTTP 请求中其他额外的 form data |\n@| timeout | number \\| null | 否 | 120000 | 超时时间,单位 ms |\n@| success | (result: [UploadFileSuccess](#uploadfilesuccess-values)) => void \\| null | 否 | null | 成功返回的回调函数 |\n@| fail | (result: [UploadFileFail](#uploadfilefail-values)) => void \\| null | 否 | null | 失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 结束的回调函数(调用成功、失败都会执行) | \n\n###### UploadFileOptionFiles 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| file | 3.9 | 4.11 | 4.0 |\n\n##### UploadFileSuccess 的属性值 @uploadfilesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | string | 是 | - | 开发者服务器返回的数据 |\n| statusCode | number | 是 | - | 开发者服务器返回的 HTTP 状态码 |\n\n##### UploadFileFail 的属性值 @uploadfilefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 5 \\| 1000 \\| 100001 \\| 100002 \\| 600003 \\| 600009 \\| 602001 | 是 | - | 错误码
- 5 接口超时
- 1000 服务端系统错误
- 100001 json数据解析错误
- 100002 错误信息json解析失败
- 600003 网络中断
- 600009 URL格式不合法
- 602001 request系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [UploadTask](#uploadtask-values) |\n\n#### UploadTask 的方法 @uploadtask-values \n\n#### abort() @abort\n中断上传任务。\n\n\n##### abort 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[abort](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n\n#### onProgressUpdate(callback) @onprogressupdate\n监听上传进度变化。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnProgressUpdateResult](#onprogressupdateresult-values)) => void | 是 | - | | \n\n##### OnProgressUpdateResult 的属性值 @onprogressupdateresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| progress | number | 是 | - | 上传进度百分比 |\n| totalBytesSent | number | 是 | - | 已经上传的数据长度,单位 Bytes |\n| totalBytesExpectedToSend | number | 是 | - | 预期需要上传的数据总长度,单位 Bytes |\n\n\n##### onProgressUpdate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onProgressUpdate](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n \n","compatibility":"### uploadFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[uploadFile](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.upload-file)\n"},"upload-file":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/upload-file/upload-file.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/upload-file/upload-file\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'uploadFile',\r\n imageSrc: '',\r\n task: null as UploadTask | null,\r\n //自动化测试例专用\r\n jest_result: false,\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload() {\r\n this.imageSrc = '';\r\n uni.hideLoading();\r\n this.task?.abort();\r\n },\r\n methods: {\r\n chooseImage: function () {\r\n uni.chooseImage({\r\n count: 1,\r\n sizeType: ['compressed'],\r\n sourceType: ['album'],\r\n success: (res) => {\r\n console.log('chooseImage success, temp path is', res.tempFilePaths[0])\r\n var imageSrc = res.tempFilePaths[0]\r\n uni.showLoading({\r\n title: '上传中'\r\n })\r\n this.task = uni.uploadFile({\r\n url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址\r\n filePath: imageSrc,\r\n name: 'file',\r\n formData: {\r\n 'user': 'test'\r\n },\r\n success: (res) => {\r\n console.log('uploadImage success, res is:', res)\r\n uni.hideLoading();\r\n uni.showToast({\r\n title: '上传成功',\r\n icon: 'success',\r\n duration: 1000\r\n })\r\n this.imageSrc = imageSrc\r\n },\r\n fail: (err) => {\r\n console.log('uploadImage fail', err);\r\n uni.hideLoading();\r\n uni.showModal({\r\n content: err.errMsg,\r\n showCancel: false\r\n });\r\n },\r\n });\r\n },\r\n fail: (err) => {\r\n console.log('chooseImage fail', err)\r\n }\r\n })\r\n },\r\n //自动化测试例专用\r\n jest_uploadFile() {\r\n const imageSrc = \"/static/uni.png\";\r\n this.task = uni.uploadFile({\r\n url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址\r\n filePath: imageSrc,\r\n name: 'file',\r\n formData: {\r\n 'user': 'test'\r\n },\r\n success: () => {\r\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n })\r\n },\r\n jest_set_cookie() {\r\n uni.request({\r\n url: \"https://request.dcloud.net.cn/api/http/header/setCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_upload(true)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n\r\n jest_delete_cookie() {\r\n uni.request({\r\n url: \"https://request.dcloud.net.cn/api/http/header/deleteCookie\",\r\n method: \"GET\",\r\n timeout: 6000,\r\n sslVerify: false,\r\n withCredentials: false,\r\n firstIpv4: false,\r\n success: () => {\r\n this.jest_cookie_upload(false)\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n });\r\n },\r\n jest_cookie_upload(needCookie : boolean) {\r\n const imageSrc = \"/static/uni.png\";\r\n this.task = uni.uploadFile({\r\n url: 'https://request.dcloud.net.cn/api/http/header/upload',\r\n filePath: imageSrc,\r\n name: 'file',\r\n success: (res : UploadFileSuccess) => {\r\n const data = JSON.parseObject(res.data)\r\n const errCode = data?.getNumber(\"errCode\")\r\n if (errCode != null && errCode == 1000) {\r\n this.jest_result = needCookie ? false : true;\r\n } else {\r\n this.jest_result = needCookie ? true : false;\r\n }\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n })\r\n },\r\n jest_files_upload() {\r\n const imageSrc = \"/static/uni.png\";\r\n this.task = uni.uploadFile({\r\n url: 'https://unidemo.dcloud.net.cn/upload',\r\n files: [\r\n {\r\n name: \"file1\",\r\n uri: imageSrc\r\n } as UploadFileOptionFiles,\r\n {\r\n name: \"file2\",\r\n uri: imageSrc\r\n } as UploadFileOptionFiles\r\n ],\r\n success: (res : UploadFileSuccess) => {\r\n if (res.statusCode == 200) {\r\n this.jest_result = true;\r\n }\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n },\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"downloadFile":{"name":"## uni.downloadFile(options) @downloadfile","description":"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [DownloadFileOptions](#downloadfileoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 下载资源的 url |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | HTTP 请求 Header,header 中不能设置 Referer |\n@| filePath | string \\| null | 否 | null | 指定文件下载路径
支持相对路径与绝对路径,例:
`/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`
并且支持指定下载目录,例:
`/imgs/`
支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env |\n@| timeout | number \\| null | 否 | 120000 | 超时时间,单位 ms |\n@| success | (result: [DownloadFileSuccess](#downloadfilesuccess-values)) => void \\| null | 否 | null | 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} |\n@| fail | (result: [DownloadFileFail](#downloadfilefail-values)) => void \\| null | 否 | null | 失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 结束的回调函数(调用成功、失败都会执行) | \n\n##### DownloadFileSuccess 的属性值 @downloadfilesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tempFilePath | string | 是 | - | 临时文件路径,下载后的文件会存储到一个临时文件 |\n| statusCode | number | 是 | - | 开发者服务器返回的 HTTP 状态码 |\n\n##### DownloadFileFail 的属性值 @downloadfilefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 5 \\| 1000 \\| 100001 \\| 100002 \\| 600003 \\| 600009 \\| 602001 | 是 | - | 错误码
- 5 接口超时
- 1000 服务端系统错误
- 100001 json数据解析错误
- 100002 错误信息json解析失败
- 600003 网络中断
- 600009 URL格式不合法
- 602001 request系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [DownloadTask](#downloadtask-values) |\n\n#### DownloadTask 的方法 @downloadtask-values \n\n#### abort() @abort\n中断下载任务。\n\n\n##### abort 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[abort](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n\n#### onProgressUpdate(callback) @onprogressupdate\n监听下载进度变化。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnProgressDownloadResult](#onprogressdownloadresult-values)) => void | 是 | - | | \n\n##### OnProgressDownloadResult 的属性值 @onprogressdownloadresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| progress | number | 是 | - | 下载进度百分比 |\n| totalBytesWritten | number | 是 | - | 已经下载的数据长度,单位 Bytes |\n| totalBytesExpectedToWrite | number | 是 | - | 预期需要下载的数据总长度,单位 Bytes |\n\n\n##### onProgressUpdate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onProgressUpdate](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n \n","compatibility":"### downloadFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[downloadFile](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.download-file)\n"},"download-file":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/download-file/download-file.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/download-file/download-file\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'downloadFile',\r\n imageSrc: '',\r\n task: null as DownloadTask | null,\r\n //自动化测试例专用\r\n jest_result: false\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload() {\r\n // this.imageSrc = '';\r\n uni.hideLoading();\r\n this.task?.abort();\r\n },\r\n methods: {\r\n downloadImage: function () {\r\n uni.showLoading({\r\n title: '下载中'\r\n })\r\n var self = this\r\n this.task = uni.downloadFile({\r\n url: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png\",\r\n success: (res) => {\r\n console.log('downloadFile success, res is', res.tempFilePath)\r\n self.imageSrc = res.tempFilePath;\r\n uni.hideLoading();\r\n },\r\n fail: (err) => {\r\n console.log('downloadFile fail, err is:', err)\r\n uni.hideLoading();\r\n }\r\n });\r\n this.task?.onProgressUpdate((update) => {\r\n console.log(\"progress : \", update.progress);\r\n })\r\n },\r\n //自动化测试例专用\r\n jest_downloadFile() {\r\n uni.downloadFile({\r\n url: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png\",\r\n success: () => {\r\n this.jest_result = true\r\n },\r\n fail: () => {\r\n this.jest_result = false\r\n }\r\n });\r\n },\n\n jest_set_cookie(){\n uni.request({\n url: \"https://request.dcloud.net.cn/api/http/header/setCookie\",\n method: \"GET\",\n timeout: 6000,\n sslVerify: false,\n withCredentials: true,\n firstIpv4: false,\n success: () => {\n this.jest_cookie_download(true)\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n },\n\n jest_delete_cookie(){\n uni.request({\n url: \"https://request.dcloud.net.cn/api/http/header/deleteCookie\",\n method: \"GET\",\n timeout: 6000,\n sslVerify: false,\n withCredentials: true,\n firstIpv4: false,\n success: () => {\n this.jest_cookie_download(false)\n },\n fail: () => {\n this.jest_result = false;\n },\n });\n },\n jest_cookie_download(needCookie: boolean){\n uni.downloadFile({\n url: \"https://request.dcloud.net.cn/api/http/header/download\",\n success: () => {\n this.jest_result = needCookie ? true : false;\n },\n fail: () => {\n this.jest_result = needCookie ? false : true;\n }\n });\n }\r\n }\r\n }\r\n\n```\n:::"},"getNetworkType":{"name":"## uni.getNetworkType(options) @getnetworktype","description":"获取网络类型","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetNetworkTypeOptions](#getnetworktypeoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: [GetNetworkTypeSuccess](#getnetworktypesuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetNetworkTypeSuccess 的属性值 @getnetworktypesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| networkType | string | 是 | - | 网络类型 |\n","returnValue":"","compatibility":"### getNetworkType 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.06 | 4.0 |\n","tutorial":"\n### 参见\n[getNetworkType](http://uniapp.dcloud.io/api/system/network?id=getnetworktype)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.get-network-type)\n"},"get-network-type":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-network-type/get-network-type.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-network-type/get-network-type\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'getNetworkType',\r\n hasNetworkType: false,\r\n networkType: '',\r\n connectedWifi: '',\r\n //自动化测试例专用\r\n jest_result: false,\r\n }\r\n },\r\n onLoad() {\r\n },\r\n onUnload: function () {\r\n this.networkType = '';\r\n this.hasNetworkType = false;\r\n },\r\n methods: {\r\n getNetworkType: function () {\r\n uni.getNetworkType({\r\n success: (res) => {\r\n console.log(res)\r\n this.hasNetworkType = true;\r\n this.networkType = res.networkType\r\n },\r\n fail: () => {\r\n uni.showModal({\r\n content: '获取失败!',\r\n showCancel: false\r\n })\r\n }\r\n })\r\n },\r\n clear: function () {\r\n this.hasNetworkType = false;\r\n this.networkType = '';\r\n this.connectedWifi = '';\r\n },\r\n //自动化测试例专用\r\n jest_getNetworkType() {\r\n uni.getNetworkType({\r\n success: () => {\r\n this.jest_result = true;\r\n },\r\n fail: () => {\r\n this.jest_result = false;\r\n }\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::"},"connectSocket":{"name":"## connectSocket(options) @connectsocket","description":"创建一个 WebSocket 连接。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ConnectSocketOptions](#connectsocketoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| url | string | 是 | - | 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名 |\n@| header | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) \\| null | 否 | null | 如果属性名存在,且类型为UTSJSONObject返回对应的结果,不存在返回null |\n@| protocols | Array\\ \\| null | 否 | null | 子协议数组 |\n@| success | (result: [ConnectSocketSuccess](#connectsocketsuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [ConnectSocketFail](#connectsocketfail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ConnectSocketSuccess 的属性值 @connectsocketsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n##### ConnectSocketFail 的属性值 @connectsocketfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 - 600009 URL格式不合法 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [SocketTask](#sockettask-values) |\n\n#### SocketTask 的方法 @sockettask-values \n\n#### send(options) @send\n通过 WebSocket 连接发送数据\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SendSocketMessageOptions](#sendsocketmessageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| data | any | 是 | - | 需要发送的内容 |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [SendSocketMessageFail](#sendsocketmessagefail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SendSocketMessageFail 的属性值 @sendsocketmessagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 10001 \\| 10002 \\| 602001 | 是 | - | 错误码
- 10001 发送数据超限,发送队列不能超过16M大小。
- 10002 websocket未连接
- 602001 websocket系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n##### send 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[send](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send)\n\n#### close(options) @close\n关闭 WebSocket 连接\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CloseSocketOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| code | number \\| null | 否 | 1000 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |\n@| reason | string \\| null | 否 | \"\" | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### close 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[close](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close)\n\n#### onOpen(callback) @onopen\n监听 WebSocket 连接打开事件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | **OnSocketOpenCallbackResult** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| header | any | 是 | - | 连接成功的 HTTP 响应 Header | \n\n\n##### onOpen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onOpen](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen)\n\n#### onClose(callback) @onclose\n监听 WebSocket 连接关闭事件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | | \n\n\n##### onClose 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onClose](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose)\n\n#### onError(callback) @onerror\n监听 WebSocket 错误\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 是 | - | | \n\n\n##### onError 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onError](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror)\n\n#### onMessage(callback) @onmessage\n监听 WebSocket 接受到服务器的消息事件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketMessageCallbackResult](#onsocketmessagecallbackresult-values)) => void | 是 | - | | \n\n##### OnSocketMessageCallbackResult 的属性值 @onsocketmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any | 是 | - | 服务器返回的消息 |\n\n\n##### onMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n\n\n##### 参见\n[onMessage](https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage)\n \n","compatibility":"### connectSocket 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[connectSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.connectSocket)\n"},"onSocketOpen":{"name":"## onSocketOpen(options) @onsocketopen","description":"监听WebSocket连接打开事件。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | (result: [OnSocketOpenCallbackResult](#onsocketopencallbackresult-values)) => void | 是 | - | | \n","returnValue":"","compatibility":"### onSocketOpen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketOpen](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketOpen)\n"},"onSocketError":{"name":"## onSocketError(callback) @onsocketerror","description":"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketErrorCallbackResult](#onsocketerrorcallbackresult-values)) => void | 是 | - | | \n\n#### OnSocketErrorCallbackResult 的属性值 @onsocketerrorcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 错误信息 |\n","returnValue":"","compatibility":"### onSocketError 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketError](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketError)\n"},"sendSocketMessage":{"name":"## sendSocketMessage(options) @sendsocketmessage","description":"通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SendSocketMessageOptions](#sendsocketmessageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| data | any | 是 | - | 需要发送的内容 |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [SendSocketMessageFail](#sendsocketmessagefail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SendSocketMessageFail 的属性值 @sendsocketmessagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 10001 \\| 10002 \\| 602001 | 是 | - | 错误码
- 10001 发送数据超限,发送队列不能超过16M大小。
- 10002 websocket未连接
- 602001 websocket系统错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### sendSocketMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[sendSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.sendSocketMessage)\n"},"onSocketMessage":{"name":"## onSocketMessage(callback) @onsocketmessage","description":"监听WebSocket接受到服务器的消息事件。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketMessageCallbackResult](#onsocketmessagecallbackresult-values)) => void | 是 | - | | \n\n#### OnSocketMessageCallbackResult 的属性值 @onsocketmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any | 是 | - | 服务器返回的消息 |\n","returnValue":"","compatibility":"### onSocketMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketMessage](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketMessage)\n"},"closeSocket":{"name":"## closeSocket(options) @closesocket","description":"关闭 WebSocket 连接。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CloseSocketOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| code | number \\| null | 否 | 1000 | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |\n@| reason | string \\| null | 否 | \"\" | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n","returnValue":"","compatibility":"### closeSocket 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[closeSocket](https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.closeSocket)\n"},"onSocketClose":{"name":"## onSocketClose(callback) @onsocketclose","description":"监听WebSocket关闭。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnSocketCloseCallbackResult](#onsocketclosecallbackresult-values)) => void | 是 | - | | \n\n#### OnSocketCloseCallbackResult 的属性值 @onsocketclosecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| code | number | 是 | - | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。\t |\n| reason | string | 是 | - | 一个可读的字符串,表示连接被关闭的原因。\t |\n","returnValue":"","compatibility":"### onSocketClose 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[onSocketClose](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket-global.onSocketClose)\n"},"websocket-global":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/websocket-global/websocket-global.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/websocket-global/websocket-global\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n connected: false,\r\n connecting: false,\r\n msg: '',\r\n roomId: '',\r\n platform: '',\r\n }\r\n },\r\n computed: {\r\n showMsg() : string {\r\n if (this.connected) {\r\n if (this.msg.length > 0) {\r\n return '收到消息:' + this.msg\r\n } else {\r\n return '等待接收消息'\r\n }\r\n } else {\r\n return '尚未连接'\r\n }\r\n },\r\n },\r\n onLoad() {\r\n this.platform = uni.getSystemInfoSync().platform\r\n },\r\n onUnload() {\r\n uni.closeSocket({\r\n code: 1000,\r\n reason: 'close reason from client',\r\n success: (res : any) => {\r\n console.log('uni.closeSocket success', res)\r\n },\r\n fail: (err : any) => {\r\n console.log('uni.closeSocket fail', err)\r\n },\r\n } as CloseSocketOptions)\r\n uni.hideLoading()\r\n },\r\n methods: {\r\n connect() {\r\n if (this.connected || this.connecting) {\r\n uni.showModal({\r\n content: '正在连接或者已经连接,请勿重复连接',\r\n showCancel: false,\r\n })\r\n return\r\n }\r\n this.connecting = true\r\n uni.showLoading({\r\n title: '连接中...',\r\n })\r\n uni.connectSocket({\r\n url: 'ws://websocket.dcloud.net.cn',\r\n header: null,\r\n protocols: null,\r\n success: (res : any) => {\r\n // 这里是接口调用成功的回调,不是连接成功的回调,请注意\r\n console.log('uni.connectSocket success', res)\r\n },\r\n fail: (err : any) => {\r\n // 这里是接口调用失败的回调,不是连接失败的回调,请注意\r\n console.log('uni.connectSocket fail', err)\r\n },\r\n })\r\n uni.onSocketOpen((res) => {\r\n this.connecting = false\r\n this.connected = true\r\n uni.hideLoading()\r\n\r\n uni.showToast({\r\n icon: 'none',\r\n title: '连接成功',\r\n })\r\n console.log('onOpen', res)\r\n })\r\n uni.onSocketError((err) => {\r\n this.connecting = false\r\n this.connected = false\r\n uni.hideLoading()\r\n\r\n uni.showModal({\r\n content: '连接失败,可能是websocket服务不可用,请稍后再试',\r\n showCancel: false,\r\n })\r\n console.log('onError', err)\r\n })\r\n uni.onSocketMessage((res) => {\r\n this.msg = res.data as string\r\n console.log('onMessage', res)\r\n })\r\n uni.onSocketClose((res) => {\r\n this.connected = false\r\n this.msg = ''\r\n console.log('onClose', res)\r\n })\r\n },\r\n send() {\r\n uni.sendSocketMessage({\r\n data:\r\n 'from ' +\r\n this.platform +\r\n ' : ' +\r\n parseInt((Math.random() * 10000).toString()).toString(),\r\n success: (res : any) => {\r\n console.log(res)\r\n },\r\n fail: (err : any) => {\r\n console.log(err)\r\n },\r\n } as SendSocketMessageOptions)\r\n },\r\n close() {\r\n uni.closeSocket({\r\n code: 1000,\r\n reason: 'close reason from client',\r\n success: (res : any) => {\r\n console.log('uni.closeSocket success', res)\r\n },\r\n fail: (err : any) => {\r\n console.log('uni.closeSocket fail', err)\r\n },\r\n } as CloseSocketOptions)\r\n },\r\n },\r\n }\r\n\n```\n:::"},"getSystemInfo":{"name":"## uni.getSystemInfo(options) @getsysteminfo","description":"异步获取系统信息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetSystemInfoOptions](#getsysteminfooptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: [GetSystemInfoResult](#getsysteminforesult-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetSystemInfoResult 的属性值 @getsysteminforesult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| SDKVersion | string | 是 | - | 客户端基础库版本 |\n| appId | string | 是 | - | `manifest.json` 中应用appid。 |\n| appLanguage | string | 是 | - | 应用设置的语言。 |\n| appName | string | 是 | - | `manifest.json` 中应用名称。 |\n| appVersion | string | 是 | - | `manifest.json` 中应用版本名称。 |\n| appVersionCode | string | 是 | - | `manifest.json` 中应用版本名号。 |\n| brand | string | 是 | - | 手机品牌。 |\n| browserName | string | 是 | - | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空 |\n| browserVersion | string | 是 | - | 浏览器版本、webview 版本。 |\n| deviceId | string | 是 | - | 设备 ID |\n| deviceBrand | string | 是 | - | 设备品牌。如:`apple`、`huawei`。 |\n| deviceModel | string | 是 | - | 设备型号 |\n| deviceType | \"phone\" \\| \"pad\" \\| \"tv\" \\| \"watch\" \\| \"pc\" \\| \"undefined\" \\| \"car\" \\| \"vr\" \\| \"appliance\" | 是 | - | 设备类型。 |\n| devicePixelRatio | number | 是 | - | 设备像素比 |\n| deviceOrientation | \"portrait\" \\| \"landscape\" | 是 | - | 设备方向。 |\n| language | string | 是 | - | 程序设置的语言 |\n| model | string | 是 | - | 手机型号 |\n| osName | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 系统名称\t |\n| osVersion | string | 是 | - | 操作系统版本。如 ios 版本,andriod 版本 |\n| osLanguage | string | 是 | - | 操作系统语言 |\n| osTheme | \"light\" \\| \"dark\" | 否 | - | 操作系统主题
|\n| pixelRatio | number | 是 | - | 设备像素比 |\n| platform | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 客户端平台 |\n| screenWidth | number | 是 | - | 屏幕宽度,单位为px |\n| screenHeight | number | 是 | - | 屏幕高度,单位为px |\n| statusBarHeight | number | 是 | - | 状态栏的高度,单位为px |\n| system | string | 是 | - | 操作系统版本 |\n| safeArea | **SafeArea** | 是 | - | 在竖屏正方向下的安全区域 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| left | number | 是 | - | 安全区域左上角横坐标,单位为px |\n@| right | number | 是 | - | 安全区域右下角横坐标,单位为px |\n@| top | number | 是 | - | 安全区域左上角纵坐标,单位为px |\n@| bottom | number | 是 | - | 安全区域右下角纵坐标,单位为px |\n@| width | number | 是 | - | 安全区域的宽度,单位为px |\n@| height | number | 是 | - | 安全区域的高度,单位为px |\n| safeAreaInsets | **SafeAreaInsets** | 是 | - | 在竖屏正方向下的安全区域插入位置 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| left | number | 是 | - | 安全区域左侧插入位置,单位为px |\n@| right | number | 是 | - | 安全区域右侧插入位置,单位为px |\n@| top | number | 是 | - | 安全区顶部插入位置,单位为px |\n@| bottom | number | 是 | - | 安全区域底部插入位置,单位为px |\n| ua | string | 是 | - | 用户标识。小程序端为空 |\n| ~~uniCompileVersion~~ | string | 是 | - | uni 编译器版本 **已废弃,仅为了向下兼容保留** |\n| uniCompilerVersion | string | 是 | - | uni 编译器版本 |\n| uniPlatform | \"app-android\" \\| \"app-ios\" \\| \"web\" \\| \"mp-weixin\" \\| \"mp-alipay\" \\| \"mp-baidu\" \\| \"mp-toutiao\" \\| \"mp-lark\" \\| \"mp-qq\" \\| \"mp-kuaishou\" \\| \"mp-jd\" \\| \"mp-360\" \\| \"quickapp-webview\" \\| \"quickapp-webview-union\" \\| \"quickapp-webview-huawei\" | 是 | - | uni-app 运行平台。 |\n| uniRuntimeVersion | string | 是 | - | uni 运行时版本 |\n| ~~uniCompileVersionCode~~ | number | 是 | - | uni 编译器版本号 **已废弃,仅为了向下兼容保留** |\n| uniCompilerVersionCode | number | 是 | - | uni 编译器版本号 |\n| uniRuntimeVersionCode | number | 是 | - | uni 运行时版本号 |\n| ~~version~~ | string | 是 | - | 引擎版本号。已废弃,仅为了向下兼容保留 **已废弃,仅为了向下兼容保留** |\n| romName | string | 是 | - | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios` |\n| romVersion | string | 是 | - | rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号` |\n| windowWidth | number | 是 | - | 可使用窗口宽度,单位为px |\n| windowHeight | number | 是 | - | 可使用窗口高度,单位为px |\n| windowTop | number | 是 | - | 可使用窗口的顶部位置,单位为px |\n| windowBottom | number | 是 | - | 可使用窗口的底部位置,单位为px |\n| osAndroidAPILevel | number \\| null | 否 | - | Android 系统API库的版本。
|\n\n###### GetSystemInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| osTheme | √ | 4.11 | - |\n| osAndroidAPILevel | √ | x | - |\n","returnValue":"","compatibility":"### getSystemInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getSystemInfo](http://uniapp.dcloud.io/api/system/info?id=getsysteminfo)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-system-info.getSystemInfo)\n"},"getSystemInfoSync":{"name":"## uni.getSystemInfoSync() @getsysteminfosync","description":"同步获取系统信息","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetSystemInfoResult](#getsysteminforesult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SDKVersion | string | 是 | - | 客户端基础库版本 |\n@| appId | string | 是 | - | `manifest.json` 中应用appid。 |\n@| appLanguage | string | 是 | - | 应用设置的语言。 |\n@| appName | string | 是 | - | `manifest.json` 中应用名称。 |\n@| appVersion | string | 是 | - | `manifest.json` 中应用版本名称。 |\n@| appVersionCode | string | 是 | - | `manifest.json` 中应用版本名号。 |\n@| brand | string | 是 | - | 手机品牌。 |\n@| browserName | string | 是 | - | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空 |\n@| browserVersion | string | 是 | - | 浏览器版本、webview 版本。 |\n@| deviceId | string | 是 | - | 设备 ID |\n@| deviceBrand | string | 是 | - | 设备品牌。如:`apple`、`huawei`。 |\n@| deviceModel | string | 是 | - | 设备型号 |\n@| deviceType | \"phone\" \\| \"pad\" \\| \"tv\" \\| \"watch\" \\| \"pc\" \\| \"null\" \\| \"car\" \\| \"vr\" \\| \"appliance\" | 是 | - | 设备类型。 |\n@| devicePixelRatio | number | 是 | - | 设备像素比 |\n@| deviceOrientation | \"portrait\" \\| \"landscape\" | 是 | - | 设备方向。 |\n@| language | string | 是 | - | 程序设置的语言 |\n@| model | string | 是 | - | 手机型号 |\n@| osName | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 系统名称\t |\n@| osVersion | string | 是 | - | 操作系统版本。如 ios 版本,andriod 版本 |\n@| osLanguage | string | 是 | - | 操作系统语言 |\n@| osTheme | \"light\" \\| \"dark\" | 否 | - | 操作系统主题
|\n@| pixelRatio | number | 是 | - | 设备像素比 |\n@| platform | \"ios\" \\| \"android\" \\| \"mac\" \\| \"windows\" \\| \"linux\" | 是 | - | 客户端平台 |\n@| screenWidth | number | 是 | - | 屏幕宽度,单位为px |\n@| screenHeight | number | 是 | - | 屏幕高度,单位为px |\n@| statusBarHeight | number | 是 | - | 状态栏的高度,单位为px |\n@| system | string | 是 | - | 操作系统版本 |\n@| safeArea | **SafeArea** | 是 | - | 在竖屏正方向下的安全区域 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左上角横坐标,单位为px |\n@@| right | number | 是 | - | 安全区域右下角横坐标,单位为px |\n@@| top | number | 是 | - | 安全区域左上角纵坐标,单位为px |\n@@| bottom | number | 是 | - | 安全区域右下角纵坐标,单位为px |\n@@| width | number | 是 | - | 安全区域的宽度,单位为px |\n@@| height | number | 是 | - | 安全区域的高度,单位为px |\n@| safeAreaInsets | **SafeAreaInsets** | 是 | - | 在竖屏正方向下的安全区域插入位置 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左侧插入位置,单位为px |\n@@| right | number | 是 | - | 安全区域右侧插入位置,单位为px |\n@@| top | number | 是 | - | 安全区顶部插入位置,单位为px |\n@@| bottom | number | 是 | - | 安全区域底部插入位置,单位为px |\n@| ua | string | 是 | - | 用户标识。小程序端为空 |\n@| ~~uniCompileVersion~~ | string | 是 | - | uni 编译器版本 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersion | string | 是 | - | uni 编译器版本 |\n@| uniPlatform | \"app-android\" \\| \"app-ios\" \\| \"web\" \\| \"mp-weixin\" \\| \"mp-alipay\" \\| \"mp-baidu\" \\| \"mp-toutiao\" \\| \"mp-lark\" \\| \"mp-qq\" \\| \"mp-kuaishou\" \\| \"mp-jd\" \\| \"mp-360\" \\| \"quickapp-webview\" \\| \"quickapp-webview-union\" \\| \"quickapp-webview-huawei\" | 是 | - | uni-app 运行平台。 |\n@| uniRuntimeVersion | string | 是 | - | uni 运行时版本 |\n@| ~~uniCompileVersionCode~~ | number | 是 | - | uni 编译器版本号 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersionCode | number | 是 | - | uni 编译器版本号 |\n@| uniRuntimeVersionCode | number | 是 | - | uni 运行时版本号 |\n@| ~~version~~ | string | 是 | - | 引擎版本号。已废弃,仅为了向下兼容保留 **已废弃,仅为了向下兼容保留** |\n@| romName | string | 是 | - | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios` |\n@| romVersion | string | 是 | - | rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号` |\n@| windowWidth | number | 是 | - | 可使用窗口宽度,单位为px |\n@| windowHeight | number | 是 | - | 可使用窗口高度,单位为px |\n@| windowTop | number | 是 | - | 可使用窗口的顶部位置,单位为px |\n@| windowBottom | number | 是 | - | 可使用窗口的底部位置,单位为px |\n@| osAndroidAPILevel | number \\| null | 否 | - | Android 系统API库的版本。
|\n##### GetSystemInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| osTheme | √ | 4.11 | - |\n| osAndroidAPILevel | √ | x | - |\n \n","compatibility":"### getSystemInfoSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getSystemInfoSync](http://uniapp.dcloud.io/api/system/info?id=getsysteminfosync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-system-info.getSystemInfoSync)\n"},"get-system-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-system-info/get-system-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-system-info/get-system-info\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n type Item = {\r\n label : string,\r\n value : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'getSystemInfo',\r\n items: [] as Item[],\r\n }\r\n },\r\n onUnload: function () {\r\n },\r\n methods: {\r\n getSystemInfo: function () {\r\n uni.getSystemInfo({\r\n success: (res) => {\r\n this.items = [] as Item[];\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\r\n },\r\n })\r\n },\r\n getSystemInfoSync: function () {\r\n this.items = [] as Item[];\r\n const res = uni.getSystemInfoSync()\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\r\n },\r\n //自动化测试例专用\r\n jest_getSystemInfo() : GetSystemInfoResult {\r\n return uni.getSystemInfoSync();\r\n },\r\n }\r\n }\r\n\n```\n:::"},"getDeviceInfo":{"name":"## uni.getDeviceInfo(options?) @getdeviceinfo","description":"获取设备信息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **GetDeviceInfoOptions** | 否 | 包含所有字段的过滤对象 | [options=包含所有字段的过滤对象\\] 过滤的字段对象, 不传参数默认为获取全部字段。 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filter | Array\\ | 是 | - | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetDeviceInfoResult](#getdeviceinforesult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| brand | string | 否 | - | 设备品牌 |\n@| deviceBrand | string | 否 | - | 设备品牌 |\n@| deviceId | string | 否 | - | 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 |\n@| model | string | 否 | - | 设备型号\t |\n@| deviceModel | string | 否 | - | 设备型号\t |\n@| deviceType | string | 否 | - | 设备类型phone、pad、pc\t |\n@| deviceOrientation | string | 否 | - | 设备方向 竖屏 portrait、横屏 landscape\t |\n@| devicePixelRatio | string | 否 | - | 设备像素比\t |\n@| system | string | 否 | - | 操作系统及版本\t |\n@| platform | string | 否 | - | 客户端平台\t |\n@| isRoot | boolean | 否 | - | 是否root |\n@| isSimulator | boolean | 否 | - | 是否是模拟器 |\n@| isUSBDebugging | boolean | 否 | - | adb是否开启 |\n##### GetDeviceInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| isUSBDebugging | √ | x | - |\n \n","compatibility":"### getDeviceInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getDeviceInfo](https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-device-info)\n"},"get-device-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-device-info/get-device-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-device-info/get-device-info\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { setDevicePixelRatio } from '@/store/index.uts'\r\n\r\n type Item = {\r\n label : string,\r\n value : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'getDeviceInfo',\r\n items: [] as Item[],\r\n }\r\n },\r\n onUnload: function () {\r\n },\r\n methods: {\r\n getDeviceInfo: function () {\r\n const res = uni.getDeviceInfo();\r\n // 获取像素比, 供截图对比使用\r\n setDevicePixelRatio(res.devicePixelRatio !== null ? parseFloat(res.devicePixelRatio!) : 1)\r\n this.items = [] as Item[];\n\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\r\n }\r\n }\r\n }\r\n\n```\n:::"},"getWindowInfo":{"name":"## uni.getWindowInfo() @getwindowinfo","description":"同步获取窗口信息","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetWindowInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| pixelRatio | number | 是 | - | 设备像素比 |\n@| screenWidth | number | 是 | - | 屏幕宽度,单位为px |\n@| screenHeight | number | 是 | - | 屏幕高度,单位为px |\n@| windowWidth | number | 是 | - | 可使用窗口宽度,单位为px |\n@| windowHeight | number | 是 | - | 可使用窗口高度,单位为px |\n@| statusBarHeight | number | 是 | - | 状态栏的高度,单位为px |\n@| windowTop | number | 是 | - | 可使用窗口的顶部位置,单位为px |\n@| windowBottom | number | 是 | - | 可使用窗口的底部位置,单位为px |\n@| safeArea | **SafeArea** | 是 | - | 在竖屏正方向下的安全区域 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左上角横坐标,单位为px |\n@@| right | number | 是 | - | 安全区域右下角横坐标,单位为px |\n@@| top | number | 是 | - | 安全区域左上角纵坐标,单位为px |\n@@| bottom | number | 是 | - | 安全区域右下角纵坐标,单位为px |\n@@| width | number | 是 | - | 安全区域的宽度,单位为px |\n@@| height | number | 是 | - | 安全区域的高度,单位为px |\n@| safeAreaInsets | **SafeAreaInsets** | 是 | - | 在竖屏正方向下的安全区域插入位置 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| left | number | 是 | - | 安全区域左侧插入位置,单位为px |\n@@| right | number | 是 | - | 安全区域右侧插入位置,单位为px |\n@@| top | number | 是 | - | 安全区顶部插入位置,单位为px |\n@@| bottom | number | 是 | - | 安全区域底部插入位置,单位为px |\n@| screenTop | number | 是 | - | 窗口上边缘的 y 值,单位为px | \n","compatibility":"### getWindowInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getWindowInfo](http://uniapp.dcloud.io/api/system/getWindowInfo.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-window-info)\n"},"get-window-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-window-info/get-window-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-window-info/get-window-info\n>Template\n```vue\n\r\n\r\n\r\n\n\n```\n>Script\n```uts\n\r\n import { setStatusBarHeight, setSafeArea } from '@/store/index.uts'\r\n // #ifdef APP-ANDROID\r\n import type { SafeArea } from '@/store/index.uts'\r\n // #endif\r\n\r\n type Item = {\r\n label : string,\r\n value : string,\r\n }\r\n export default {\r\n data() {\r\n return {\r\n title: 'getWindowInfo',\r\n items: [] as Item[],\r\n }\r\n },\r\n onUnload: function () {\r\n },\r\n onReady() {\r\n this.getWindowInfo()\r\n },\r\n methods: {\r\n getWindowInfo: function () {\r\n const res = uni.getWindowInfo();\r\n // 获取状态栏高度, 供截图对比使用\r\n setStatusBarHeight(res.statusBarHeight);\r\n // 获取安全区信息,供截图使用\r\n // #ifdef APP-ANDROID\r\n setSafeArea({\r\n top: res.safeArea.top,\r\n left: res.safeArea.left,\r\n right: res.safeArea.right,\r\n bottom: res.safeArea.bottom,\r\n width: res.safeArea.width,\r\n height: res.safeArea.height,\r\n } as SafeArea);\r\n // #endif\r\n // #ifdef APP-IOS\r\n setSafeArea({\r\n top: res.safeArea.top,\r\n left: res.safeArea.left,\r\n right: res.safeArea.right,\r\n bottom: res.safeArea.bottom,\r\n width: res.safeArea.width,\r\n height: res.safeArea.height,\r\n });\r\n // #endif\r\n this.items = [] as Item[];\r\n\r\n const res_str = JSON.stringify(res);\r\n const res_obj = JSON.parseObject(res_str);\r\n const res_map = res_obj!.toMap();\r\n let keys = [] as string[]\r\n res_map.forEach((_, key) => {\r\n keys.push(key);\r\n });\r\n keys.sort().forEach(key => {\r\n const value = res[key];\r\n if (value != null) {\r\n const item = {\r\n label: key,\r\n value: \"\" + ((typeof value == \"object\") ? JSON.stringify(value) : value)\r\n } as Item;\r\n this.items.push(item);\r\n }\r\n });\r\n },\r\n //自动化测试例专用\r\n jest_getWindowInfo() : GetWindowInfoResult {\r\n return uni.getWindowInfo();\r\n },\r\n }\r\n }\r\n\n```\n:::"},"getAppBaseInfo":{"name":"## uni.getAppBaseInfo(options?) @getappbaseinfo","description":"获取app基本信息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **GetAppBaseInfoOptions** | 否 | 包含所有字段的过滤对象 | [options=包含所有字段的过滤对象\\] 过滤的字段对象, 不传参数默认为获取全部字段。 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filter | Array\\ | 是 | - | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetAppBaseInfoResult](#getappbaseinforesult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| appId | string | 否 | - | manifest.json 中应用appid,即DCloud appid。\t |\n@| appName | string | 否 | - | `manifest.json` 中应用名称。 |\n@| appVersion | string | 否 | - | `manifest.json` 中应用版本名称。 |\n@| appVersionCode | string | 否 | - | `manifest.json` 中应用版本名号。 |\n@| appLanguage | string | 否 | - | 应用设置的语言en、zh-Hans、zh-Hant、fr、es\t |\n@| language | string | 否 | - | 应用设置的语言\t |\n@| ~~version~~ | string | 否 | - | 引擎版本号。已废弃,仅为了向下兼容保留 **已废弃,仅为了向下兼容保留** |\n@| isUniAppX | boolean | 否 | - | 是否uni-app x |\n@| ~~uniCompileVersion~~ | string | 否 | - | uni 编译器版本 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersion | string | 否 | - | uni 编译器版本 |\n@| uniPlatform | \"app\" \\| \"web\" \\| \"mp-weixin\" \\| \"mp-alipay\" \\| \"mp-baidu\" \\| \"mp-toutiao\" \\| \"mp-lark\" \\| \"mp-qq\" \\| \"mp-kuaishou\" \\| \"mp-jd\" \\| \"mp-360\" \\| \"quickapp-webview\" \\| \"quickapp-webview-union\" \\| \"quickapp-webview-huawei\" | 否 | - | uni-app 运行平台。 |\n@| uniRuntimeVersion | string | 否 | - | uni 运行时版本 |\n@| ~~uniCompileVersionCode~~ | number | 否 | - | uni 编译器版本号 **已废弃,仅为了向下兼容保留** |\n@| uniCompilerVersionCode | number | 否 | - | uni 编译器版本号 |\n@| uniRuntimeVersionCode | number | 否 | - | uni 运行时版本号 |\n@| packageName | string | 否 | - | Android的包名 |\n@| bundleId | string | 否 | - | iOS的bundleId |\n@| signature | string | 否 | - | Android: 应用签名证书的SHA1值(全部为小写,中间不包含“:”)。 为了保证应用的安全性,请使用自己生成的证书(不要使用公共测试证书)。 iOS: 应用签名证书中绑定的Bundle ID(AppleID)的md5值(全部为小写)。 |\n##### GetAppBaseInfoResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| uniCompilerVersion | 4.0 | 4.11 | 4.0 |\n| uniCompilerVersionCode | 4.0 | 4.11 | 4.0 |\n| packageName | 3.97 | x | x |\n| bundleId | x | 4.11 | x |\n| signature | 3.97 | 4.11 | x |\n \n","compatibility":"### getAppBaseInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getAppBaseInfo](https://uniapp.dcloud.net.cn/api/system/getAppBaseInfo.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-app-base-info)\n"},"get-app-base-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-app-base-info/get-app-base-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-app-base-info/get-app-base-info\n>Template\n```vue\n\r\n\r\n\r\n\r\n\n```\n>Script\n```uts\n\n\ttype Item = {\n\t\tlabel : string,\n\t\tvalue : string,\n\t}\n\texport default {\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\ttitle: 'getAppBaseInfo',\n\t\t\t\titems: [] as Item[],\r\n\t\t\t}\r\n\t\t},\r\n\t\tonUnload:function(){\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\tgetAppBaseInfo: function () {\n\t\t\t\tconst res = uni.getAppBaseInfo();\n const res_str = JSON.stringify(res);\n const res_obj = JSON.parseObject(res_str);\n const res_map = res_obj!.toMap();\n let keys = [] as string[]\n res_map.forEach((_, key) => {\n keys.push(key);\n });\n\n this.items = [] as Item[];\n keys.sort().forEach( key => {\n const value = res[key];\n if(value != null){\n const item = {\n \tlabel: key,\n \tvalue: \"\" + ((typeof value == \"object\")? JSON.stringify(value) : value)\n } as Item;\n this.items.push(item);\n }\n });\n\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\n```\n:::"},"getAppAuthorizeSetting":{"name":"## uni.getAppAuthorizeSetting() @getappauthorizesetting","description":"获取 APP 授权设置。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [GetAppAuthorizeSettingResult](#getappauthorizesettingresult-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| albumAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" | 否 | - | 允许 App 使用相册的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@| bluetoothAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 使用蓝牙的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `BlueTooth(低功耗蓝牙)` 模块 |\n@| cameraAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 使用摄像头的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台:表示没有配置 `android.permission.CAMERA` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值 |\n@| locationAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 使用定位的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台:表示没有配置 `android.permission.ACCESS_COARSE_LOCATION` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块 |\n@| locationAccuracy | \"reduced\" \\| \"full\" \\| \"unsupported\" | 否 | - | 定位准确度。
- reduced: 模糊定位
- full: 精准定位
- unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块) |\n@| locationReducedAccuracy | boolean \\| null | 否 | - | 定位准确度(推荐使用 locationAccuracy 属性)。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) |\n@| microphoneAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 使用麦克风的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台:表示没有配置 `android.permission.RECORD_AUDIO` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值 |\n@| notificationAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 是 | - | 允许 App 通知的开关
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n@| notificationAlertAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 通知带有提醒的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n@| notificationBadgeAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 通知带有标记的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n@| notificationSoundAuthorized | \"authorized\" \\| \"denied\" \\| \"not determined\" \\| \"config error\" | 否 | - | 允许 App 通知带有声音的开关(仅 iOS 支持)
- authorized: 已经获得授权,无需再次请求授权
- denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
- not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
- config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 |\n##### GetAppAuthorizeSettingResult 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| albumAuthorized | x | 4.11 | - |\n| bluetoothAuthorized | x | 4.11 | - |\n| locationReducedAccuracy | x | 4.11 | - |\n| notificationAlertAuthorized | x | 4.11 | - |\n| notificationBadgeAuthorized | x | 4.11 | - |\n| notificationSoundAuthorized | x | 4.11 | - |\n \n","compatibility":"### getAppAuthorizeSetting 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | x |\n","tutorial":"\n### 参见\n[getAppAuthorizeSetting](http://uniapp.dcloud.io/api/system/getappauthorizesetting)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-app-authorize-setting)\n"},"get-app-authorize-setting":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-app-authorize-setting/get-app-authorize-setting.uvue) \n ```uvue\n\r\n\r\n\r\n\n\n```"},"getSystemSetting":{"name":"## uni.getSystemSetting() @getsystemsetting","description":"获取系统设置","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetSystemSettingResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| bluetoothEnabled | boolean | 否 | - | 蓝牙是否开启 |\n@| bluetoothError | string | 否 | - | 蓝牙的报错信息 |\n@| locationEnabled | boolean | 是 | - | 位置是否开启 |\n@| wifiEnabled | boolean | 否 | - | wifi是否开启 |\n@| wifiError | string | 否 | - | wifi的报错信息 |\n@| deviceOrientation | \"portrait\" \\| \"landscape\" | 是 | - | 设备方向 | \n","compatibility":"### getSystemSetting 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[getSystemSetting](https://uniapp.dcloud.net.cn/api/system/getsystemsetting.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-system-setting)\n"},"get-system-setting":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-system-setting/get-system-setting.uvue) \n ```uvue\n\n\r\n\r\n\r\n\n\n```"},"installApk":{"name":"## uni.installApk(options) @installapk","description":"安装apk","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [InstallApkOptions](#installapkoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | string | 是 | - | apk文件地址 |\n@| success | (res: [InstallApkSuccess](#installapksuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (err: [InstallApkFail](#installapkfail-values)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### InstallApkSuccess 的属性值 @installapksuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 安装成功消息 |\n\n##### InstallApkFail 的属性值 @installapkfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 - 1300002 找不到文件 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### installApk 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.94 | x | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.install-apk)\n"},"install-apk":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/install-apk/install-apk.uvue) \n ```uvue\n\r\n\r\n\n\n```"},"getPushClientId":{"name":"## uni.getPushClientId(options) @getpushclientid","description":"获取客户端唯一的推送标识","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetPushClientIdOptions](#getpushclientidoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (result: [GetPushClientIdSuccess](#getpushclientidsuccess-values)) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetPushClientIdSuccess 的属性值 @getpushclientidsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| cid | string | 是 | - | 个推客户端推送id,对应uni-id-device表的push_clientid |\n| errMsg | string | 是 | - | 错误描述 |\n","returnValue":"","compatibility":"### getPushClientId 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[getPushClientId](http://uniapp.dcloud.io/api/plugins/push.html#getpushclientid)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getPushClientId)\n"},"onPushMessage":{"name":"## uni.onPushMessage(callback) @onpushmessage","description":"启动监听推送消息事件","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnPushMessageCallbackResult](#onpushmessagecallbackresult-values)) => void | 是 | - | | \n\n#### OnPushMessageCallbackResult 的属性值 @onpushmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | \"click\" \\| \"receive\" | 是 | - | 事件类型
- click 从系统推送服务点击消息启动应用事件
- receive 应用从推送服务器接收到推送消息事件 |\n| data | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) | 是 | - | 消息内容 |\n","returnValue":"","compatibility":"### onPushMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[onPushMessage](http://uniapp.dcloud.io/api/plugins/push.html#onpushmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.onPushMessage)\n"},"offPushMessage":{"name":"## uni.offPushMessage(callback) @offpushmessage","description":"关闭推送消息监听事件","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [OnPushMessageCallbackResult](#onpushmessagecallbackresult-values)) => void | 是 | - | | \n\n#### OnPushMessageCallbackResult 的属性值 @onpushmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | \"click\" \\| \"receive\" | 是 | - | 事件类型
- click 从系统推送服务点击消息启动应用事件
- receive 应用从推送服务器接收到推送消息事件 |\n| data | [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md) | 是 | - | 消息内容 |\n","returnValue":"","compatibility":"### offPushMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[offPushMessage](http://uniapp.dcloud.io/api/plugins/push.html#offpushmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.offPushMessage)\n"},"getChannelManager":{"name":"## uni.getChannelManager() @getchannelmanager","description":"获取通知渠道管理器,Android 8系统以上才可以设置通知渠道,Android 8系统以下返回null。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [ChannelManager](#channelmanager-values) |\n\n#### ChannelManager 的方法 @channelmanager-values \n\n#### setPushChannel(options) @setpushchannel\n\n设置推送渠道\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **SetPushChannelOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| soundName | string \\| null | 否 | null | 添加的声音文件,注意raw目录下必须要有 ,不传此字段将使用默认铃音。 |\n@| channelId | string | 是 | - | 通知渠道id |\n@| channelDesc | string | 是 | - | 通知渠道描述 |\n@| enableLights | boolean \\| null | 否 | false | 呼吸灯闪烁 |\n@| enableVibration | boolean \\| null | 否 | false | 震动 |\n@| importance | number \\| null | 否 | 3 | 通知的重要性级别,可选范围IMPORTANCE_LOW:2、IMPORTANCE_DEFAULT:3、IMPORTANCE_HIGH:4 。 |\n@| lockscreenVisibility | number \\| null | 否 | -1000 | 锁屏可见性,可选范围VISIBILITY_PRIVATE:0、VISIBILITY_PUBLIC:1、VISIBILITY_SECRET:-1、VISIBILITY_NO_OVERRIDE:-1000。 | \n\n\n##### setPushChannel 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n\n\n#### getAllChannels() @getallchannels\n\n获取当前应用注册的所有的通知渠道。\n\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Array\\ |\n \n\n##### getAllChannels 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n\n \n","compatibility":"### getChannelManager 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getChannelManager)\n"},"createPushMessage":{"name":"## uni.createPushMessage(options) @createpushmessage","description":"创建本地通知栏消息","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [CreatePushMessageOptions](#createpushmessageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| cover | boolean \\| null | 否 | false | 是否覆盖上一次提示的消息 |\n@| delay | number \\| null | 否 | 0 | 提示消息延迟显示的时间,单位为s |\n@| icon | string \\| null | 否 | null | 推送消息的图标 |\n@| sound | string \\| null | 否 | \"system\" | 推送消息的提示音
- system: 使用系统通知提示音(默认值)
- none: 不使用提示音 |\n@| title | string \\| null | 否 | App的名称 | 推送消息的标题 |\n@| content | string | 是 | - | 消息显示的内容,在系统通知中心中显示的文本内容 |\n@| payload | any \\| null | 否 | null | 消息承载的数据,可根据业务逻辑自定义数据格式 |\n@| when | number \\| null | 否 | 当前时间 | 消息上显示的提示时间 |\n@| channelId | string \\| null | 否 | \"DcloudChannelID\" | 渠道id |\n@| category | string \\| null | 否 | null | 通知类别 |\n@| success | (result: CreatePushMessageSuccess) => void \\| null | 否 | null | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | null | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | null | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### CreatePushMessageOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| channelId | 3.98 | x | - |\n| category | 3.98 | x | - |\n","returnValue":"","compatibility":"### createPushMessage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.98 | x | - |\n","tutorial":"\n### 参见\n[createPushMessage](http://uniapp.dcloud.io/api/plugins/push.html#createpushmessage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.createPushMessage)\n"},"getBatteryInfo":{"name":"## uni.getBatteryInfo(options) @getbatteryinfo","description":"获取电池电量信息\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-getbatteryinfo](https://ext.dcloud.net.cn/plugin?name=uni-getbatteryinfo)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetBatteryInfoOptions](#getbatteryinfooptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [GetBatteryInfoSuccess](#getbatteryinfosuccess-values)) => void | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) |\n@| fail | (res: UniError) => void | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | 接口调用成功的回调 | \n\n##### GetBatteryInfoSuccess 的属性值 @getbatteryinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n| level | number | 是 | - | 设备电量,范围1 - 100 |\n| isCharging | boolean | 是 | - | 是否正在充电中 |\n","returnValue":"","compatibility":"### getBatteryInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-battery-info.getBatteryInfo)\n"},"getBatteryInfoSync":{"name":"## uni.getBatteryInfoSync() @getbatteryinfosync","description":"获取电池电量信息\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-getbatteryinfo](https://ext.dcloud.net.cn/plugin?name=uni-getbatteryinfo)\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetBatteryInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| level | number | 是 | - | 设备电量,范围1 - 100 |\n@| isCharging | boolean | 是 | - | 是否正在充电中 | \n","compatibility":"### getBatteryInfoSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.get-battery-info.getBatteryInfoSync)\n"},"get-battery-info":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-battery-info/get-battery-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-battery-info/get-battery-info\n>Template\n```vue\n\n\n\n\n```\n>Script\n```uts\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tlevel: 0,\n\t\t\t\tisCharging: false\n\t\t\t}\n\t\t},\n\t\tonLoad() {\n\t\t\tuni.getBatteryInfo({\n\t\t\t\tsuccess: res => {\n\t\t\t\t\tthis.level = res.level;\n\t\t\t\t\tthis.isCharging = res.isCharging;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n```\n:::"},"startWifi":{"name":"## uni.startWifi(option) @startwifi","description":"\n初始化Wi-Fi模块\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiOption](#wifioption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### startWifi 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[startWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.startWifi)\n"},"stopWifi":{"name":"## uni.stopWifi(option) @stopwifi","description":"\n关闭 Wi-Fi 模块\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiOption](#wifioption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### stopWifi 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| x | 4.11 | - |\n","tutorial":"\n### 参见\n[stopWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.stopWifi)\n"},"connectWifi":{"name":"## uni.connectWifi(option) @connectwifi","description":"","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiConnectOption](#wificonnectoption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 否 | - | - |\n@| BSSID | string | 否 | - | - |\n@| password | string | 否 | - | - |\n@| maunal | boolean | 否 | - | - |\n@| partialInfo | boolean | 否 | - | - |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### connectWifi 兼容性 \n| Android 系统版本 | Android | iOS | web |\n| :- | :- | :- | :- |\n| >=4.4 && <10.0 | 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[connectWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#connectWifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.connectWifi)\n"},"getWifiList":{"name":"## uni.getWifiList(option) @getwifilist","description":"\n请求获取 Wi-Fi 列表。wifiList 数据会在 onGetWifiList 注册的回调中返回。\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [WifiOption](#wifioption-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### getWifiList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[getWifiList](https://uniapp.dcloud.net.cn/api/system/wifi.html#getWifiList)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.getWifiList)\n"},"onGetWifiList":{"name":"## uni.onGetWifiList(callback) @ongetwifilist","description":"\n监听获取到 Wi-Fi 列表数据事件。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (wifiInfo: any) => void | 是 | - | | \n","returnValue":"","compatibility":"### onGetWifiList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onGetWifiList](https://uniapp.dcloud.net.cn/api/system/wifi.html#onGetWifiList)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onGetWifiList)\n"},"offGetWifiList":{"name":"## uni.offGetWifiList(callback) @offgetwifilist","description":"\n移除获取到 Wi-Fi 列表数据事件的监听函数。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | () => void | 是 | - | | \n","returnValue":"","compatibility":"### offGetWifiList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offGetWifiList](https://uniapp.dcloud.net.cn/api/system/wifi.html#offGetWifiList)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.offGetWifiList)\n"},"getConnectedWifi":{"name":"## uni.getConnectedWifi(option) @getconnectedwifi","description":"\n获取已连接的 Wi-Fi 信息\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | [GetConnectedWifiOptions](#getconnectedwifioptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| partialInfo | boolean | 否 | - | - |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - |\n@| fail | (res: UniError) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### getConnectedWifi 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[getConnectedWifi](https://uniapp.dcloud.net.cn/api/system/wifi.html#getConnectedWifi)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.getConnectedWifi)\n"},"onWifiConnected":{"name":"## uni.onWifiConnected(callback) @onwificonnected","description":"\n监听连接上 Wi-Fi 的事件\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (wifiInfo: [UniWifiResult](#uniwifiresult-values)) => void | 是 | - | | \n\n#### UniWifiResult 的属性值 @uniwifiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | - |\n| errSubject | string | 是 | - | - |\n| errMsg | string | 是 | - | - |\n| wifi | **UniWifiInfo** \\| null | 否 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| SSID | string | 是 | - | - |\n@| BSSID | string | 否 | - | - |\n@| secure | boolean | 否 | - | - |\n@| signalStrength | number | 否 | - | - |\n@| frequency | number | 否 | - | - |\n","returnValue":"","compatibility":"### onWifiConnected 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onWifiConnected](https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnected)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onWifiConnected)\n"},"onWifiConnectedWithPartialInfo":{"name":"## uni.onWifiConnectedWithPartialInfo(callback) @onwificonnectedwithpartialinfo","description":"\n监听连接上 Wi-Fi 的事件。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (wifiInfo: [UniWifiInfoWithPartialInfo](#uniwifiinfowithpartialinfo-values)) => void | 是 | - | | \n\n#### UniWifiInfoWithPartialInfo 的属性值 @uniwifiinfowithpartialinfo-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| SSID | string | 是 | - | - |\n","returnValue":"","compatibility":"### onWifiConnectedWithPartialInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onWifiConnectedWithPartialInfo](https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnectedWithPartialInfo)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onWifiConnectedWithPartialInfo)\n"},"offWifiConnected":{"name":"## uni.offWifiConnected(callback?) @offwificonnected","description":"\n移除连接上 Wi-Fi 的事件的监听函数。\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-wifi](https://ext.dcloud.net.cn/plugin?name=uni-wifi)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | () => void \\| null | 否 | - | | \n","returnValue":"","compatibility":"### offWifiConnected 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offWifiConnected](https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnected)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.offWifiConnected)\n"},"onMemoryWarning":{"name":"## uni.onMemoryWarning(callback) @onmemorywarning","description":"\n开启监听内存警告\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-memorywarning](https://ext.dcloud.net.cn/plugin?name=uni-memorywarning)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [MemoryWarningCallbackResult](#memorywarningcallbackresult-values)) => void | 是 | - | | \n\n#### MemoryWarningCallbackResult 的属性值 @memorywarningcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| level | number | 是 | - | 内存警告等级(仅安卓平台有效,iOS始终是0) |\n","returnValue":"","compatibility":"### onMemoryWarning 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onMemoryWarning](https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.memory.onMemoryWarning)\n"},"offMemoryWarning":{"name":"## uni.offMemoryWarning(callback?) @offmemorywarning","description":"\n取消监听内存不足告警事件\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-memorywarning](https://ext.dcloud.net.cn/plugin?name=uni-memorywarning)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [MemoryWarningCallbackResult](#memorywarningcallbackresult-values)) => void \\| null | 否 | - | | \n\n#### MemoryWarningCallbackResult 的属性值 @memorywarningcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| level | number | 是 | - | 内存警告等级(仅安卓平台有效,iOS始终是0) |\n","returnValue":"","compatibility":"### offMemoryWarning 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offMemoryWarning](https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.memory.offMemoryWarning)\n"},"onUserCaptureScreen":{"name":"## uni.onUserCaptureScreen(callback?) @onusercapturescreen","description":"\n开启截屏监听\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-usercapturescreen](https://ext.dcloud.net.cn/plugin?name=uni-usercapturescreen)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [OnUserCaptureScreenCallbackResult](#onusercapturescreencallbackresult-values)) => void \\| null | 否 | - | | \n\n#### OnUserCaptureScreenCallbackResult 的属性值 @onusercapturescreencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 否 | - | 截屏文件路径(仅Android返回) |\n","returnValue":"","compatibility":"### onUserCaptureScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[onUserCaptureScreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.captureScreen.onUserCaptureScreen)\n"},"offUserCaptureScreen":{"name":"## uni.offUserCaptureScreen(callback?) @offusercapturescreen","description":"\n关闭截屏监听\n\n> 本 API 是 [uni ext api](https://uniapp.dcloud.net.cn/api/extapi.html),需下载插件:[uni-usercapturescreen](https://ext.dcloud.net.cn/plugin?name=uni-usercapturescreen)\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (res: [OnUserCaptureScreenCallbackResult](#onusercapturescreencallbackresult-values)) => void \\| null | 否 | - | | \n\n#### OnUserCaptureScreenCallbackResult 的属性值 @onusercapturescreencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 否 | - | 截屏文件路径(仅Android返回) |\n","returnValue":"","compatibility":"### offUserCaptureScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n","tutorial":"\n### 参见\n[offUserCaptureScreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.captureScreen.offUserCaptureScreen)\n"},"createRequestPermissionListener":{"name":"## uni.createRequestPermissionListener() @createrequestpermissionlistener","description":"创建一个监听权限申请的对象。","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [RequestPermissionListener](#requestpermissionlistener-values) |\n\n#### RequestPermissionListener 的方法 @requestpermissionlistener-values \n\n#### onRequest(callback) @onrequest\n\n监听申请系统权限\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (permissions: Array\\) => void | 是 | - | 申请系统权限回调,permissions为触发权限申请的所有权限 | \n\n\n\n\n#### onConfirm(callback) @onconfirm\n\n监听弹出系统权限授权框\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (permissions: Array\\) => void | 是 | - | 弹出系统权限授权框回调,permissions为触发弹出权限授权框的所有权限 | \n\n\n\n\n#### onComplete(callback) @oncomplete\n\n监听权限申请完成\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (permissions: Array\\) => void | 是 | - | 权限申请完成回调,permissions为申请完成的所有权限 | \n\n\n\n\n#### stop() @stop\n\n取消所有监听\n\n\n\n \n","compatibility":"### createRequestPermissionListener 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.0 | - | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.createRequestPermissionListener)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/create-request-permission-listener/create-request-permission-listener.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"chooseImage":{"name":"## uni.chooseImage(options) @chooseimage","description":"从本地相册选择图片或使用相机拍照","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ChooseImageOptions](#chooseimageoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| count | number \\| null | 否 | 9 | 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。 |\n@| sizeType | Array\\ \\| null | 否 | ['original','compressed'\\] | original 原图,compressed 压缩图,默认二者都有 |\n@| sourceType | Array\\ \\| null | 否 | ['album','camera'\\] | album 从相册选图,camera 使用相机,默认二者都有 |\n@| crop | **ChooseImageCropOptions** \\| null | 否 | - | 图像裁剪参数,设置后 sizeType 失效。 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| width | number | 是 | - | 裁剪的宽度,单位为px,用于计算裁剪宽高比。 |\n@@| height | number | 是 | - | 裁剪的高度,单位为px,用于计算裁剪宽高比。 |\n@@| quality | number \\| null | 否 | 80 | 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。 |\n@@| resize | boolean \\| null | 否 | - | 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。 |\n@| success | (callback: [ChooseImageSuccess](#chooseimagesuccess-values)) => void \\| null | 否 | - | 成功则返回图片的本地文件路径列表 tempFilePaths |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ChooseImageSuccess 的属性值 @chooseimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errSubject | string | 是 | - | 调用API的名称 |\n| errMsg | string | 是 | - | 描述信息 |\n| tempFilePaths | Array\\ | 是 | - | 图片的本地文件路径列表 |\n| tempFiles | any | 是 | - | 图片的本地文件列表 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### chooseImage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[chooseImage](http://uniapp.dcloud.io/api/media/image?id=chooseimage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.choose-image)\n"},"choose-image":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/choose-image/choose-image.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/choose-image/choose-image\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n var sourceTypeArray = [\n ['camera'],\n ['album'],\n ['camera', 'album']\n ]\n var sizeTypeArray = [\n ['compressed'],\n ['original'],\n ['compressed', 'original']\n ]\n export default {\n data() {\n return {\n title: 'choose/previewImage',\n imageList: [] as Array,\n sourceTypeIndex: 2,\n sourceType: ['拍照', '相册', '拍照或相册'],\n sizeTypeIndex: 2,\n sizeType: ['压缩', '原图', '压缩或原图'],\n countIndex: 8,\n count: [1, 2, 3, 4, 5, 6, 7, 8, 9],\n isCrop: false,\n cropPercent: 80,\n cropWidth: 100,\n cropHeight: 100,\n cropResize: false\n }\n },\n onUnload() {\n this.imageList = [];\n this.sourceTypeIndex = 2\n this.sourceType = ['拍照', '相册', '拍照或相册']\n this.sizeTypeIndex = 2\n this.sizeType = ['压缩', '原图', '压缩或原图']\n this.countIndex = 8\n },\n methods: {\n cropHeightConfim(e : InputConfirmEvent) {\n let value = parseInt(e.detail.value)\n if (value > 0) {\n this.cropHeight = value\n } else {\n uni.showToast({\n position: \"bottom\",\n title: \"裁剪高度需要大于0\"\n })\n }\n },\n cropWidthConfim(e : InputConfirmEvent) {\n let value = parseInt(e.detail.value)\n if (value > 0) {\n this.cropWidth = value\n } else {\n uni.showToast({\n position: \"bottom\",\n title: \"裁剪宽度需要大于0\"\n })\n }\n },\n cropPercentConfim(e : InputConfirmEvent) {\n let value = parseInt(e.detail.value)\n if (value > 0 && value <= 100) {\n this.cropPercent = value\n } else {\n uni.showToast({\n position: \"bottom\",\n title: \"请输入0~100之间的值\"\n })\n }\n },\n cropResizeChange(e : UniSwitchChangeEvent) {\n this.cropResize = e.detail.value\n },\n switchCrop(e : UniSwitchChangeEvent) {\n this.isCrop = e.detail.value\n },\n removeImage(index : number) {\n this.imageList.splice(index, 1)\n },\n chooseImageSource() {\n uni.showActionSheet({\n itemList: ['拍照', '相册', '拍照或相册'],\n success: (e) => {\n this.sourceTypeIndex = e.tapIndex!\n }\n })\n },\n chooseImageType() {\n uni.showActionSheet({\n itemList: ['压缩', '原图', '压缩或原图'],\n success: (e) => {\n this.sizeTypeIndex = e.tapIndex!\n }\n })\n },\n chooseImageCount(event : InputConfirmEvent) {\n let count = parseInt(event.detail.value) - 1\n if (count < 0) {\n uni.showToast({\n position: \"bottom\",\n title: \"图片数量应该大于0\"\n })\n return\n }\n this.countIndex = count\n },\n chooseImage: function () {\n // var cropOption:ChooseImageCropOptions|null = this.isCrop ? null : new ChooseImageCropOptions( )\n if (this.imageList.length >= 9) {\n uni.showToast({\n position: \"bottom\",\n title: \"已经有9张图片了,请删除部分图片之后重新选择\"\n })\n return\n }\n uni.chooseImage({\n sourceType: sourceTypeArray[this.sourceTypeIndex],\n sizeType: sizeTypeArray[this.sizeTypeIndex],\n crop: this.isCrop ? { \"quality\": this.cropPercent, \"width\": this.cropWidth, \"height\": this.cropHeight, \"resize\": this.cropResize } as ChooseImageCropOptions : null,\n count: this.imageList.length + this.count[this.countIndex] > 9 ? 9 - this.imageList.length : this.count[this.countIndex],\n success: (res) => {\n this.imageList = this.imageList.concat(res.tempFilePaths);\n },\n fail: (err) => {\n console.log(\"err: \", JSON.stringify(err));\n }\n })\n },\n previewImage: function (index : number) {\n uni.previewImage({\n current: index,\n urls: this.imageList\n })\n }\n }\n }\n\n```\n:::"},"previewImage":{"name":"## uni.previewImage(options) @previewimage","description":"预览图片","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [PreviewImageOptions](#previewimageoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| current | any \\| null | 否 | - | current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。 |\n@| urls | Array\\<[string.ImageURIString](/uts/data-type.md#ide-string)\\> | 是 | - | 需要预览的图片链接列表 |\n@| indicator | string \\| null | 否 | - | 图片指示器样式
- default: 底部圆点指示器
- number: 顶部数字指示器
- none: 不显示指示器 |\n@| loop | boolean \\| null | 否 | - | 是否可循环预览 |\n@| success | (callback: [PreviewImageSuccess](#previewimagesuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### PreviewImageSuccess 的属性值 @previewimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errSubject | string | 是 | - | 调用API的名称 |\n| errMsg | string | 是 | - | 描述信息 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### previewImage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[previewImage](http://uniapp.dcloud.io/api/media/image?id=previewimage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.preview-image.previewImage)\n"},"closePreviewImage":{"name":"## uni.closePreviewImage(options) @closepreviewimage","description":"关闭图片预览","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ClosePreviewImageOptions](#closepreviewimageoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (callback: [ClosePreviewImageSuccess](#closepreviewimagesuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ClosePreviewImageSuccess 的属性值 @closepreviewimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 错误信息 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### closePreviewImage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[closePreviewImage](http://uniapp.dcloud.io/api/media/image?id=closepreviewimage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.preview-image.closePreviewImage)\n"},"preview-image":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/preview-image/preview-image.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/preview-image/preview-image\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : string,\n name : string\n }\n\n export default {\n data() {\n return {\n imageList: [\"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png\", \"/static/uni.png\"],\n indicator: [{\n value: \"default\",\n name: \"圆点\"\n }, {\n value: \"number\",\n name: \"数字\"\n }, {\n value: \"none\",\n name: \"不显示\"\n }] as ItemType[],\n currentIndicator: \"default\",\n isLoop: true\n }\n },\n methods: {\n previewImage(index : number) {\n uni.previewImage({\n urls: this.imageList,\n current: index,\n indicator: this.currentIndicator,\n loop: this.isLoop\n })\n },\n chooseImage() {\n uni.chooseImage({\n sourceType: ['album'],\n success: (e) => {\n this.imageList = this.imageList.concat(e.tempFilePaths)\n },\n fail(_) {\n }\n })\n },\n onIndicatorChanged(e : UniRadioGroupChangeEvent) {\n this.currentIndicator = e.detail.value\n },\n onCheckboxChange(_ : UniCheckboxGroupChangeEvent) {\n this.isLoop = !this.isLoop\n }\n }\n }\n\n```\n:::"},"saveImageToPhotosAlbum":{"name":"## uni.saveImageToPhotosAlbum(options) @saveimagetophotosalbum","description":"保存图片到系统相册","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SaveImageToPhotosAlbumOptions](#saveimagetophotosalbumoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.ImageURIString](/uts/data-type.md#ide-string) | 是 | - | 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径 |\n@| success | (callback: [SaveImageToPhotosAlbumSuccess](#saveimagetophotosalbumsuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SaveImageToPhotosAlbumSuccess 的属性值 @saveimagetophotosalbumsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 是 | - | 保存到相册的图片路径 |\n\n##### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1101001 \\| 1101002 \\| 1101003 \\| 1101004 \\| 1101005 \\| 1101006 \\| 1101007 \\| 1101008 \\| 1101009 \\| 1101010 | 是 | - | 错误码
- 1101001 用户取消
- 1101002 urls至少包含一张图片地址
- 1101003 文件不存在
- 1101004 图片加载失败
- 1101005 未获取权限
- 1101006 图片或视频保存失败
- 1101007 图片裁剪失败
- 1101008 拍照或录像失败
- 1101009 图片压缩失败
- 1101010 其他错误 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### saveImageToPhotosAlbum 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[saveImageToPhotosAlbum](http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.save-image-to-photos-album)\n"},"save-image-to-photos-album":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/save-image-to-photos-album/save-image-to-photos-album.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"getLocation":{"name":"## uni.getLocation(options) @getlocation","description":"获取当前的地理位置、速度","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetLocationOptions](#getlocationoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| type | \"wgs84\" \\| \"gcj02\" \\| \"gps\" | 否 | wgs84 | 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标,web端需配置定位 SDK 信息才可支持 gcj02 |\n@| altitude | boolean \\| null | 否 | false | 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 |\n@| geocode | boolean \\| null | 否 | false | 传入 true 会解析地址 |\n@| highAccuracyExpireTime | number \\| null | 否 | 3000 | 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 |\n@| isHighAccuracy | boolean \\| null | 否 | false | 开启高精度定位 |\n@| success | (result: [GetLocationSuccess](#getlocationsuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [IGetLocationFail](#igetlocationfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetLocationSuccess 的属性值 @getlocationsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| latitude | number | 是 | 0 | 纬度,浮点数,范围为-90~90,负数表示南纬 |\n| longitude | number | 是 | 0 | 经度,范围为-180~180,负数表示西经 |\n| speed | number | 是 | 0 | 速度,浮点数,单位m/s |\n| accuracy | number | 是 | - | 位置的精确度 |\n| altitude | number | 是 | 0 | 高度,单位 m |\n| verticalAccuracy | number | 是 | 0 | 垂直精度,单位 m(Android 无法获取,返回 0) |\n| horizontalAccuracy | number | 是 | 0 | 水平精度,单位 m |\n| address | any \\| null | 否 | null | 地址信息 |\n\n##### IGetLocationFail 的属性值 @igetlocationfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1505004 \\| 1505005 \\| 1505021 \\| 1505022 \\| 1505023 \\| 1505024 \\| 1505025 \\| 1505026 | 是 | - | 错误码
- 1505004 缺失权限
- 1505005 缺失高精度权限授权(iOS特有)
- 1505021 超时
- 1505022 不支持的定位类型
- 1505023 不支持逆地理编码
- 1505024 没有找到具体的定位引擎,请定位开关是否已打开
- 1505025 逆地理编码捕获失败
- 1505026 捕获定位失败 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### getLocation 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | x | 4.0 |\n","tutorial":"\n### 参见\n[getLocation](http://uniapp.dcloud.io/api/location/location?id=getlocation)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.location.get-location)\n"},"get-location":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-location/get-location.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-location/get-location\n>Template\n```vue\n\n\n\n```\n>Script\n```uts\n\n type ItemType = {\n value : 'wgs84' | 'gcj02',\n name : string,\n }\n export default {\n data() {\n return {\n title: 'get-location',\n altitudeSelect: false,\n isHighAccuracySelect: false,\n geocodeSelect: false,\n exeRet: '',\n items: [\n {\n value: 'wgs84',\n name: 'wgs84'\n },\n {\n value: 'gcj02',\n name: 'gcj02'\n }\n ] as ItemType[],\n current: 0,\n }\n },\n methods: {\n altitudeChange: function (e : UniSwitchChangeEvent) {\n this.altitudeSelect = e.detail.value\n },\n geocodeChange: function (e : UniSwitchChangeEvent) {\n this.geocodeSelect = e.detail.value\n },\n highAccuracySelectChange: function (e : UniSwitchChangeEvent) {\n this.isHighAccuracySelect = e.detail.value\n },\n radioChange(e : UniRadioGroupChangeEvent) {\n for (let i = 0; i < this.items.length; i++) {\n if (this.items[i].value === e.detail.value) {\n this.current = i;\n break;\n }\n }\n },\n getLocationTap: function () {\n uni.showLoading({\n title: '定位中'\n })\n uni.getLocation(({\n type: this.items[this.current].value,\n altitude: this.altitudeSelect,\n isHighAccuracy: this.isHighAccuracySelect,\n geocode: this.geocodeSelect,\n success: (res : any) => {\n uni.hideLoading()\n console.log(res);\n this.exeRet = JSON.stringify(res)\n },\n fail: (res : any) => {\n uni.hideLoading()\n console.log(res);\n this.exeRet = JSON.stringify(res)\n },\n complete: (res : any) => {\n uni.hideLoading()\n console.log(res);\n this.exeRet = JSON.stringify(res)\n }\n }));\n\n\n }\n\n }\n }\n\n```\n:::"},"getStorageInfo":{"name":"## uni.getStorageInfo(options) @getstorageinfo","description":"\nuni.getStorageInfo函数定义\n异步获取当前 storage 的相关信息。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetStorageInfoOptions](#getstorageinfooptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [GetStorageInfoSuccess](#getstorageinfosuccess-values)) => void \\| null | 否 | - | uni.getStorageInfo成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.getStorageInfo失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.getStorageInfo完成回调函数定义 | \n\n##### GetStorageInfoSuccess 的属性值 @getstorageinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| keys | Array\\ | 是 | - | 当前 storage 中所有的 key |\n| currentSize | number | 是 | - | 当前占用的空间大小, 单位:kb |\n| limitSize | number | 是 | - | 限制的空间大小, 单位:kb |\n","returnValue":"","compatibility":"### getStorageInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorageInfo](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfo)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageInfo)\n"},"getStorageInfoSync":{"name":"## uni.getStorageInfoSync() @getstorageinfosync","description":"\nuni.getStorageInfoSync函数定义\n同步获取当前 storage 的相关信息。\n\n","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| **GetStorageInfoSuccess** |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| keys | Array\\ | 是 | - | 当前 storage 中所有的 key |\n@| currentSize | number | 是 | - | 当前占用的空间大小, 单位:kb |\n@| limitSize | number | 是 | - | 限制的空间大小, 单位:kb | \n","compatibility":"### getStorageInfoSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorageInfoSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfosync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageInfoSync)\n"},"getStorage":{"name":"## uni.getStorage(options) @getstorage","description":"\nuni.getStorage函数定义\n从本地存储中异步获取指定 key 对应的内容。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetStorageOptions](#getstorageoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| key | string | 是 | - | 本地存储中的指定的 key |\n@| success | (res: [GetStorageSuccess](#getstoragesuccess-values)) => void \\| null | 否 | - | uni.getStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.getStorage失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.getStorage完成回调函数定义 | \n\n##### GetStorageSuccess 的属性值 @getstoragesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any \\| null | 否 | - | key 对应的内容 |\n","returnValue":"","compatibility":"### getStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorage)\n"},"getStorageSync":{"name":"## uni.getStorageSync(key) @getstoragesync","description":"\nuni.getStorageSync函数定义\n从本地存储中同步获取指定 key 对应的内容。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| key | string | 是 | - | 本地存储中的指定的 key | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| any \\| null | 否 |\n \n","compatibility":"### getStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[getStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageSync)\n"},"setStorage":{"name":"## uni.setStorage(options) @setstorage","description":"\nuni.setStorage函数定义\n将数据存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。 \n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **SetStorageOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| key | string | 是 | - | 本地存储中的指定的 key |\n@| data | any | 是 | - | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 |\n@| success | (res: SetStorageSuccess) => void \\| null | 否 | - | uni.setStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.setStorage失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.setStorage完成回调函数定义 | \n","returnValue":"","compatibility":"### setStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.setStorage)\n"},"setStorageSync":{"name":"## uni.setStorageSync(key, data) @setstoragesync","description":"\nuni.setStorageSync函数定义\n将 data 存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| key | string | 是 | - | 本地storage存储中的指定的 key |\n| data | any | 是 | - | 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象 | \n","returnValue":"","compatibility":"### setStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[setStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.setStorageSync)\n"},"removeStorage":{"name":"## uni.removeStorage(options) @removestorage","description":"\nuni.removeStorage函数定义\n从本地存储中异步移除指定 key。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RemoveStorageOptions** | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| key | string | 是 | - | 本地存储中的指定的 key |\n@| success | (res: RemoveStorageSuccess) => void \\| null | 否 | - | uni.removeStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.removeStorage失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.removeStorage完成回调函数定义 | \n","returnValue":"","compatibility":"### removeStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[removeStorage](hhttps://uniapp.dcloud.net.cn/api/storage/storage.html#removestorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.removeStorage)\n"},"removeStorageSync":{"name":"## uni.removeStorageSync(key) @removestoragesync","description":"\nuni.removeStorageSync函数定义\n从本地存储中同步移除指定 key。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| key | string | 是 | - | 本地存储中的指定的 key | \n","returnValue":"","compatibility":"### removeStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[removeStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.removeStorageSync)\n"},"clearStorage":{"name":"## uni.clearStorage(option?) @clearstorage","description":"\nuni.clearStorage函数定义\n清除本地数据存储。\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | **ClearStorageOptions** \\| null | 否 | - | uni.removeStorage参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: ClearStorageSuccess) => void \\| null | 否 | - | uni.clearStorage 成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | uni.clearStorage 失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | uni.clearStorage 完成回调函数定义 | \n","returnValue":"","compatibility":"### clearStorage 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[clearStorage](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.clearStorage)\n"},"clearStorageSync":{"name":"## uni.clearStorageSync() @clearstoragesync","description":"\nuni.clearStorageSync函数定义\n清除本地数据存储。\n","param":"","returnValue":"","compatibility":"### clearStorageSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[clearStorageSync](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.clearStorageSync)\n"},"storage":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/storage/storage.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/storage/storage\n>Template\n```vue\n\n\n\n\n\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'get/set/clearStorage',\n key: '',\n data: '' as any,\n apiGetData: '' as any | null,\n storageInfo: '',\n }\n },\n methods: {\n getStorageInfo() {\n uni.getStorageInfo({\n success: (res) => {\n this.apiGetData = res\n this.storageInfo = JSON.stringify(res)\n },\n })\n },\n getStorageInfoSync() {\n try {\n const res = uni.getStorageInfoSync()\n this.apiGetData = res\n this.storageInfo = JSON.stringify(res)\n } catch (e) {\n // error\n console.log(e)\n }\n },\n jsonLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = JSON.stringify({\n name: \"james\",\n age: 12,\n from: \"american\"\n });\n\n },\n longLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = \"1234567890\"\n },\n floatLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = \"321456.1234567890\"\n },\n negativeLikeMock() {\n this.key = 'key_' + Math.random()\n this.data = \"-321456\"\n },\n strMock() {\n this.key = 'key_' + Math.random()\n this.data = '测试字符串数据,长度为16个字符'\n },\n complexMock() {\n this.key = 'key_' + Math.random()\n let jsonObj = {\n name: '张三',\n age: 12,\n classMate: [\n {\n id: 1001,\n name: '李四',\n },\n {\n id: 1002,\n name: 'jack ma',\n },\n ],\n }\n this.data = jsonObj\n },\n numberMock() {\n this.key = 'key_' + Math.random()\n this.data = 10011\n },\n floatMock() {\n this.key = 'key_' + Math.random()\n this.data = 3.1415926535893384626\n },\n\n keyChange: function (e : InputEvent) {\n this.key = e.detail.value\n },\n dataChange: function (e : InputEvent) {\n this.data = e.detail.value\n },\n getStorage: function () {\n var key = this.key\n if (key.length == 0) {\n uni.showModal({\n title: '读取数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n let that = this\n uni.getStorage({\n key: key,\n success: (res) => {\n\n that.apiGetData = res.data\n let desc : string = typeof this.apiGetData\n if (\"object\" == desc) {\n desc = desc + \": \" + JSON.stringify(this.apiGetData)\n } else {\n desc = desc + \": \" + this.apiGetData\n }\n\n uni.showModal({\n title: '读取数据成功',\n content: desc,\n showCancel: false,\n })\n },\n fail: () => {\n uni.showModal({\n title: '读取数据失败',\n content: '找不到 key 对应的数据',\n showCancel: false,\n })\n },\n })\n }\n },\n getStorageSync: function () {\n var key = this.key\n if (key.length == 0) {\n uni.showModal({\n title: '读取数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n this.apiGetData = uni.getStorageSync(key)\n\n let desc : string = typeof this.apiGetData\n if (\"object\" == desc) {\n desc = desc + \": \" + JSON.stringify(this.apiGetData)\n } else {\n desc = desc + \": \" + this.apiGetData\n }\n\n uni.showModal({\n title: '读取数据成功',\n content: desc,\n showCancel: false,\n })\n }\n },\n setStorage: function () {\n var key = this.key\n var data = this.data\n if (key.length == 0) {\n uni.showModal({\n title: '保存数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n uni.setStorage({\n key: key,\n data: data,\n success: () => {\n uni.showModal({\n title: '存储数据成功',\n showCancel: false,\n })\n },\n fail: () => {\n uni.showModal({\n title: '储存数据失败!',\n showCancel: false,\n })\n },\n })\n }\n },\n setStorageSync: function () {\n var key = this.key\n var data = this.data\n if (key.length == 0) {\n uni.showModal({\n title: '保存数据失败',\n content: 'key 不能为空',\n showCancel: false,\n })\n } else {\n uni.setStorageSync(key, data)\n uni.showModal({\n title: '存储数据成功',\n showCancel: false,\n })\n }\n },\n removeStorage: function () {\n uni.removeStorage({\n key: this.key,\n success: () => {\n uni.showModal({\n title: '移除数据成功',\n showCancel: false,\n })\n },\n fail: () => {\n uni.showModal({\n title: '移除数据失败',\n showCancel: false,\n })\n },\n })\n },\n removeStorageSync: function () {\n uni.removeStorageSync(this.key)\n uni.showModal({\n title: '移除数据成功',\n showCancel: false,\n })\n },\n clearStorage: function () {\n this.key = ''\n this.data = ''\n uni.clearStorage({\n success: function (_) {\n uni.showModal({\n title: '清除数据成功',\n showCancel: false,\n })\n },\n fail: function (_) {\n uni.showModal({\n title: '清除数据失败',\n showCancel: false,\n })\n },\n })\n },\n clearStorageSync: function () {\n this.key = ''\n this.data = ''\n uni.clearStorageSync()\n uni.showModal({\n title: '清除数据成功',\n content: ' ',\n showCancel: false,\n })\n },\n },\n }\n\n```\n:::"},"getFileSystemManager":{"name":"## uni.getFileSystemManager() @getfilesystemmanager","description":"\n获取文件管理器","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [FileSystemManager](#filesystemmanager-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| close | any | 是 | - | 关闭文件 |\n#### FileSystemManager 的方法 @filesystemmanager-values \n\n#### readFile(options) @readfile\n\n读取本地文件内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadFileOptions](#readfileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| encoding | \"base64\" \\| \"utf-8\" | 是 | - | base64 / utf-8 |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件路径,支持相对地址和绝对地址 |\n@| success | (res: [ReadFileSuccessResult](#readfilesuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 通用的错误返回结果回调 |\n@| complete | (res: any) => void \\| null | 否 | - | 通用的结束返回结果回调 | \n\n##### ReadFileSuccessResult 的属性值 @readfilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | string | 是 | - | - |\n\n\n##### readFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### readFileSync(filePath, encoding?) @readfilesync\n\nFileSystemManager.readFile 的同步版本参数\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| encoding | string \\| null | 否 | - | | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### readFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### writeFile(options) @writefile\n\n写文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [WriteFileOptions](#writefileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件路径,只支持绝对地址 |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| data | string | 是 | - | 写入的文本内容 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 通用的正确返回结果回调 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### FileManagerSuccessResult 的属性值 @filemanagersuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n\n\n##### writeFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### writeFileSync(filePath, data, encoding) @writefilesync\n\nFileSystemManager.writeFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| data | string | 是 | - | - |\n| encoding | string | 是 | - | - | \n\n\n##### writeFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### unlink(options) @unlink\n\n删除文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **UnLinkOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件路径,只支持绝对地址 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### unlink 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### unlinkSync(filePath) @unlinksync\n\nFileSystemManager.unlink 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - | \n\n\n##### unlinkSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### mkdir(options) @mkdir\n\n创建目录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **MkDirOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 创建的目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### mkdir 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### mkdirSync(dirPath, recursive) @mkdirsync\n\nFileSystemManager.mkdir 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| dirPath | string | 是 | - | - |\n| recursive | boolean | 是 | - | - | \n\n\n##### mkdirSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### rmdir(options) @rmdir\n\n删除目录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RmDirOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要删除的目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### rmdir 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### rmdirSync(dirPath, recursive) @rmdirsync\n\nFileSystemManager.rmdir 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| dirPath | string | 是 | - | - |\n| recursive | boolean | 是 | - | - | \n\n\n##### rmdirSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readdir(options) @readdir\n\n读取目录内文件列表\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadDirOptions](#readdiroptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的目录路径 (本地路径) |\n@| success | (res: [ReadDirSuccessResult](#readdirsuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ReadDirSuccessResult 的属性值 @readdirsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| files | Array\\ | 是 | - | - |\n\n\n##### readdir 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### readdirSync(dirPath) @readdirsync\n\nFileSystemManager.readdir 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| dirPath | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| Array\\ \\| null | 否 |\n \n\n##### readdirSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### access(options) @access\n\n判断文件/目录是否存在\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **AccessOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要删除的目录路径 (本地路径) |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### access 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### accessSync(path) @accesssync\n\nFileSystemManager.access 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 是 | - | - | \n\n\n##### accessSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### rename(options) @rename\n\n重命名文件。可以把文件从 oldPath 移动到 newPath\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RenameOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| oldPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 源文件路径,支持本地路径 |\n@| newPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 新文件路径,支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### rename 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### renameSync(oldPath, newPath) @renamesync\n\nFileSystemManager.rename 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| oldPath | string | 是 | - | - |\n| newPath | string | 是 | - | - | \n\n\n##### renameSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### copyFile(options) @copyfile\n\n复制文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CopyFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| srcPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 源文件路径,支持本地路径 |\n@| destPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 新文件路径,支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### copyFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### copyFileSync(srcPath, destPath) @copyfilesync\n\nFileSystemManager.copyFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| srcPath | string | 是 | - | - |\n| destPath | string | 是 | - | - | \n\n\n##### copyFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### getFileInfo(options) @getfileinfo\n\n获取该本地临时文件 或 本地缓存文件 信息\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetFileInfoOptions](#getfileinfooptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的文件路径 (本地路径) |\n@| digestAlgorithm | \"md5\" \\| \"sha1\" | 是 | - | md5 / sha1 |\n@| success | (res: [GetFileInfoSuccessResult](#getfileinfosuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetFileInfoSuccessResult 的属性值 @getfileinfosuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| digest | string | 是 | - | - |\n| size | number | 是 | - | - |\n| errMsg | string | 是 | - | - |\n\n\n##### getFileInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### stat(options) @stat\n\n获取文件 Stats 对象\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [StatOptions](#statoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 文件/目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | 是否递归获取目录下的每个文件的 Stats 信息 |\n@| success | (res: [StatSuccessResult](#statsuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### StatSuccessResult 的属性值 @statsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | - |\n| stats | Array\\<[FileStats](#filestats-values)\\> | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| path | string | 是 | - | - |\n@| stats | [Stats](#stats-values) | 是 | - | - |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| mode | number | 是 | - | 文件的类型和存取的权限,对应 POSIX stat.st_mode 注意android中,文件类型只包含是否是目录与文件, 另外在android中这里的权限指的是当前进程对文件或者文件夹是否有读,写,执行的权限, 这里没有与 POSIX stat.st_mode对应的组,其他人等相关权限的数据返回,只有所有者的相关权限 |\n@@| size | number | 是 | - | 文件大小,单位:B,对应 POSIX stat.st_size |\n@@| lastAccessedTime | number | 是 | - | 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime 注意:android中由于系统限制无法获取该数据 |\n@@| lastModifiedTime | number | 是 | - | 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime |\n\n##### Stats 的方法 @stats-values \n\n##### isDirectory() @isdirectory\n\n判断当前文件是否一个目录\n\n###### 返回值 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n\n\n##### isFile() @isfile\n\n判断当前文件是否一个普通文件\n\n###### 返回值 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n\n\n\n##### stat 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n\n\n#### statSync(path, recursive) @statsync\n\nFileSystemManager.stat 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| path | string | 是 | - | - |\n| recursive | boolean | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Array\\<[FileStats](#filestats-values)\\> |\n \n\n##### statSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### appendFile(options) @appendfile\n\n在文件结尾追加内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **AppendFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要追加内容的文件路径 (本地路径) |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| data | string | 是 | - | 要追加的文本 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### appendFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### appendFileSync(filePath, data, encoding) @appendfilesync\n\nFileSystemManager.appendFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| data | string | 是 | - | - |\n| encoding | string | 是 | - | - | \n\n\n##### appendFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### saveFile(options) @savefile\n\n保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [SaveFileOptions](#savefileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| tempFilePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 临时存储文件路径 (本地路径) |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) \\| null | 否 | - | 要存储的文件路径 (本地路径) |\n@| success | (res: [SaveFileSuccessResult](#savefilesuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### SaveFileSuccessResult 的属性值 @savefilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| savedFilePath | string | 是 | - | 存储后的文件路径 (本地路径) |\n\n\n##### saveFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### saveFileSync(tempFilePath, filePath?) @savefilesync\n\nFileSystemManager.saveFile 的同步版本\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tempFilePath | string | 是 | - | - |\n| filePath | string \\| null | 否 | - | | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### saveFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### removeSavedFile(options) @removesavedfile\n\n删除该小程序下已保存的本地缓存文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **RemoveSavedFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 需要删除的文件路径 (本地路径) |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### removeSavedFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### unzip(options) @unzip\n\n解压文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **UnzipFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| zipFilePath | string | 是 | - | 源文件路径,支持本地路径, 只可以是 zip 压缩文件 |\n@| targetPath | string | 是 | - | 目标目录路径, 支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### unzip 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### getSavedFileList(options) @getsavedfilelist\n\n获取该已保存的本地缓存文件列表\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetSavedFileListOptions](#getsavedfilelistoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | (res: [GetSavedFileListResult](#getsavedfilelistresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetSavedFileListResult 的属性值 @getsavedfilelistresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fileList | Array\\ | 是 | - | - |\n\n\n##### getSavedFileList 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### truncate(options) @truncate\n\n对文件内容进行截断操作\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **TruncateFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要截断的文件路径 (本地路径) |\n@| length | number | 是 | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除; 如果 length 大于文件长度,不做处理 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### truncate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### truncateSync(filePath, length?) @truncatesync\n\n对文件内容进行截断操作 (truncate 的同步版本)\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| length | number | 否 | - | - | \n\n\n##### truncateSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readCompressedFile(options) @readcompressedfile\n\n读取指定压缩类型的本地文件内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadCompressedFileOptions](#readcompressedfileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的文件的路径 (本地用户文件或代码包文件) |\n@| compressionAlgorithm | string | 是 | - | 文件压缩类型,目前仅支持 'br'。 |\n@| success | (res: [ReadCompressedFileResult](#readcompressedfileresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### ReadCompressedFileResult 的属性值 @readcompressedfileresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | string | 是 | - | - |\n\n\n##### readCompressedFile 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readCompressedFileSync(filePath, compressionAlgorithm) @readcompressedfilesync\n\n同步读取指定压缩类型的本地文件内容\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | - |\n| compressionAlgorithm | string | 是 | - | - | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### readCompressedFileSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### open(options) @open\n\n打开文件,返回文件描述符\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [OpenFileOptions](#openfileoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要追加内容的文件路径 (本地路径) |\n@| flag | \"a\" \\| \"ax\" \\| \"a+\" \\| \"ax+\" \\| \"r\" \\| \"r+\" \\| \"w\" \\| \"wx\" \\| \"w+\" \\| \"wx\" \\| \"wx+\" | 是 | - | 文件系统标志,默认值: 'r' |\n@| success | (res: [OpenFileSuccessResult](#openfilesuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### OpenFileSuccessResult 的属性值 @openfilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fd | string | 是 | - | - |\n\n\n##### open 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### openSync(options) @opensync\n\n同步打开文件,返回文件描述符\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **OpenFileSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要追加内容的文件路径 (本地路径) |\n@| flag | \"a\" \\| \"ax\" \\| \"a+\" \\| \"ax+\" \\| \"r\" \\| \"r+\" \\| \"w\" \\| \"wx\" \\| \"w+\" \\| \"wx\" \\| \"wx+\" | 是 | - | 文件系统标志,默认值: 'r' | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n\n##### openSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### write(options) @write\n\n写入文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [WriteOptions](#writeoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| data | string | 是 | - | 写入的内容 |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| success | (res: [WriteResult](#writeresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### WriteResult 的属性值 @writeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| bytesWritten | number | 是 | - | 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) |\n\n\n##### write 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### writeSync(options) @writesync\n\n同步写入文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **WriteSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| data | string | 是 | - | 写入的内容 |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [WriteResult](#writeresult-values) |\n \n\n##### writeSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### closeSync(options) @closesync\n\n同步关闭文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **CloseSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 | \n\n\n##### closeSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### fstat(options) @fstat\n\n获取文件的状态信息\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [FStatOptions](#fstatoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| success | (res: [FStatSuccessResult](#fstatsuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### FStatSuccessResult 的属性值 @fstatsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| stats | [Stats](#stats-values) | 是 | - | Stats 对象,包含了文件的状态信息 |\n\n\n##### fstat 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### fstatSync(options) @fstatsync\n\n同步获取文件的状态信息\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **FStatSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 | \n\n##### 返回值 \n\n| 类型 |\n| :- |\n| [Stats](#stats-values) |\n \n\n##### fstatSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### ftruncate(options) @ftruncate\n\n对文件内容进行截断操作\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **FTruncateFileOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 是 | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除; 如果 length 大于文件长度,不做处理 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n##### ftruncate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### ftruncateSync(options) @ftruncatesync\n\n同步对文件内容进行截断操作\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | **FTruncateFileSyncOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| fd | string | 是 | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 是 | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除; 如果 length 大于文件长度,不做处理 | \n\n\n##### ftruncateSync 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n#### readZipEntry(options) @readzipentry\n\n读取压缩包内的文件\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [ReadZipEntryOptions](#readzipentryoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | 要读取的压缩包的路径 (本地路径) |\n@| encoding | \"ascii\" \\| \"base64\" \\| \"utf-8\" | 是 | - | 统一指定读取文件的字符编码,只在 entries 值为\"all\"时有效。
如果 entries 值为\"all\"且不传 encoding,则以 string 格式读取文件的内容 |\n@| entries | Array\\<**EntryItem**\\> \\| null | 否 | - | 要读取的压缩包内的文件列表(当不传入时表示读取压缩包内所有文件) |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| path | string | 是 | - | 压缩包内文件路径 |\n@@| encoding | \"ascii\" \\| \"base64\" \\| \"base64\" | 是 | - | 指定写入文件的字符编码
支持:ascii base64 utf-8 |\n@| success | (res: [EntriesResult](#entriesresult-values)) => void \\| null | 否 | - | 接口调用的回调函数 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### EntriesResult 的属性值 @entriesresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| result | Map\\ | 是 | - | 文件路径 |\n\n\n##### readZipEntry 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.13 | x | x |\n\n\n##### FileSystemManager 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| close | 4.13 | x | x |\n \n","compatibility":"### getFileSystemManager 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.file.filemanager.getFileSystemManager)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-file-system-manager/get-file-system-manager.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"getUniverifyManager":{"name":"## uni.getUniverifyManager() @getuniverifymanager","description":"获取一键登录管理对象","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [UniverifyManager](#univerifymanager-values) |\n\n#### UniverifyManager 的方法 @univerifymanager-values \n\n#### preLogin(options) @prelogin\n预登录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [PreLoginOptions](#preloginoptions-values) | 是 | - | 预登录参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| success | () => void | 否 | - | - |\n@| fail | (err: [PreLoginFail](#preloginfail-values)) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### PreLoginFail 的属性值 @preloginfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1000 \\| 1001 \\| 1002 \\| 1004 \\| 4001 \\| 30004 \\| 30005 \\| 30006 | 是 | - | 1000 当前应用appid尚未开通uni一键登录
1001 应用所有者账号信息异常,请检查账号一键登录服务是否正常
1002 应用所有者账号信息异常,请检查账号余额是否充足
1004 uni一键登录应用不存在
4001 参数异常
30004 其他错误
30005 预登录失败
30006 一键登录失败 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n##### preLogin 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n\n#### login(options) @login\n登录\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [LoginOptions](#loginoptions-values) | 是 | - | 登录参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| univerifyStyle | **UniverifyStyle** | 否 | - | 登录页样式 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| fullScreen | boolean | 否 | - | 是否全屏 |\n@@| logoPath | string | 否 | - | logo路径 |\n@@| backgroundColor | string | 否 | - | 登录页背景色 |\n@@| loginBtnText | string | 否 | - | 登录按钮文字 |\n@| success | (res: [LoginSuccess](#loginsuccess-values)) => void | 否 | - | - |\n@| fail | (err: [LoginFail](#loginfail-values)) => void | 否 | - | - |\n@| complete | (res: any) => void | 否 | - | - | \n\n##### LoginSuccess 的属性值 @loginsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| openId | string | 是 | - | 登录授权唯一标识 |\n| accessToken | string | 是 | - | token |\n\n##### LoginFail 的属性值 @loginfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 1000 \\| 1001 \\| 1002 \\| 1004 \\| 4001 \\| 30004 \\| 30005 \\| 30006 | 是 | - | 1000 当前应用appid尚未开通uni一键登录
1001 应用所有者账号信息异常,请检查账号一键登录服务是否正常
1002 应用所有者账号信息异常,请检查账号余额是否充足
1004 uni一键登录应用不存在
4001 参数异常
30004 其他错误
30005 预登录失败
30006 一键登录失败 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n##### login 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n\n#### close() @close\n关闭登录页\n\n\n##### close 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n\n#### isPreLoginValid() @ispreloginvalid\n预登录是否有效\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n##### isPreLoginValid 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n\n \n","compatibility":"### getUniverifyManager 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.99 | x | - |\n","tutorial":"\n### 参见\n[getUniverifyManager](https://uniapp.dcloud.net.cn/univerify.html#univerifymanager)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.login_verify.univerify.getUniverifyManager)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-univerify-manager/get-univerify-manager.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"getFacialRecognitionMetaInfo":{"name":"## uni.getFacialRecognitionMetaInfo() @getfacialrecognitionmetainfo","description":"获取阿里云实人认证meta info","param":"","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| string |\n \n","compatibility":"### getFacialRecognitionMetaInfo 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.login_verify.facial-recognition-verify.getFacialRecognitionMetaInfo)\n"},"startFacialRecognitionVerify":{"name":"## uni.startFacialRecognitionVerify(faceStyle) @startfacialrecognitionverify","description":"启动人脸识别","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| faceStyle | [StartFacialRecognitionVerifyOptions](#startfacialrecognitionverifyoptions-values) | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| certifyId | string | 是 | - | certifyId 调用实人认证的id |\n@| progressBarColor | string \\| null | 否 | - | 活体检测页面的进度条颜色。 |\n@| screenOrientation | \"land\" \\| \"port\" | 否 | \"port\" | 认证时屏幕方向
- land 横屏
- port 竖屏 |\n@| success | (res: [StartFacialRecognitionVerifySuccess](#startfacialrecognitionverifysuccess-values)) => void \\| null | 否 | - | 成功回调 |\n@| fail | (res: [IFacialRecognitionVerifyError](#ifacialrecognitionverifyerror-values)) => void \\| null | 否 | - | 失败回调 |\n@| complete | (res: any) => void \\| null | 否 | - | 完成回调 | \n\n##### StartFacialRecognitionVerifySuccess 的属性值 @startfacialrecognitionverifysuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 |\n| errSubject | string | 是 | - | 调用API的名称 |\n| errMsg | string | 是 | - | 错误的详细信息 |\n| cause | **SourceError** | 否 | - | 错误来源 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| subject | string \\| null | 否 | - | 源错误模块名称 |\n@| message | string | 是 | - | 源错误描述信息 |\n@| code | number | 是 | - | 源错误的错误码 |\n@| name | string | 是 | - | - |\n@| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | |\n\n##### IFacialRecognitionVerifyError 的属性值 @ifacialrecognitionverifyerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 10010 \\| 10012 \\| 10011 \\| 10013 \\| 10020 \\| 10001 \\| 10002 | 是 | - | 错误码
- 10001 certifyId 不能为空
- 10002 \"当前设备不支持\"
- 10010 刷脸异常
- 10012 网络异常
- 10011 验证中断
- 10013 刷脸验证失败
- 10020 设备设置时间异常 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n##### StartFacialRecognitionVerifyOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| screenOrientation | 3.9 | 4.11 | - |\n","returnValue":"","compatibility":"### startFacialRecognitionVerify 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9 | 4.11 | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.login_verify.facial-recognition-verify.startFacialRecognitionVerify)\n"},"facial-recognition-verify":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/facial-recognition-verify/facial-recognition-verify.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"createRewardedVideoAd":{"name":"## uni.createRewardedVideoAd(option) @createrewardedvideoad","description":"创建激励视频广告对象","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| option | **CreateRewardedVideoAdOptions** | 是 | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| adpid | string | 是 | - | 广告位 id |\n@| urlCallback | **UrlCallbackOptions** \\| null | 否 | - | 服务器回调透传参数 |\n@@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@@| :- | :- | :- | :- | :- |\n@@| userId | string \\| null | 否 | - | 透传到服务器端的userId |\n@@| extra | string \\| null | 否 | - | 透传到服务器端的extra,不推荐设置过于复杂的字符串 | \n","returnValue":"### 返回值 \n\n| 类型 |\n| :- |\n| [RewardedVideoAd](#rewardedvideoad-values) |\n\n#### RewardedVideoAd 的方法 @rewardedvideoad-values \n\n#### show() @show\n\n广告加载成功之后,调用此方法展示广告\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Promise\\ |\n \n\n\n\n#### load() @load\n\n加载广告\n\n##### 返回值 \n\n| 类型 |\n| :- |\n| Promise\\ |\n \n\n\n\n#### destroy() @destroy\n\n销毁广告\n\n\n\n\n#### onLoad(callback) @onload\n\n绑定广告 load 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n\n\n\n#### offLoad(callback) @offload\n\n解除绑定 load 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n\n\n\n#### onError(callback) @onerror\n\n绑定 error 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | \n\n##### IUniAdError 的属性值 @iuniaderror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | number | 是 | - | 错误码 - -5001 广告位标识adpid为空,请传入有效的adpid - -5002 无效的广告位标识adpid,请使用正确的adpid - -5003 广告位未开通广告,请在广告平台申请并确保已审核通过 - -5004 无广告模块,打包时请配置要使用的广告模块 - -5005 广告加载失败,请稍后重试 - -5006 广告已经展示过了,请重新加载 - -5007 广告不可用或已过期,请重新请求 - -5008 广告不可用或已过期,请重新请求 - -5009 广告类型不符,请检查后再试 - -5011 打包或开通的渠道,不支持此类型广告 - -5013 广告播放失败,请重新加载 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n\n\n\n\n#### offError(callback) @offerror\n\n解除绑定 error 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | \n\n\n\n\n#### onClose(callback) @onclose\n\n绑定 close 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [VideoAdClose](#videoadclose-values)) => void | 是 | - | - | \n\n##### VideoAdClose 的属性值 @videoadclose-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| isEnded | boolean | 是 | - | true标识广告播放完毕或者达到发放奖励的条件 |\n\n\n\n\n#### offClose(callback) @offclose\n\n解除绑定 close 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [VideoAdClose](#videoadclose-values)) => void | 是 | - | - | \n\n\n\n\n#### onAdClicked(callback) @onadclicked\n\n绑定广告可点击屏幕区域事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: any) => void | 是 | - | - | \n\n\n\n\n#### onVerify(callback) @onverify\n\n绑定 verify 事件的监听器\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (result: [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md)) => void | 是 | - | - | \n\n\n\n \n","compatibility":"### createRewardedVideoAd 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.0 | - | - |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.ad.createRewardedVideoAd)\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/rewarded-video-ad/rewarded-video-ad.uvue) \n ```uvue\n\n\n\n\n\n\n```"},"requestPayment":{"name":"## uni.requestPayment(options) @requestpayment","description":"请求支付","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [RequestPaymentOptions](#requestpaymentoptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| provider | string | 是 | - | 支付服务提供商,通过 [uni.getProvider](https://doc.dcloud.net.cn/uni-app-x/api/get-provider.html) 获取,目前支持支付宝支付(alipay),微信支付(wxpay) |\n@| orderInfo | string | 是 | - | 订单数据 |\n@| success | (result: [RequestPaymentSuccess](#requestpaymentsuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调函数 |\n@| fail | (result: [IRequestPaymentFail](#irequestpaymentfail-values)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### RequestPaymentSuccess 的属性值 @requestpaymentsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | any \\| null | 否 | - | |\n\n##### IRequestPaymentFail 的属性值 @irequestpaymentfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errCode | 700710 \\| 700711 \\| 700712 \\| 700713 \\| 700714 \\| 700715 \\| 700716 | 是 | - | 错误码
- 700710 正在处理中,支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态
- 700711 订单支付失败。
- 700712 重复请求。
- 700713 用户中途取消。
- 700714 网络连接出错。
- 700715 支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。
- 700716 其它支付错误。 |\n| errSubject | string | 是 | - | 统一错误主题(模块)名称 |\n| data | any \\| null | 否 | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - |\n","returnValue":"","compatibility":"### requestPayment 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.02 | x | x |\n","tutorial":"\n### 参见\n[requestPayment](https://uniapp.dcloud.net.cn/api/plugins/payment.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.payment.requestPayment)\n","example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/request-payment/request-payment.uvue) \n ```uvue\n\r\n\r\n\r\n\r\n\n\n```"},"createWebviewContext":{"name":"## uni.createWebviewContext(webviewId, component?) @createwebviewcontext","description":"创建 web-view 组件的上下文对象,用于操作 web-view 的行为。","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| webviewId | [string.WebviewIdString](/uts/data-type.md#ide-string) | 是 | - | - |\n| component | ComponentPublicInstance \\| null | 否 | - | | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [WebviewContext](#webviewcontext-values) \\| null | 否 |\n\n#### WebviewContext 的方法 @webviewcontext-values \n\n#### back() @back\n后退到 web-view 组件网页加载历史的上一页,如果不存在上一页则没有任何效果。\n\n\n##### back 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### forward() @forward\n前进到 web-view 组件网页加载历史的下一页,如果不存在下一页则没有任何效果。\n\n\n##### forward 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### reload() @reload\n重新加载 web-view 组件当前页面。\n\n\n##### reload 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### stop() @stop\n停止加载 web-view 组件当前网页,该方法不能阻止已经加载的 html 文档,但是能够阻止未完成的图片及延迟加载的资源。\n\n\n##### stop 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n\n#### evalJS(js) @evaljs\n在网页中执行指定的js脚本,在 uvue 页面中可通过此方法向 web-view 组件加载的页面发送数据\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| js | string | 是 | - | - | \n\n\n##### evalJS 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | - |\n\n \n","compatibility":"### createWebviewContext 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | x |\n","tutorial":"\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.create-webview-context)\n"},"createVideoContext":{"name":"## uni.createVideoContext(videoId, component?) @createvideocontext","description":"创建并返回 video 上下文 videoContext 对象","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| videoId | [string.VideoIdString](/uts/data-type.md#ide-string) | 是 | - | - |\n| component | ComponentPublicInstance \\| null | 否 | - | | \n","returnValue":"### 返回值 \n\n| 类型 | 必备 |\n| :- | :- |\n| [VideoContext](#videocontext-values) \\| null | 否 |\n\n#### VideoContext 的方法 @videocontext-values \n\n#### play() @play\n播放\n\n\n##### play 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### pause() @pause\n暂停\n\n\n##### pause 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### seek(position) @seek\n跳转到指定位置\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| position | number | 是 | - | 跳转到指定位置(秒) | \n\n\n##### seek 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### stop() @stop\n停止视频\n\n\n##### stop 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### sendDanmu(danmu) @senddanmu\n发送弹幕\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| danmu | **Danmu** | 是 | - | text, color |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| text | string \\| null | 否 | - | 弹幕文字 |\n@| color | string \\| null | 否 | - | 弹幕颜色 |\n@| time | number \\| null | 否 | - | 显示时刻 | \n\n\n##### sendDanmu 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### playbackRate(rate) @playbackrate\n设置倍速播放\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| rate | number | 是 | - | , 支持倍率 0.5/0.8/1.0/1.25/1.5 | \n\n\n##### playbackRate 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### requestFullScreen(direction?) @requestfullscreen\n进入全屏\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| direction | [RequestFullScreenOptions](#requestfullscreenoptions-values) | 否 | - | , 0\\|正常竖向, 90\\|屏幕逆时针90度, -90\\|屏幕顺时针90度 |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| direction | number \\| null | 否 | - | direction
- 0: 正常竖向
- 90: 屏幕逆时针90度
- -90: 屏幕顺时针90度 | \n\n###### RequestFullScreenOptions 兼容性 \n| | Android | iOS | web |\n| :- | :- | :- | :- |\n| direction | 3.9.0 | 4.11 | x |\n\n\n##### requestFullScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n\n#### exitFullScreen() @exitfullscreen\n退出全屏\n\n\n##### exitFullScreen 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 3.9.0 | 4.11 | 4.0 |\n\n \n","compatibility":"### createVideoContext 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| √ | 4.11 | 4.0 |\n","tutorial":"\n### 参见\n[createVideoContext](http://uniapp.dcloud.io/api/media/video-context?id=createVideoContext)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.create-video-context)\n"},"getProvider":{"name":"## uni.getProvider(options) @getprovider","description":"\n获取服务供应商","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [GetProviderOptions](#getprovideroptions-values) | 是 | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 描述 |\n@| :- | :- | :- | :- | :- |\n@| service | \"oauth\" \\| \"share\" \\| \"payment\" \\| \"push\" \\| \"location\" | 是 | - | 服务类型,可取值“oauth”、“share”、“payment”、“push”、“location”
- oauth: 授权登录
- share: 分享
- payment: 支付
- push: 推送
- location: 定位 |\n@| success | (result: [GetProviderSuccess](#getprovidersuccess-values)) => void \\| null | 否 | - | 接口调用成功的回调 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void \\| null | 否 | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void \\| null | 否 | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n##### GetProviderSuccess 的属性值 @getprovidersuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| service | \"oauth\" \\| \"share\" \\| \"payment\" \\| \"push\" \\| \"location\" | 是 | - | 服务类型
- oauth: 授权登录
- share: 分享
- payment: 支付
- push: 推送
- location: 定位 |\n| provider | Array\\ | 是 | - | 得到的服务供应商 |\n| errMsg | string | 是 | - | 描述信息 |\n","returnValue":"","compatibility":"### getProvider 兼容性 \n| Android | iOS | web |\n| :- | :- | :- |\n| 4.11 | x | 4.05 |\n","tutorial":"\n### 参见\n[getProvider](https://doc.dcloud.net.cn/uni-app-x/api/get-provider.html)\n\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.tripartite.get-provider)\n"},"get-provider":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/get-provider/get-provider.uvue) \n ```uvue\n\r\n\r\n\r\n\r\n\n\n```"},"general_type":{"name":"## 通用类型\n","param":"### GeneralCallbackResult \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| errMsg | string | 是 | - | 错误信息 |\n"}} \ No newline at end of file