utsApiJson.json 1002.4 KB
Newer Older
1
{"getApp":{"name":"## function getApp\\<T extends EditorCreateVueAppComponentX = AppCreateVueAppComponentDefault>(): UniApp & {    globalData: AppInstance\\<T>\\['globalData']    vm: AppInstance\\<T>    $vm: AppInstance\\<T>  } @getapp","description":"`getApp()` 函数用于获取当前应用实例,可通过应用实例调用 App.uvue methods 中定义的方法。","compatibility":"### getApp 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | √ |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [UniApp](#uniapp-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| $vm | ComponentPublicInstance | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | App vue 实例对象 |\n@| vm | ComponentPublicInstance | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | App vue 实例对象 |\n@| globalData | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 全局对象 |\n#### UniApp 的方法 @uniapp-values \n\n#### getAndroidApplication(): Application @getandroidapplication\n获取 Android 应用 Application 上下文\n##### getAndroidApplication 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | x |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Application |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.global.getApp)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/tutorial/page.html#getapp)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getApp&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getApp&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getApp&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getApp&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getApp&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getApp)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getApp&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-app/get-app\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1; padding-bottom: 20px\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head title=\"getApp\"></page-head>\r\n      <view class=\"uni-padding-wrap\">\r\n        <button @click=\"getGlobalData\">get globalData</button>\r\n        <template v-if=\"originGlobalData.str.length\">\r\n          <text class=\"uni-common-mt bold\">初始的 globalData:</text>\r\n          <text class=\"uni-common-mt\">globalData string: {{ originGlobalData.str }}</text>\r\n          <text class=\"uni-common-mt\">globalData number: {{ originGlobalData.num }}</text>\r\n          <text class=\"uni-common-mt\">globalData boolean: {{ originGlobalData.bool }}</text>\r\n          <text class=\"uni-common-mt\">globalData object: {{ originGlobalData.obj }}</text>\r\n          <text class=\"uni-common-mt\">globalData null: {{ originGlobalData.null }}</text>\r\n          <text class=\"uni-common-mt\">globalData array: {{ originGlobalData.arr }}</text>\r\n          <text class=\"uni-common-mt\">globalData Set: {{ originGlobalData.mySet }}</text>\r\n          <text class=\"uni-common-mt\">globalData Map: {{ originGlobalData.myMap }}</text>\r\n          <text class=\"uni-common-mt\">globalData func 返回值: {{ originGlobalDataFuncRes }}</text>\r\n        </template>\r\n        <button @click=\"setGlobalData\" class=\"uni-common-mt\">\r\n          set globalData\r\n        </button>\r\n        <template v-if=\"newGlobalData.bool\">\r\n          <text class=\"uni-common-mt bold\">更新后的 globalData:</text>\r\n          <text class=\"uni-common-mt\">globalData string: {{ newGlobalData.str }}</text>\r\n          <text class=\"uni-common-mt\">globalData number: {{ newGlobalData.num }}</text>\r\n          <text class=\"uni-common-mt\">globalData boolean: {{ newGlobalData.bool }}</text>\r\n          <text class=\"uni-common-mt\">globalData object: {{ newGlobalData.obj }}</text>\r\n          <text class=\"uni-common-mt\">globalData null: {{ newGlobalData.null }}</text>\r\n          <text class=\"uni-common-mt\">globalData array: {{ newGlobalData.arr }}</text>\r\n          <text class=\"uni-common-mt\">globalData Set: {{ newGlobalData.mySet }}</text>\r\n          <text class=\"uni-common-mt\">globalData Map: {{ newGlobalData.myMap }}</text>\r\n          <text class=\"uni-common-mt\">globalData func 返回值: {{ newGlobalDataFuncRes }}</text>\r\n        </template>\r\n        <text class=\"uni-common-mt\">点击按钮调用 App.uvue methods</text>\r\n        <text class=\"uni-common-mt\">increasetLifeCycleNum 方法</text>\r\n        <button class=\"uni-common-mt\" @click=\"_increasetLifeCycleNum\">\n          increase lifeCycleNum\n        </button>\r\n        <text class=\"uni-common-mt\">lifeCycleNum: {{ lifeCycleNum }}</text>\n        <button class=\"uni-common-mt\" @click=\"checkGetAndroidApplication\">\n          check getAndroidApplication\n        </button>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .bold {\r\n    font-weight: bold;\r\n  }\r\n\r\n  .hr {\r\n    border-bottom: 1px solid #ccc;\r\n  }\r\n</style>\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.vm!.increasetLifeCycleNum()\r\n        this.lifeCycleNum = state.lifeCycleNum\r\n      },\r\n      // 自动化测试\r\n      setLifeCycleNum(num : number) {\r\n        setLifeCycleNum(num)\r\n      },\n      checkGetAndroidApplication() : boolean {\n        // #ifdef APP-ANDROID\n        const res = true\n        // #endif\n        // #ifndef APP-ANDROID\n        const app = getApp()\n        const androidApplication = app.getAndroidApplication()\n        const res = androidApplication == null\n        // #endif\n        console.log('check getAndroidApplication', res)\n        return res\n      }\r\n    },\r\n  }\r\n\n```\n\n:::"},"getCurrentPages":{"name":"## () => UniPage[\\] @getcurrentpages","description":"`getCurrentPages()` 函数用于获取当前页面栈的实例,以数组形式按栈的顺序给出,数组中的元素为页面实例,第一个元素为首页,最后一个元素为当前页面。","compatibility":"### getCurrentPages 兼容性 \n| Web | Android | Android uni-app x UTS 插件 | iOS |\n| :- | :- | :- | :- |\n| 4.0 | 3.9 | 4.31 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[UniPage](#unipage-values)\\> |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| route | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由地址 |\n@| options | UTSJSONObject | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由参数信息 |\n@| vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n@| $vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n#### UniPage 的方法 @unipage-values \n\n#### getPageStyle(): UTSJSONObject @getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### getPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n\n#### setPageStyle(style: UTSJSONObject): void @setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### setPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n#### getParentPage(): UniPage \\| null @getparentpage\n获取所属父页面\n##### getParentPage 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniPage](#unipage-values) | 否 |\n \n\n#### getDialogPages(): UniPage[\\] @getdialogpages\n获取当前页面的 dialog 子页面集合\n##### getDialogPages 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[UniPage](#unipage-values)\\> |\n \n\n#### getElementById(id: string.IDString \\| string): UniElement \\| null @getelementbyid\n返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n\n##### getElementById 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | [string.IDString](/uts/data-type.md#ide-string) \\| string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n#### getAndroidView(): View \\| null @getandroidview\n返回 android 平台页面根 view\n\n##### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | x |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| View | 否 |\n \n\n#### getHTMLElement(): UniElement \\| null @gethtmlelement\n返回页面 HTML Element 对象\n\n##### getHTMLElement 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | x | x |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n#### ~~$setPageStyle(style: UTSJSONObject): void~~ @$setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n##### $setPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n#### ~~$getPageStyle(): UTSJSONObject~~ @$getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n##### $getPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.global.getCurrentPages)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/tutorial/page.html#getcurrentpages)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getCurrentPages&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getCurrentPages&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getCurrentPages&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getCurrentPages&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getCurrentPages&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getCurrentPages)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getCurrentPages&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-current-pages/get-current-pages\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head title=\"getCurrentPages\"></page-head>\r\n      <view class=\"uni-padding-wrap\">\r\n        <button @click=\"_getCurrentPages\">getCurrentPages</button>\r\n        <view v-if=\"pages.length\" style=\"padding: 15px 0px\">\r\n          <text>当前页面栈中 {{ pages.length }} 个页面,列表如下:</text>\r\n          <template v-for=\"(page, index) in pages\" :key=\"page.route\">\r\n            <text style=\"margin-top: 5px\">index: {{ index }}, route: {{ page.route }}</text>\r\n          </template>\r\n        </view>\r\n        <button class=\"uni-common-mt\" @click=\"check$page\">check $page</button>\r\n        <button class=\"uni-common-mt\" @click=\"checkGetParentPage\">\r\n          check getParentPage\r\n        </button>\r\n        <button class=\"uni-common-mt\" @click=\"checkGetDialogPages\">\r\n          check getDialogPages\r\n        </button>\r\n        <button id=\"check-get-element-by-id-btn\" class=\"uni-common-mt\" @click=\"checkGetElementById\">\r\n          check getElementById\r\n        </button>\r\n        <button class=\"uni-common-mt\" @click=\"checkGetAndroidView\">\r\n          check getAndroidView\r\n        </button>\r\n      </view>\r\n\r\n      <page-head title=\"currentPageStyle\"></page-head>\r\n      <template v-for=\"(item, index) in PageStyleArray\">\r\n        <view class=\"page-style-item\" v-if=\"currentPageStyle[item.key] != null\" :key=\"index\">\r\n          <view class=\"item-text\">\r\n            <text class=\"item-text-key\">{{ item.key }}:</text>\r\n            <text class=\"item-text-value\">{{\r\n              currentPageStyle[item.key]\r\n            }}</text>\r\n          </view>\r\n          <view class=\"set-value\" v-if=\"item.type == 'boolean'\">\r\n            <switch :checked=\"currentPageStyle.getBoolean(item.key)\"\r\n              @change=\"switchChange(item.key, $event as UniSwitchChangeEvent)\">\r\n            </switch>\r\n          </view>\r\n          <view class=\"set-value\" v-else-if=\"item.type == 'number'\">\r\n            <slider :value=\"currentPageStyle.getNumber(item.key)\" :show-value=\"true\"\r\n              @change=\"sliderChange(item.key, $event as UniSliderChangeEvent)\" />\r\n          </view>\r\n          <view class=\"set-value\" v-else-if=\"item.type == 'string'\">\r\n            <radio-group class=\"radio-set-value\" @change=\"radioChange(item.key, $event as RadioGroupChangeEvent)\">\r\n              <radio class=\"radio-value\" v-for=\"(item2, index2) in item.value\" :key=\"index2\" :value=\"item2\">{{ item2 }}\r\n              </radio>\r\n            </radio-group>\r\n          </view>\r\n        </view>\r\n      </template>\r\n      <button style=\"margin: 10px\" @click=\"goSetDisablePullDownRefresh\">\r\n        go set disable pullDownRefresh\r\n      </button>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .page {\r\n    flex: 1;\r\n    padding: 10px;\r\n  }\r\n\r\n  .page-style {\r\n    margin-top: 15px;\r\n  }\r\n\r\n  .page-style-item {\r\n    padding: 10px;\r\n    margin-top: 10px;\r\n    background-color: #ffffff;\r\n    border-radius: 5px;\r\n  }\r\n\r\n  .item-text {\r\n    flex-direction: row;\r\n  }\r\n\r\n  .item-text-key {\r\n    font-weight: bold;\r\n  }\r\n\r\n  .item-text-value {\r\n    margin-left: 5px;\r\n  }\r\n\r\n  .set-value {\r\n    margin-top: 10px;\r\n  }\r\n\r\n  .radio-set-value {\r\n    flex-direction: row;\r\n  }\r\n\r\n  .radio-value {\r\n    margin-left: 10px;\r\n  }\r\n</style>\r\n\n```\n\n>Script\n```uts\n\r\n  import { PageStyleItem, PageStyleArray } from './page-style.uts';\r\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        PageStyleArray: PageStyleArray as PageStyleItem[],\r\n        currentPageStyle: {} as UTSJSONObject,\r\n        testing: false\r\n      }\r\n    },\r\n    computed: {\r\n      pageStyleText() : string {\r\n        return JSON.stringify(this.currentPageStyle)\r\n      }\r\n    },\r\n    onLoad(options : OnLoadOptions) {\r\n      // #ifndef APP-ANDROID\r\n      if (options instanceof UTSJSONObject) {\r\n        this.checked = true\r\n      }\r\n      // #endif\r\n      // #ifdef APP-ANDROID\r\n      this.checked = true\r\n      // #endif\r\n      this.getPageStyle();\r\n    },\r\n    onPullDownRefresh() {\r\n      setTimeout(() => {\r\n        uni.stopPullDownRefresh()\r\n      }, 2000)\r\n    },\r\n    methods: {\r\n      startPullDownRefresh() {\r\n        uni.startPullDownRefresh()\r\n      },\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.checked && (this.pages[0].route.includes('/tabBar/') || this.pages[0].route == '/')) {\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      /// get-set-page-style\r\n      radioChange(key : string, e : RadioGroupChangeEvent) {\r\n        this.setStyleValue(key, e.detail.value);\r\n      },\r\n      sliderChange(key : string, e : UniSliderChangeEvent) {\r\n        this.setStyleValue(key, e.detail.value);\r\n      },\r\n      switchChange(key : string, e : UniSwitchChangeEvent) {\r\n        this.setStyleValue(key, e.detail.value);\r\n      },\r\n      setStyleValue(key : string, value : any) {\r\n        const style = {}\r\n        style[key] = value\r\n        this.setPageStyle(style)\r\n        this.getPageStyle()\r\n      },\r\n      getPageStyle() : UTSJSONObject {\r\n        const pages = getCurrentPages();\r\n        const currentPage = pages[pages.length - 1];\r\n        this.currentPageStyle = currentPage.getPageStyle()\r\n        return this.currentPageStyle;\r\n      },\r\n      setPageStyle(style : UTSJSONObject) {\r\n        console.log('setPageStyle:', style);\r\n        const pages = getCurrentPages();\r\n        const currentPage = pages[pages.length - 1];\r\n        currentPage.setPageStyle(style);\r\n      },\r\n      goSetDisablePullDownRefresh() {\r\n        uni.navigateTo({\r\n          url: '/pages/API/get-current-pages/set-page-style-disable-pull-down-refresh'\r\n        });\r\n      },\r\n      getCurrentPage() : UniPage {\r\n        const pages = getCurrentPages()\r\n        return pages[pages.length - 1]\r\n      },\r\n      check$page() : boolean {\r\n        const page = this.getCurrentPage()\r\n        let res = this.$page === page\r\n        if (this.testing && res) {\r\n          res = page.options['test'] == '123'\r\n          if (res) {\r\n            // #ifdef WEB\r\n            res = page.route == '/pages/API/get-current-pages/get-current-pages'\r\n            // #endif\r\n            // #ifndef WEB\r\n            res = page.route == 'pages/API/get-current-pages/get-current-pages'\r\n            // #endif\r\n          }\r\n        }\r\n        console.log('check $page', res)\r\n        return res\r\n      },\r\n      checkGetParentPage() : boolean {\r\n        const page = this.getCurrentPage()\r\n        const parentPage = page.getParentPage()\r\n        const res = parentPage == null\r\n        console.log('check getParentPage', res)\r\n        return res\r\n      },\r\n      checkGetDialogPages() : boolean {\r\n        const page = this.getCurrentPage()\r\n        const dialogPages = page.getDialogPages()\r\n        const res = Array.isArray(dialogPages) && dialogPages.length == 0\r\n        console.log('check getDialogPages', res)\r\n        return res\r\n      },\r\n      checkGetElementById() : boolean {\r\n        const page = this.getCurrentPage()\r\n        const element = page.getElementById('check-get-element-by-id-btn')\r\n        let res = element != null\r\n        // #ifndef APP-ANDROID\r\n        if (res) {\r\n          const elPage = element!.getPage()\r\n          console.log('elPage', elPage)\r\n          res = elPage === page\r\n        }\r\n        // #endif\r\n        console.log('check getElementById', res)\r\n        return res\r\n      },\r\n      checkGetAndroidView() : boolean {\r\n        const page = this.getCurrentPage()\r\n        const androidView = page.getAndroidView()\r\n        // #ifdef APP-ANDROID\r\n        const res = androidView != null\r\n        // #endif\r\n        // #ifndef APP-ANDROID\r\n        const res = androidView == null\r\n        // #endif\r\n        console.log('check getAndroidView', res)\r\n        return res\r\n      },\r\n    },\r\n  }\r\n\n```\n\n:::"},"env":{"name":"## env","description":"环境变量","param":"### env 的属性值 @env-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| USER_DATA_PATH | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"4.11\"]]}' /> | 应用专属存储空间的外置存储空间根目录下的files目录 |\n| CACHE_PATH | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"4.11\"]]}' /> | 应用专属存储空间的外置存储空间根目录下的cache目录 |\n| SANDBOX_PATH | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"4.11\"]]}' /> | 应用专属存储空间的外置存储空间根目录(caches/files) |\n| ANDROID_INTERNAL_SANDBOX_PATH | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"4.11\"]]}' /> | 应用专属存储空间的内置存储空间根目录 |\n","compatibility":"","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.env)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=env&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=env&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=env&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=env&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=env&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=env)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=env&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/env/env.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/env/env\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <text>操作日志</text><button size=\"mini\" @click=\"log=''\">清空日志</button>\r\n  <text style=\"margin: 2px; padding: 2px; border: 1px solid #000000;\">{{ log }}</text>\r\n  <scroll-view style=\"flex: 1;\">\r\n  <!-- #endif -->\r\n    <!-- #ifdef APP -->\r\n    <button class=\"btnstyle\" type=\"primary\" @tap=\"geAbsPath(sandboxPath)\"\r\n      id=\"btn-path\">应用外置沙盒目录uni.env.SANDBOX_PATH</button>\r\n    <button class=\"btnstyle\" type=\"primary\" @tap=\"geAbsPath(cachePath)\" id=\"btn-path\">缓存文件目录uni.env.CACHE_PATH</button>\r\n    <button class=\"btnstyle\" type=\"primary\" @tap=\"geAbsPath(userPath)\"\r\n      id=\"btn-path\">用户文件目录uni.env.USER_DATA_PATH</button>\r\n    <button class=\"btnstyle\" type=\"primary\" @tap=\"geAbsPath(internalSandboxPath)\"\r\n      id=\"btn-path\">应用内置沙盒目录uni.env.ANDROID_INTERNAL_SANDBOX_PATH</button>\r\n    <!-- #endif -->\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n\r\n    data() {\r\n      return {\r\n        log: \"\",\r\n        userPath: uni.env.USER_DATA_PATH,\r\n        sandboxPath: uni.env.SANDBOX_PATH,\r\n        cachePath: uni.env.CACHE_PATH,\r\n        internalSandboxPath: uni.env.ANDROID_INTERNAL_SANDBOX_PATH,\r\n      }\r\n    },\r\n    onLoad() {\r\n    },\r\n\r\n    methods: {\r\n      geAbsPath(path ?: any) {\r\n        // #ifdef APP-ANDROID\r\n        this.log += UTSAndroid.convert2AbsFullPath(path as string) + '\\n'\r\n        // #endif\r\n\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .btnstyle {\r\n    margin: 4px;\r\n  }\r\n</style>\n\n```\n:::"},"$on":{"name":"## uni.$on(eventName, callback) @$on","description":"监听自定义事件。事件可以由 uni.$emit 触发。回调函数会接收 uni.$emit 传递的参数。\n4.31+ 开始支持返回事件监听器 id, 用于 off 事件监听器。\n","compatibility":"### $on 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| eventName | string | 是 | - | - | - |\n| callback | () => void | 是 | - | - | - | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.eventBus.$on)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/window/communication.html#on)"},"$once":{"name":"## uni.$once(eventName, callback) @$once","description":"监听一个自定义事件。事件只触发一次,在第一次触发之后移除事件监听器。\n4.31+ 开始支持返回事件监听器 id, 用于 off 事件监听器。\n","compatibility":"### $once 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| eventName | string | 是 | - | - | - |\n| callback | () => void | 是 | - | - | - | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.eventBus.$once)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/window/communication.html#once)"},"$off":{"name":"## uni.$off(eventName, callback?) @$off","description":"移除自定义事件监听器。如果提供了事件名和回调,则只移除这个回调的监听器。\n4.13+ 开始支持第二个参数为可选,如果仅提供事件名,则移除该事件的所有监听器。\n4.31+ 开始支持第二个参数传入 `uni.$on`、`uni.$once` 返回的事件监听器 id, 移除指定事件监听器。","compatibility":"### $off 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| eventName | string | 是 | - | - | - |\n| callback | any | 否 | - | - |  | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.eventBus.$off)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/window/communication.html#off)"},"$emit":{"name":"## uni.$emit(eventName, args?) @$emit","description":"触发自定义事件,附加的参数会传递给事件监听器。\n","compatibility":"### $emit 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| eventName | string | 是 | - | - | - |\n| args | any | 否 | - | - |  | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.eventBus.$emit)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/window/communication.html#emit)"},"eventBus":{"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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/event-bus/event-bus\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <button @click=\"on\">开始监听</button>\r\n      <button @click=\"once\">监听一次</button>\r\n      <button @click=\"off\">取消监听</button>\r\n      <!-- <button @click=\"offAll\">取消全部监听</button> -->\r\n      <button @click=\"emit\">触发监听</button>\r\n      <button @click=\"clear\">清空消息</button>\r\n      <view class=\"box\">\r\n        <view>收到的消息:</view>\r\n        <view>\r\n          <view v-for=\"(item, index) in log\" :key=\"index\">{{ item }}</view>\r\n        </view>\r\n        <button @click=\"onObj\">开始监听 obj 参数</button>\r\n        <button @click=\"emitWithObj\">触发监听 obj 参数</button>\r\n        <view class=\"box\">\r\n          <text>接收到的 obj 参数:</text>\r\n          <text>{{JSON.stringify(objArg)}}</text>\r\n        </view>\r\n        <button @click=\"testReturnId\">测试返回 id</button>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .box {\r\n    padding: 10px;\r\n  }\r\n</style>\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        objArg: {},\r\n      }\r\n    },\r\n    methods: {\r\n      fn(res : string) {\r\n        this.log.push(res)\r\n      },\r\n      fn2(res : string) {\r\n        this.log.push(res)\r\n      },\r\n      on() {\r\n        uni.$on('test', this.fn)\r\n      },\r\n      on2() {\r\n        uni.$on('test', this.fn2)\r\n      },\r\n      onObj() {\r\n        uni.$on('test-obj', (res : UTSJSONObject) => {\r\n          this.objArg = res\r\n        })\r\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      },\r\n      offAll() {\r\n        uni.$off('test')\r\n      },\r\n      emit() {\r\n        uni.$emit('test', 'msg:' + Date.now())\r\n      },\r\n      emitWithObj() {\r\n        uni.$emit('test-obj', { a: 1, b: 2 })\r\n      },\r\n      clear() {\r\n        this.log.length = 0\r\n      },\r\n      testReturnId(){\r\n        const id1 = uni.$on('test-return-id', this.fn)\r\n        uni.$emit('test-return-id', '触发 test-return-id $on fn')\r\n        uni.$off('test-return-id', id1)\r\n        uni.$emit('test-return-id', '触发 test-return-id $on fn')\r\n\r\n        uni.$once('test-return-id', this.fn)\r\n        uni.$emit('test-return-id', '触发 test-return-id $once fn')\r\n        uni.$emit('test-return-id', '触发 test-return-id $once fn')\r\n        const id2 = uni.$once('test-id', this.fn)\r\n        uni.$off('test-return-id', id2)\r\n        uni.$emit('test-return-id', '触发 test-return-id $once fn')\r\n      }\r\n    },\r\n  }\r\n\n```\n\n:::"},"base64ToArrayBuffer":{"name":"## uni.base64ToArrayBuffer(base64) @base64toarraybuffer","description":"将 Base64 字符串转成 ArrayBuffer 对象\n","compatibility":"### base64ToArrayBuffer 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| base64 | string | 是 | - | - | - | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| ArrayBuffer |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.base64.base64ToArrayBuffer)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/base64ToArrayBuffer.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=base64ToArrayBuffer&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=base64ToArrayBuffer&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=base64ToArrayBuffer&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=base64ToArrayBuffer&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=base64ToArrayBuffer&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=base64ToArrayBuffer)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=base64ToArrayBuffer&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"arrayBufferToBase64":{"name":"## uni.arrayBufferToBase64(arrayBuffer) @arraybuffertobase64","description":"将 ArrayBuffer 对象转成 Base64 字符串\n","compatibility":"### arrayBufferToBase64 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| arrayBuffer | ArrayBuffer | 是 | - | - | - | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.base64.arrayBufferToBase64)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/arrayBufferToBase64.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=arrayBufferToBase64&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=arrayBufferToBase64&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=arrayBufferToBase64&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=arrayBufferToBase64&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=arrayBufferToBase64&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=arrayBufferToBase64)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=arrayBufferToBase64&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"addInterceptor":{"name":"## uni.addInterceptor(name, interceptor) @addinterceptor","description":"添加拦截器","compatibility":"### addInterceptor 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.97 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| name | string | 是 | - | - | 需要拦截的 API 名称 |\n| interceptor | Interceptor | 是 | - | - | 拦截器 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.interceptor.addInterceptor)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/interceptor.html)"},"removeInterceptor":{"name":"## uni.removeInterceptor(name, interceptor?) @removeinterceptor","description":"删除拦截器","compatibility":"### removeInterceptor 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.97 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| name | string | 是 | - | - | 需要删除拦截器的 API 名称 |\n| interceptor | Interceptor | 否 | - | - | 拦截器 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.interceptor.removeInterceptor)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/interceptor.html#removeinterceptor)"},"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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/interceptor/interceptor\n\n>Template\n```vue\n<template>\r\n  <view style=\"flex: 1\">\r\n    <button @click=\"addInterceptor\">添加路由拦截器</button>\r\n    <button @click=\"removeInterceptor\">移除路由拦截器</button>\r\n    <text>点击下方按钮{{ msg }}</text>\r\n    <button @click=\"navigateTo\">navigatorTo API跳转到测试页面</button>\r\n    <navigator url=\"./page1\">\r\n      <button class=\"navigatorButton\">navigator组件跳转到测试页面</button>\r\n    </navigator>\r\n    <button @click=\"addSwitchTabInterceptor\">添加switchTab拦截器</button>\r\n    <button @click=\"removeSwitchTabInterceptor\">移除switchTab拦截器</button>\r\n    <button class=\"navigatorButton\" @click=\"switchTab\">switchTab API</button>\r\n  </view>\r\n</template>\r\n\r\n\r\n\n```\n\n>Script\n```uts\n\r\n  const navigateToInterceptor = {\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 : NavigateToSuccess) {\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 AddInterceptorOptions\r\n\r\n  const switchTabInterceptor = {\r\n    invoke: function (options : SwitchTabOptions) {\r\n      console.log('拦截 switchTab 接口传入参数为:', options)\r\n      options.url = '/pages/tabBar/API'\r\n    },\r\n    success: function (res : SwitchTabSuccess) {\r\n      console.log('拦截 switchTab 接口 success 返回参数为:', res)\r\n    },\r\n    fail: function (err : SwitchTabFail) {\r\n      console.log('拦截 switchTab 接口 fail 返回参数为:', err)\r\n    },\r\n    complete: function (res : SwitchTabComplete) {\r\n      console.log('拦截 switchTab 接口 complete 返回参数为:', res)\r\n    }\r\n  } as AddInterceptorOptions\r\n\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      uni.removeInterceptor('switchTab')\r\n    },\r\n    methods: {\r\n      addInterceptor() {\r\n        uni.addInterceptor('navigateTo', navigateToInterceptor)\r\n        uni.showToast({\r\n          title: '页面跳转/切换tabbar已拦截'\r\n        })\r\n        this.msg = \",路由被劫持到测试页面2\"\r\n      },\r\n      removeInterceptor() {\r\n        uni.removeInterceptor('navigateTo', navigateToInterceptor)\r\n        uni.showToast({\r\n          title: '拦截器已移除'\r\n        })\r\n        this.msg = \"会跳转到测试页面1\"\r\n      },\r\n      addSwitchTabInterceptor() {\r\n        uni.addInterceptor('switchTab', switchTabInterceptor)\r\n      },\r\n      removeSwitchTabInterceptor() {\r\n        uni.removeInterceptor('switchTab', switchTabInterceptor)\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      switchTab() {\r\n        uni.switchTab({\r\n          url: '/pages/tabBar/component',\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\n:::"},"getLaunchOptionsSync":{"name":"## uni.getLaunchOptionsSync() @getlaunchoptionssync","description":"获取首次启动时的参数。返回值与App.onLaunch的回调参数一致\n","compatibility":"### getLaunchOptionsSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **OnLaunchOptions** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| path | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.91\",\"4.11\"]]}' /> | 首次启动时的页面路径。返回值与App.onLaunch的回调参数一致<br/> |\n@| appScheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 首次启动时的Scheme。返回值与App.onLaunch的回调参数一致<br/> |\n@| appLink | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.25\"]]}' /> | 首次启动时的appLink。返回值与App.onLaunch的回调参数一致<br/> | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.launch.getLaunchOptionsSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/getLaunchOptionsSync.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getLaunchOptionsSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getLaunchOptionsSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getLaunchOptionsSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getLaunchOptionsSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getLaunchOptionsSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getLaunchOptionsSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getLaunchOptionsSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-launch-options-sync/get-launch-options-sync\n\n>Template\n```vue\n<template>\n  <page-head title=\"getLaunchOptionsSync\"></page-head>\n  <view class=\"uni-padding-wrap\">\n    <button @click=\"getLaunchOptionsSync\">getLaunchOptionsSync</button>\n    <view class=\"uni-common-mt\">\n      <text>应用本次启动路径:</text>\n      <text style=\"margin-top: 5px\">{{ launchOptionsPath }}</text>\n    </view>\n    <view class=\"uni-common-mt\">\n      <text>应用本次启动:</text>\n      <text style=\"margin-top: 5px\">{{ launchOptionsString }}</text>\n    </view>\n  </view>\n</template>\n\n\n\n```\n\n>Script\n```uts\n\n  export default {\n    data() {\n      return {\n        checked: false,\n        homePagePath: 'pages/tabBar/component',\n        launchOptionsPath: '',\n        launchOptionsString: '',\n        testResult: false\n      }\n    },\n    onReady() {\n      this.compareOnLaunchRes()\n    },\n    methods: {\n      compareOnLaunchRes() {\n        const launchOptions = uni.getLaunchOptionsSync();\n        this.launchOptionsString = JSON.stringify(launchOptions, null, 2)\n\n        const app = getApp()\n        const appOnLaunch = app.globalData.launchOptions\n\n        const isPathSame = launchOptions.path == appOnLaunch.path\n        const isAppSchemeSame = launchOptions.appScheme == appOnLaunch.appScheme\n        const isAppLinkSame = launchOptions.appLink == appOnLaunch.appLink\n        this.testResult = isPathSame && isAppSchemeSame && isAppLinkSame\n      },\n\n      getLaunchOptionsSync() {\n        const launchOptions = uni.getLaunchOptionsSync()\n        this.launchOptionsPath = launchOptions.path\n        if (launchOptions.path == this.homePagePath) {\n          this.checked = true\n        }\n      },\n    },\n  }\n\n```\n\n:::"},"getEnterOptionsSync":{"name":"## uni.getEnterOptionsSync() @getenteroptionssync","description":"获取本次启动时的参数。返回值与App.onShow的回调参数一致\n","compatibility":"### getEnterOptionsSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.25 | 4.25 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **OnShowOptions** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| path | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.25\",\"4.25\"]]}' /> | 本次启动时页面的路径<br/> |\n@| appScheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 本次启动时的Scheme。返回值与App.onShow的回调参数一致<br/> |\n@| appLink | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.25\"]]}' /> | 本次启动时的appLink。返回值与App.onShow的回调参数一致<br/> | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.launch.getEnterOptionsSync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getEnterOptionsSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getEnterOptionsSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getEnterOptionsSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getEnterOptionsSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getEnterOptionsSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getEnterOptionsSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getEnterOptionsSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/get-enter-options-sync/get-enter-options-sync.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-enter-options-sync/get-enter-options-sync\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-enter-options-sync/get-enter-options-sync\n\n>Template\n```vue\n<template>\r\n  <page-head title=\"getEnterOptionsSync\"></page-head>\r\n  <view class=\"uni-padding-wrap\">\r\n    <view class=\"uni-common-mt\">\r\n      <text>应用本次启动路径:</text>\r\n      <text style=\"margin-top: 5px\">{{ enterOptionsString }}</text>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        enterOptionsString: '',\r\n        testResult: false\r\n      }\r\n    },\r\n    onReady() {\r\n      const app = getApp()\r\n      const appOnShow = app.globalData.onShowOption\r\n      const onShowOption = uni.getEnterOptionsSync()\r\n      this.enterOptionsString = JSON.stringify(onShowOption, null, 2)\r\n      this.testResult = (onShowOption.path == appOnShow.path && onShowOption.appScheme == appOnShow.appScheme && onShowOption.appLink == appOnShow.appLink)\r\n    }\r\n  }\r\n\n```\n\n:::"},"exit":{"name":"## uni.exit(options?) @exit","description":"退出当前应用","compatibility":"### exit 兼容性 \n| Web | Android | Android uni-app x UTS 插件 | Android uni-app UTS 插件 | iOS | iOS uni-app x UTS 插件 | iOS uni-app UTS 插件 |\n| :- | :- | :- | :- | :- | :- | :- |\n| x | 3.9.0 | 3.9.0 | 3.9.0 | x | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ExitOptions** | 否 | - | - | uni.exit参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [ExitSuccess](#exitsuccess-values)) => void | 否 | - | - | uni.exit成功回调函数定义 |\n@| fail | (res: [IExitError](#iexiterror-values)) => void | 否 | - | - | uni.exit失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.exit完成回调函数定义 | \n\n#### ExitSuccess 的属性值 @exitsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n\n#### IExitError 的属性值 @iexiterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 12001 | - | 系统不支持 |\n@| 12002 | - | 未知错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.exit)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=exit&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=exit&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=exit&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=exit&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=exit&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=exit)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=exit&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/exit/exit.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/exit/exit\n```uvue\n<template>\r\n  <view>\r\n    <button @tap=\"exitAppClick\">退出应用</button>\r\n  </view>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    methods: {\r\n      exitAppClick: function () {\r\n        uni.exit({\r\n          success: function (res) {\r\n            console.log(res)\r\n          }\r\n        })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n\n```\n:::"},"getProviderSync":{"name":"## uni.getProviderSync(options) @getprovidersync","description":"getProvider的同步方法","compatibility":"### getProviderSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.25 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetProviderSyncOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| service | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 服务类型<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| payment | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 支付 (alipay、wxpay) |\n@@| location | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 定位 (system、tencent) |\n@@| oauth | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"x\"]]}' /> | 授权登录 | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetProviderSyncSuccess** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| service | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 服务类型<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| payment | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 支付 (alipay、wxpay) |\n@@| location | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 定位 (system、tencent) |\n@@| oauth | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"x\"]]}' /> | 授权登录 |\n@| providerIds | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 得到的服务供应商 |\n@| providerObjects | Array\\<[UniProvider](/api/provider.md#uniprovider)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 得到的服务供应商服务对象 | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.getProvider)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/plugins/provider.html#getprovider)"},"getProvider":{"name":"## uni.~~getProvider(options)~~ @getprovider","description":"获取服务供应商  **已废弃,4.25及以后版本请使用getProviderSync()方法代替**","compatibility":"### getProvider 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.11 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetProviderOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| service | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 服务类型:支付 (payment)<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| payment | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.18\"]]}' /> | 支付 (alipay、wxpay) |\n@@| oauth | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"x\"]]}' /> | 授权登录 |\n@| success | (result: [GetProviderSuccess](#getprovidersuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 接口调用成功的回调 |\n@| fail | (result: [IGetProviderFail](#igetproviderfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### GetProviderSuccess 的属性值 @getprovidersuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| service | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 服务类型:支付 (payment)<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| payment | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.18\"]]}' /> | 支付 (alipay、wxpay) |\n@| oauth | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"x\"]]}' /> | 授权登录 |\n| provider | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 得到的服务供应商 |\n| providers | Array\\<[UniProvider](/api/provider.md#uniprovider)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 得到的服务供应商服务对象 |\n\n#### IGetProviderFail 的属性值 @igetproviderfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码:<br/>110600:服务类型参数无效。 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.getProviderSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/plugins/provider.html#getprovider)"},"provider":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/provider/provider.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/provider/provider\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view class=\"page\">\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"service-item\" v-for=\"(item, index) in serviceList\" :key=\"index\">\r\n        <text class=\"service-name\">{{item.name}}:</text>\r\n        <view class=\"provider-list\">\r\n          <text class=\"provider-item\" v-for=\"(item2, index2) in item.provider\" :key=\"index2\">\r\n            {{item2}}\r\n            {{item.providerObj.length > 0 ? ':' + JSON.stringify(item.providerObj[index2]) : '' }}\r\n          </text>\r\n        </view>\r\n      </view>\r\n      <button class=\"btn-get-provider\" type=\"primary\" @click=\"getProvider\">getProviderSync</button>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  type ProviderItem = {\r\n    service : string,\r\n    name : string,\r\n    provider : string[],\r\n    providerObj : UniProvider[]\r\n  }\r\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'provider',\r\n        flag: false,\r\n        serviceList: [\r\n          { service: \"payment\", name: \"支付\", provider: [], providerObj: [] },\r\n          { service: \"location\", name: \"定位\", provider: [], providerObj: [] }\r\n        ] as ProviderItem[],\r\n        //自动化测试使用\r\n        providerIds: [] as string[],\r\n\r\n        providerObjects: [] as UniProvider[],\r\n      }\r\n    },\r\n    methods: {\r\n      getProvider() {\r\n        this.serviceList.forEach((item : ProviderItem) => {\r\n          var provider = uni.getProviderSync({\r\n            service: item.service,\r\n          } as GetProviderSyncOptions)\r\n          provider.providerIds.forEach((value) => {\r\n            this.providerIds.push(value)\r\n          })\r\n          this.updateProvider(item.service, provider.providerIds, provider.providerObjects);\r\n        })\r\n      },\r\n      updateProvider(service : string, provider : string[] | null, uniProvider : UniProvider[]) {\n        //这里需要从新从serviceList 获取item,不能直接用forEach 里面的item,目前存在bug,后续会解决这个问题\r\n        const item : ProviderItem | null = this.serviceList.find((item : ProviderItem) : boolean => {\r\n          return item.service == service\r\n        });\r\n\r\n        if (item != null && provider != null) {\r\n          item.provider = provider\r\n          item.providerObj = uniProvider\r\n          item.providerObj.forEach((obj) => {\r\n            this.providerObjects.push(obj)\r\n          })\r\n        }\r\n\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .page {\r\n    padding: 15px;\r\n  }\r\n\r\n  .service-item {\r\n    margin-top: 10px;\r\n  }\r\n\r\n  .service-name {\r\n    font-weight: bold;\r\n  }\r\n\r\n  .provider-list {\r\n    margin-left: 32px;\r\n  }\r\n\r\n  .provider-item {\r\n    line-height: 1.5;\r\n  }\r\n\r\n  .btn-get-provider {\r\n    margin-top: 30px;\r\n  }\r\n</style>\n\n```\n:::"},"getPerformance":{"name":"## uni.getPerformance() @getperformance","description":"返回一个Performance对象实例\n","compatibility":"### getPerformance 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.91 | 4.25 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [Performance](#performance-values) |\n\n#### Performance 的方法 @performance-values \n\n#### createObserver(callback: PerformanceObserverCallback): PerformanceObserver @createobserver\n创建全局性能事件监听器\n##### createObserver 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (entries: [PerformanceObserverEntryList](#performanceobserverentrylist-values)) => void | 是 | - | - | - | \n\n##### PerformanceObserverEntryList 的方法 @performanceobserverentrylist-values \n\n##### getEntries(): PerformanceEntry[\\] @getentries\n该方法返回当前列表中的所有性能数据\n###### getEntries 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<**PerformanceEntry**\\> |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| entryType | string | 是 | - | - | 指标类型 |\n@| name | string | 是 | - | - | 指标名称 |\n@| duration | number | 是 | - | - | 耗时 ms。仅对于表示阶段的指标有效。 |\n@| startTime | number | 是 | - | - | 开始时间,不同指标的具体含义会有差异。 |\n@| path | string | 否 | - | - | 页面路径。仅 render 和 navigation 类型指标有效。 |\n@| referrerPath | string | 否 | - | - | 页面跳转来源页面路径。仅 route 指标有效。 |\n@| pageId | number | 否 | - | - | path 对应页面实例 Id(随机生成,不保证递增)。仅 render/navigation 指标有效。 |\n@| referrerPageId | number | 否 | - | - | referrerPath对应页面实例 Id(随机生成,不保证递增)。仅 route 指标有效。 |\n@| navigationStart | number | 否 | - | - | 路由真正响应开始时间。仅 navigation 类型指标有效。 |\n@| navigationType | string | 否 | - | - | 路由详细类型,与路由方法对应。仅 navigation 类型指标有效。 |\n@| initDataRecvTime | number | 否 | - | - | 首次渲染参数在渲染层收到的时间。仅 firstRender 指标有效。 |\n@| viewLayerRenderEndTime | number | 否 | - | - | 渲染层执行渲染结束时间。仅 firstRender 指标有效。 | \n\n##### getEntriesByType(entryType: string): PerformanceEntry[\\] @getentriesbytype\n获取当前列表中所有类型为 \\[entryType]的性能数据\n###### getEntriesByType 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| entryType | string | 是 | - | - | - | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[PerformanceEntry](#performanceentry-values)\\> |\n \n\n##### getEntriesByName(name: string, entryType: string): PerformanceEntry[\\] @getentriesbyname\n获取当前列表中所有名称为 \\[name] 且类型为 [entryType]的性能数据\n###### getEntriesByName 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| name | string | 是 | - | - | - |\n| entryType | string | 是 | - | - | - | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[PerformanceEntry](#performanceentry-values)\\> |\n \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [PerformanceObserver](#performanceobserver-values) |\n\n###### PerformanceObserver 的方法 @performanceobserver-values \n\n###### observe(options: PerformanceObserverOptions): void @observe\n开始监听\n###### observe 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **PerformanceObserverOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| buffered | boolean | 否 | - | - | - |\n@| entryTypes | Array\\<string\\> | 否 | - | - | - |\n@| type | string | 否 | - | - | - | \n\n\n###### disconnect(): void @disconnect\n停止监听\n###### disconnect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n \n\n#### getEntries(): PerformanceEntry[\\] @getentries\n该方法返回当前缓冲区中的所有性能数据\n##### getEntries 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[PerformanceEntry](#performanceentry-values)\\> |\n \n\n#### getEntriesByType(entryType: string): PerformanceEntry[\\] @getentriesbytype\n获取当前缓冲区中所有类型为 \\[entryType]的性能数据\n##### getEntriesByType 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| entryType | string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[PerformanceEntry](#performanceentry-values)\\> |\n \n\n#### getEntriesByName(name: string, entryType: string): PerformanceEntry[\\] @getentriesbyname\n获取当前缓冲区中所有名称为 \\[name] 且类型为 [entryType]的性能数据\n##### getEntriesByName 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| name | string | 是 | - | - | - |\n| entryType | string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[PerformanceEntry](#performanceentry-values)\\> |\n \n\n#### setBufferSize(size: number): void @setbuffersize\n设置缓冲区大小,默认缓冲 30 条性能数据\n##### setBufferSize 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| size | number | 是 | - | - | - | \n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.get-performance)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getPerformance&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getPerformance&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getPerformance&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getPerformance&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getPerformance&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getPerformance)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getPerformance&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getPrivacySetting":{"name":"## uni.getPrivacySetting(options) @getprivacysetting","description":"获取隐私协议状态","compatibility":"### getPrivacySetting 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetPrivacySettingOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [GetPrivacySettingSuccessResult](#getprivacysettingsuccessresult-values)) => void | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.31\",\"4.31\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.31\",\"4.31\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.31\",\"4.31\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### GetPrivacySettingSuccessResult 的属性值 @getprivacysettingsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| needAuthorization | boolean | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.privacy.getPrivacySetting)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getPrivacySetting&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getPrivacySetting&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getPrivacySetting&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getPrivacySetting&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getPrivacySetting&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getPrivacySetting)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getPrivacySetting&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"resetPrivacyAuthorization":{"name":"## uni.resetPrivacyAuthorization() @resetprivacyauthorization","description":"重置隐私协议状态为未同意","compatibility":"### resetPrivacyAuthorization 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n","param":"","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.privacy.resetPrivacyAuthorization)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=resetPrivacyAuthorization&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=resetPrivacyAuthorization&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=resetPrivacyAuthorization&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=resetPrivacyAuthorization&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=resetPrivacyAuthorization&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=resetPrivacyAuthorization)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=resetPrivacyAuthorization&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onPrivacyAuthorizationChange":{"name":"## uni.onPrivacyAuthorizationChange(callback) @onprivacyauthorizationchange","description":"开启监听隐私协议状态改变","compatibility":"### onPrivacyAuthorizationChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (res: [PrivacyChangeResult](#privacychangeresult-values)) => void | 是 | - | - | - | \n\n### PrivacyChangeResult 的属性值 @privacychangeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| needAuthorization | boolean | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.31\",\"4.31\"]]}' /> | 是否需要用户授权隐私协议(用户之前同意过返回false,没同意过则返回true) |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.privacy.onPrivacyAuthorizationChange)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onPrivacyAuthorizationChange&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onPrivacyAuthorizationChange&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onPrivacyAuthorizationChange&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onPrivacyAuthorizationChange&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onPrivacyAuthorizationChange&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onPrivacyAuthorizationChange)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onPrivacyAuthorizationChange&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"offPrivacyAuthorizationChange":{"name":"## uni.offPrivacyAuthorizationChange(id) @offprivacyauthorizationchange","description":"取消监听隐私协议状态改变","compatibility":"### offPrivacyAuthorizationChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | number | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.base.privacy.offPrivacyAuthorizationChange)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=offPrivacyAuthorizationChange&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=offPrivacyAuthorizationChange&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=offPrivacyAuthorizationChange&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=offPrivacyAuthorizationChange&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=offPrivacyAuthorizationChange&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=offPrivacyAuthorizationChange)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=offPrivacyAuthorizationChange&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"navigateTo":{"name":"## uni.navigateTo(options) @navigateto","description":"保留当前页面,跳转到应用内的某个页面\n","compatibility":"### navigateTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **NavigateToOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| animationType | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 窗口显示的动画类型<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| auto | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 自动选择动画效果 |\n@@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 无动画效果 |\n@@| slide-in-right | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从右侧横向滑动效果 |\n@@| slide-in-left | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从左侧横向滑动效果 |\n@@| slide-in-top | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从上侧竖向滑动效果 |\n@@| slide-in-bottom | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从下侧竖向滑动效果 |\n@@| fade-in | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从完全透明到不透明逐渐显示 |\n@@| zoom-out | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 在屏幕中间从小到大逐渐放大显示 |\n@@| zoom-fade-out | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画 |\n@@| pop-in | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从右侧平移出栈动画效果 |\n@| events | any | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面间通信接口,用于监听被打开页面发送到当前页面的数据 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [NavigateToFail](#navigatetofail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### NavigateToFail 的属性值 @navigatetofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.navigateTo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/router.html#navigateto)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=navigateTo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=navigateTo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=navigateTo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=navigateTo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=navigateTo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=navigateTo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=navigateTo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"reLaunch":{"name":"## uni.reLaunch(options) @relaunch","description":"关闭所有页面,打开到应用内的某个页面\n","compatibility":"### reLaunch 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ReLaunchOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 需要跳转的应用内页面路径 , 路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2',如果跳转的页面路径是 tabBar 页面则不能带参数 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [ReLaunchFail](#relaunchfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### ReLaunchFail 的属性值 @relaunchfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.reLaunch)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/router.html#relaunch)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=reLaunch&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=reLaunch&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=reLaunch&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=reLaunch&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=reLaunch&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=reLaunch)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=reLaunch&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"navigateBack":{"name":"## uni.navigateBack(options?) @navigateback","description":"关闭当前页面,返回上一页面或多级页面\n","compatibility":"### navigateBack 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **NavigateBackOptions** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| delta | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 返回的页面数,如果 delta 大于现有页面数,则返回到首页 |\n@| animationType | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 窗口关闭的动画类型<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| auto | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 自动选择动画效果 |\n@@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 无动画效果 |\n@@| slide-out-right | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 横向向右侧滑出屏幕动画 |\n@@| slide-out-left | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 横向向左侧滑出屏幕动画 |\n@@| slide-out-top | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 竖向向上侧滑出屏幕动画 |\n@@| slide-out-bottom | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 竖向向下侧滑出屏幕动画 |\n@@| fade-out | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从不透明到透明逐渐隐藏动画 |\n@@| zoom-in | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从大逐渐缩小关闭动画 |\n@@| zoom-fade-in | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画 |\n@@| pop-out | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.25\"]]}' /> | 从右侧平移出栈动画效果 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"x\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [NavigateBackFail](#navigatebackfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### NavigateBackFail 的属性值 @navigatebackfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.navigateBack)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/router.html#navigateback)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=navigateBack&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=navigateBack&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=navigateBack&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=navigateBack&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=navigateBack&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=navigateBack)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=navigateBack&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"redirectTo":{"name":"## uni.redirectTo(options) @redirectto","description":"关闭当前页面,跳转到应用内的某个页面\n","compatibility":"### redirectTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **RedirectToOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [RedirectToFail](#redirecttofail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### RedirectToFail 的属性值 @redirecttofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.redirectTo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/router.html#redirectto)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=redirectTo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=redirectTo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=redirectTo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=redirectTo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=redirectTo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=redirectTo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=redirectTo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"switchTab":{"name":"## uni.switchTab(options) @switchtab","description":"跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面\n","compatibility":"### switchTab 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SwitchTabOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 需要跳转的 tabBar 页面的路径,路径后不能带参数 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [SwitchTabFail](#switchtabfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### SwitchTabFail 的属性值 @switchtabfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.navigator.switchTab)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/router.html#switchtab)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=switchTab&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=switchTab&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=switchTab&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=switchTab&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=switchTab&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=switchTab)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=switchTab&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/navigator/navigator\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head title=\"navigate\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt uni-common-mb\">\r\n        <view class=\"direction-row\">\r\n          <text class=\"label\">onLoad触发时间戳:</text>\r\n          <text>{{ onLoadTime }}</text>\r\n        </view>\r\n        <view class=\"direction-row\">\r\n          <text class=\"label\">onShow触发时间戳:</text>\r\n          <text>{{ onShowTime }}</text>\r\n        </view>\r\n        <view class=\"direction-row\">\r\n          <text class=\"label\">onReady触发时间戳:</text>\r\n          <text>{{ onReadyTime }}</text>\r\n        </view>\r\n        <view class=\"direction-row\">\r\n          <text class=\"label\">onHide触发时间戳:</text>\r\n          <text>{{ onHideTime }}</text>\r\n        </view>\r\n        <view class=\"direction-row\">\r\n          <text class=\"label\">onBackPress触发时间戳:</text>\r\n          <text>见控制台</text>\r\n        </view>\r\n        <view class=\"direction-row\">\r\n          <text class=\"label\">onUnload触发时间戳:</text>\r\n          <text>见控制台</text>\r\n        </view>\r\n        <view class=\"uni-btn-v\">\r\n          <button @tap=\"navigateTo\" class=\"uni-btn\">\r\n            跳转新页面,并传递数据\r\n          </button>\r\n          <button @tap=\"navigateBack\" class=\"uni-btn\">返回上一页</button>\r\n          <button @tap=\"redirectTo\" class=\"uni-btn\">在当前页面打开</button>\r\n          <button @tap=\"switchTab\" class=\"uni-btn\">切换到模板选项卡</button>\r\n          <button @tap=\"reLaunch\" class=\"uni-btn\">\r\n            关闭所有页面,打开首页\r\n          </button>\r\n          <button @tap=\"navigateToErrorPage\" class=\"uni-btn\">\r\n            打开不存在的页面\r\n          </button>\r\n          <button v-for=\"(item, _) in animationTypeList\" @tap=\"navigateToAnimationType(item)\"\r\n            class=\"uni-btn\">navigateTo动画({{item}})</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .direction-row {\r\n    flex-direction: row;\r\n  }\r\n\r\n  .label {\r\n    width: 190px;\r\n  }\r\n</style>\r\n\n```\n\n>Script\n```uts\n\r\n  import { state, setLifeCycleNum } from '@/store/index.uts'\r\n  type AnimationType = \"slide-in-right\" | \"slide-in-left\" | \"slide-in-top\" | \"slide-in-bottom\" | \"pop-in\" | \"fade-in\" | \"zoom-out\" | \"zoom-fade-out\" | \"none\" | \"auto\"\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        animationTypeList: [\r\n          'slide-in-right',\r\n          'slide-in-left',\r\n          'slide-in-top',\r\n          'slide-in-bottom',\r\n          'pop-in',\r\n          'fade-in',\r\n          'zoom-out',\r\n          'zoom-fade-out',\r\n          'none'\r\n        ]\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      navigateToAnimationType(animationType : AnimationType) {\r\n        uni.navigateTo({\r\n          url: '/pages/API/navigator/new-page/new-page-1?data=Hello',\r\n          animationType: animationType,\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\n:::"},"openDialogPage":{"name":"## uni.openDialogPage(options) @opendialogpage","description":"打开模态弹窗页面","compatibility":"### openDialogPage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **OpenDialogPageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string ([string.PageURIString](/uts/data-type.md#ide-string)) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数 |\n@| animationType | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 窗口显示的动画类型<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| auto | - | 自动选择动画效果 |\n@@| none | - | 无动画效果 |\n@@| slide-in-right | - | 从右侧横向滑动效果 |\n@@| slide-in-left | - | 左侧横向滑动效果 |\n@@| slide-in-top | - | 从上侧竖向滑动效果 |\n@@| slide-in-bottom | - | 从下侧竖向滑动效果 |\n@@| fade-in | - | 从透明到不透明逐渐显示效果 |\n@@| zoom-out | - | 从小到大逐渐放大显示效果 |\n@@| zoom-fade-out | - | 从小到大逐渐放大并且从透明到不透明逐渐显示效果 |\n@| animationDuration | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 窗口关闭动画的持续时间,单位为 ms |\n@| disableEscBack | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 是否禁用按键盘 ESC 时关闭 |\n@| parentPage | [UniPage](#unipage-values) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 要绑定的父级页面实例 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| route | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由地址 |\n@@| options | UTSJSONObject | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由参数信息 |\n@@| vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n@@| $vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [OpenDialogPageFail](#opendialogpagefail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### UniPage 的方法 @unipage-values \n\n#### getPageStyle(): UTSJSONObject @getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### getPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n\n#### setPageStyle(style: UTSJSONObject): void @setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### setPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n#### getParentPage(): UniPage \\| null @getparentpage\n获取所属父页面\n##### getParentPage 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniPage](#unipage-values) | 否 |\n \n\n#### getDialogPages(): UniPage[\\] @getdialogpages\n获取当前页面的 dialog 子页面集合\n##### getDialogPages 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[UniPage](#unipage-values)\\> |\n \n\n#### getElementById(id: string.IDString \\| string): UniElement \\| null @getelementbyid\n返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n\n##### getElementById 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | [string.IDString](/uts/data-type.md#ide-string) \\| string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n#### getAndroidView(): View \\| null @getandroidview\n返回 android 平台页面根 view\n\n##### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | x |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| View | 否 |\n \n\n#### getHTMLElement(): UniElement \\| null @gethtmlelement\n返回页面 HTML Element 对象\n\n##### getHTMLElement 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | x | x |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n#### ~~$setPageStyle(style: UTSJSONObject): void~~ @$setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n##### $setPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n#### ~~$getPageStyle(): UTSJSONObject~~ @$getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n##### $getPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n\n#### OpenDialogPageFail 的属性值 @opendialogpagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniPage](#unipage-values) | 否 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| route | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由地址 |\n@| options | UTSJSONObject | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由参数信息 |\n@| vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n@| $vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n#### UniPage 的方法 @unipage-values \n\n#### getPageStyle(): UTSJSONObject @getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### getPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n\n#### setPageStyle(style: UTSJSONObject): void @setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n##### setPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n#### getParentPage(): UniPage \\| null @getparentpage\n获取所属父页面\n##### getParentPage 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniPage](#unipage-values) | 否 |\n \n\n#### getDialogPages(): UniPage[\\] @getdialogpages\n获取当前页面的 dialog 子页面集合\n##### getDialogPages 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[UniPage](#unipage-values)\\> |\n \n\n#### getElementById(id: string.IDString \\| string): UniElement \\| null @getelementbyid\n返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n\n##### getElementById 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | [string.IDString](/uts/data-type.md#ide-string) \\| string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n#### getAndroidView(): View \\| null @getandroidview\n返回 android 平台页面根 view\n\n##### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | x |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| View | 否 |\n \n\n#### getHTMLElement(): UniElement \\| null @gethtmlelement\n返回页面 HTML Element 对象\n\n##### getHTMLElement 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | x | x |\n\n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n#### ~~$setPageStyle(style: UTSJSONObject): void~~ @$setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n##### $setPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n#### ~~$getPageStyle(): UTSJSONObject~~ @$getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n##### $getPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.dialogPage.openDialogPage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=openDialogPage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=openDialogPage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=openDialogPage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=openDialogPage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=openDialogPage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=openDialogPage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=openDialogPage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"closeDialogPage":{"name":"## uni.closeDialogPage(options?) @closedialogpage","description":"关闭模态弹窗页面\r\n","compatibility":"### closeDialogPage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CloseDialogPageOptions** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| dialogPage | [UniPage](#unipage-values) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 要关闭的 dialogPage 实例 |\n@| animationType | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 窗口关闭的动画类型<br/>- auto: 自动选择动画效果<br/>- none: 无动画效果<br/>- slide-out-right: 横向向右侧滑出屏幕动画<br/>- slide-out-left: 横向向左侧滑出屏幕动画<br/>- slide-out-top: 竖向向上侧滑出屏幕动画<br/>- slide-out-bottom: 竖向向下侧滑出屏幕动画<br/>- fade-out: 从不透明到透明逐渐隐藏动画<br/>- zoom-in: 从大逐渐缩小关闭动画<br/>- zoom-fade-in: 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| auto | - | 自动选择动画效果 |\n@@| none | - | 无动画效果 |\n@@| slide-out-right | - | 横向向右侧滑出屏幕动画 |\n@@| slide-out-left | - | 横向向左侧滑出屏幕动画 |\n@@| slide-out-top | - | 竖向向上侧滑出屏幕动画 |\n@@| slide-out-bottom | - | 竖向向下侧滑出屏幕动画 |\n@@| fade-out | - | 从不透明到透明逐渐隐藏动画 |\n@@| zoom-in | - | 从大逐渐缩小关闭动画 |\n@@| zoom-fade-in | - | 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画 |\n@| animationDuration | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 窗口关闭动画的持续时间,单位为 ms |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [CloseDialogPageFail](#closedialogpagefail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### CloseDialogPageFail 的属性值 @closedialogpagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 路由错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| null |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.dialogPage.closeDialogPage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=closeDialogPage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=closeDialogPage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=closeDialogPage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=closeDialogPage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=closeDialogPage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=closeDialogPage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=closeDialogPage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"dialogPage":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/dialog-page/dialog-page.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/dialog-page/dialog-page\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/dialog-page/dialog-page\n\n>Template\n```vue\n<template>\r\n  <view class=\"uni-padding-wrap\">\r\n    <button class=\"uni-common-mt\" id=\"go-next-page\" @click=\"goNextPage\">go next page</button>\r\n    <button class=\"uni-common-mt\" id=\"open-dialog1\" @click=\"openDialog1\">open dialog 1</button>\r\n    <button class=\"uni-common-mt\" id=\"open-dialog1-wrong-path\" @click=\"openDialog1WrongPath\">open dialog page 1 with\r\n      wrong path</button>\r\n    <button class=\"uni-common-mt\" id=\"go-next-page-open-dialog1\" @click=\"goNextPageOpenDialog1\">go next page & open\r\n      dialog1</button>\r\n  </view>\r\n</template>\r\n\r\n\r\n\n```\n\n>Script\n```uts\n\r\n  import {\r\n    state,\r\n    setLifeCycleNum\r\n  } from '@/store/index.uts'\r\n\r\n  export default {\r\n    onLoad() {\r\n      console.log('dialogPage parent onLoad')\r\n    },\r\n    onShow() {\r\n      console.log('dialogPage parent onShow')\r\n      setLifeCycleNum(state.lifeCycleNum + 10)\r\n    },\r\n    onReady() {\r\n      console.log('dialogPage parent onReady')\r\n    },\r\n    onHide() {\r\n      console.log('dialogPage parent onHide')\r\n      setLifeCycleNum(state.lifeCycleNum - 10)\r\n    },\r\n    onUnload() {\r\n      console.log('dialogPage parent onUnload')\r\n    },\r\n    methods: {\r\n      goNextPage() {\r\n        uni.navigateTo({\r\n          url: '/pages/API/dialog-page/next-page'\r\n        })\r\n      },\r\n      openDialog1() {\r\n        uni.openDialogPage({\r\n          url: '/pages/API/dialog-page/dialog-1?name=dialog1',\r\n          success(res) {\r\n            console.log('openDialogPage1 success', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          },\r\n          fail(err) {\r\n            console.log('openDialogPage1 fail', err)\r\n            setLifeCycleNum(state.lifeCycleNum - 4)\r\n          },\r\n          complete(res) {\r\n            console.log('openDialogPage1 complete', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          }\r\n        })\r\n      },\r\n      openDialog2() {\r\n        uni.openDialogPage({\r\n          url: '/pages/API/dialog-page/dialog-2',\r\n          disableEscBack: true,\r\n          success(res) {\r\n            console.log('openDialog2 success', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          },\r\n          fail(err) {\r\n            console.log('openDialog2 fail', err)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum - 4)\r\n          },\r\n          complete(res) {\r\n            console.log('openDialog2 complete', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          }\r\n        })\r\n      },\r\n      openDialog1WrongPath() {\r\n        uni.openDialogPage({\r\n          url: '/pages/API/dialog-page/dialog-11?name=dialog1',\r\n          success(res) {\r\n            console.log('openDialogPage1 success', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          },\r\n          fail(err) {\r\n            console.log('openDialogPage1 fail', err)\r\n            setLifeCycleNum(state.lifeCycleNum - 4)\r\n          },\r\n          complete(res) {\r\n            console.log('openDialogPage1 complete', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          }\r\n        })\r\n      },\r\n      goNextPageOpenDialog1() {\r\n        uni.navigateTo({\r\n          url: '/pages/API/dialog-page/next-page',\r\n          success() {\r\n            setTimeout(() => {\r\n              uni.openDialogPage({\r\n                url: '/pages/API/dialog-page/dialog-1?name=dialog1',\r\n                success(res) {\r\n                  console.log('openDialogPage1 success', res)\r\n                  // 自动化测试\r\n                  setLifeCycleNum(state.lifeCycleNum + 1)\r\n                },\r\n                fail(err) {\r\n                  console.log('openDialogPage1 fail', err)\r\n                  // 自动化测试\r\n                  setLifeCycleNum(state.lifeCycleNum - 4)\r\n                },\r\n                complete(res) {\r\n                  console.log('openDialogPage1 complete', res)\r\n                  // 自动化测试\r\n                  setLifeCycleNum(state.lifeCycleNum + 1)\r\n                }\r\n              })\r\n            }, 1000)\r\n          }\r\n        })\r\n      },\r\n      closeDialog() {\r\n        uni.closeDialogPage({\r\n          success(res) {\r\n            console.log('closeDialog success', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          },\r\n          fail(err) {\r\n            console.log('closeDialog fail', err)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum - 4)\r\n          },\r\n          complete(res) {\r\n            console.log('closeDialog complete', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          }\r\n        })\r\n      },\r\n      closeSpecifiedDialog(index: number) {\r\n        const dialogPages = this.$page.getDialogPages()\r\n        uni.closeDialogPage({\r\n          dialogPage: dialogPages[index],\r\n          success(res) {\r\n            console.log('closeSomeOneDialog success', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          },\r\n          fail(err) {\r\n            console.log('closeSomeOneDialog fail', err)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum - 4)\r\n          },\r\n          complete(res) {\r\n            console.log('closeSomeOneDialog complete', res)\r\n            // 自动化测试\r\n            setLifeCycleNum(state.lifeCycleNum + 1)\r\n          }\r\n        })\r\n      },\r\n      setLifeCycleNum(value: number) {\r\n        setLifeCycleNum(value)\r\n      },\r\n      getLifeCycleNum(): number {\r\n        return state.lifeCycleNum\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"setNavigationBarColor":{"name":"## uni.setNavigationBarColor(options) @setnavigationbarcolor","description":"设置导航条、状态栏颜色\n","compatibility":"### setNavigationBarColor 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetNavigationBarColorOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| frontColor | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| #ffffff | - | - |\n@@| #000000 | - | - |\n@| backgroundColor | [string.ColorString](/uts/data-type.md#ide-string) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 背景颜色值,有效值为十六进制颜色 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (error: [SetNavigationBarColorFail](#setnavigationbarcolorfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### SetNavigationBarColorFail 的属性值 @setnavigationbarcolorfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 设置导航栏字体颜色错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setNavigationBarColor)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/navigationbar.html#setnavigationbarcolor)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setNavigationBarColor&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setNavigationBarColor&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setNavigationBarColor&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setNavigationBarColor&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setNavigationBarColor&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setNavigationBarColor)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setNavigationBarColor&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/set-navigation-bar-color/set-navigation-bar-color\n\n>Template\n```vue\n<template>\r\n  <page-head title=\"setNavigationBarColor\"></page-head>\r\n  <view class=\"uni-padding-wrap uni-common-mt\">\r\n    <button @tap=\"setNavigationBarColor1\" class=\"uni-btn\">\r\n      设置导航条背景绿色,标题白色\r\n    </button>\r\n    <button @tap=\"setNavigationBarColor2\" class=\"uni-btn\">\r\n      设置导航条背景红色,标题黑色\r\n    </button>\r\n    <button @tap=\"goNavbarLite\" class=\"uni-btn\">\r\n      跳转自定义导航栏页面\r\n    </button>\r\n  </view>\r\n</template>\r\n\r\n\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\n:::"},"setNavigationBarTitle":{"name":"## uni.setNavigationBarTitle(options) @setnavigationbartitle","description":"动态设置当前页面的标题\n","compatibility":"### setNavigationBarTitle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.97 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetNavigationBarTitleOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| title | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 页面标题 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (error: [SetNavigationBarTitleFail](#setnavigationbartitlefail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### SetNavigationBarTitleFail 的属性值 @setnavigationbartitlefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 设置导航栏标题错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setNavigationBarTitle)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/navigationbar.html#setnavigationbartitle)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setNavigationBarTitle&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setNavigationBarTitle&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setNavigationBarTitle&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setNavigationBarTitle&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setNavigationBarTitle&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setNavigationBarTitle)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setNavigationBarTitle&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/set-navigation-bar-title/set-navigation-bar-title\n\n>Template\n```vue\n<template>\r\n  <page-head title=\"setNavigationBarTitle\"></page-head>\r\n  <view class=\"uni-padding-wrap uni-common-mt\">\r\n    <button @tap=\"setNavigationBarNewTitle\" class=\"uni-btn\">\r\n      设置当前页面标题为: {{ newTitle }}\r\n    </button>\r\n    <button @tap=\"setNavigationBarLongTitle\" class=\"uni-btn\">\r\n      设置超长标题\r\n    </button>\r\n  </view>\r\n</template>\r\n\r\n\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        newTitle: 'new title',\r\n        longTitle: 'long title long title long title long title long title long title long title long title long title long title'\r\n      }\r\n    },\r\n    methods: {\r\n      setNavigationBarNewTitle() {\r\n        uni.setNavigationBarTitle({\r\n          title: this.newTitle,\r\n          success: () => {\r\n            console.log('setNavigationBarTitle success')\r\n            this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n          },\r\n          fail: () => {\r\n            console.log('setNavigationBarTitle fail')\r\n            this.setLifeCycleNum(state.lifeCycleNum - 1)\r\n          },\r\n          complete: () => {\r\n            console.log('setNavigationBarTitle complete')\r\n            this.setLifeCycleNum(state.lifeCycleNum + 1)\r\n          }\r\n        })\r\n      },\r\n      setNavigationBarLongTitle() {\r\n        uni.setNavigationBarTitle({\r\n          title: this.longTitle,\r\n          success() {\r\n            console.log('setNavigationBarTitle success')\r\n          },\r\n          fail() {\r\n            console.log('setNavigationBarTitle fail')\r\n          },\r\n          complete() {\r\n            console.log('setNavigationBarTitle complete')\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\n:::"},"showTabBar":{"name":"## uni.showTabBar(options?) @showtabbar","description":"显示 tabBar\n","compatibility":"### showTabBar 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ShowTabBarOptions** | 否 | - | - |  |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.showTabBar)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#showtabbar)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=showTabBar&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=showTabBar&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=showTabBar&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=showTabBar&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=showTabBar&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=showTabBar)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=showTabBar&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"hideTabBar":{"name":"## uni.hideTabBar(options?) @hidetabbar","description":"隐藏 tabBar\n","compatibility":"### hideTabBar 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **HideTabBarOptions** | 否 | - | - |  |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.hideTabBar)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#hidetabbar)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=hideTabBar&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=hideTabBar&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=hideTabBar&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=hideTabBar&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=hideTabBar&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=hideTabBar)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=hideTabBar&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"showTabBarRedDot":{"name":"## uni.showTabBarRedDot(options) @showtabbarreddot","description":"显示 tabBar 某一项的右上角的红点\n","compatibility":"### showTabBarRedDot 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ShowTabBarRedDotOptions** | 是 | - | - | - |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.showTabBarRedDot)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#showtabbarreddot)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=showTabBarRedDot&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=showTabBarRedDot&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=showTabBarRedDot&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=showTabBarRedDot&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=showTabBarRedDot&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=showTabBarRedDot)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=showTabBarRedDot&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"hideTabBarRedDot":{"name":"## uni.hideTabBarRedDot(options) @hidetabbarreddot","description":"隐藏 tabBar 某一项的右上角的红点\n","compatibility":"### hideTabBarRedDot 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **HideTabBarRedDotOptions** | 是 | - | - | - |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.hideTabBarRedDot)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#hidetabbarreddot)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=hideTabBarRedDot&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=hideTabBarRedDot&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=hideTabBarRedDot&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=hideTabBarRedDot&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=hideTabBarRedDot&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=hideTabBarRedDot)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=hideTabBarRedDot&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"setTabBarBadge":{"name":"## uni.setTabBarBadge(options) @settabbarbadge","description":"为 tabBar 某一项的右上角添加文本\n","compatibility":"### setTabBarBadge 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetTabBarBadgeOptions** | 是 | - | - | - |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.setTabBarBadge)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#settabbarbadge)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setTabBarBadge&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setTabBarBadge&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setTabBarBadge&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setTabBarBadge&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setTabBarBadge&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setTabBarBadge)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setTabBarBadge&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"removeTabBarBadge":{"name":"## uni.removeTabBarBadge(options) @removetabbarbadge","description":"移除 tabBar 某一项右上角的文本\n","compatibility":"### removeTabBarBadge 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **RemoveTabBarBadgeOptions** | 是 | - | - | - |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.removeTabBarBadge)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#removetabbarbadge)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=removeTabBarBadge&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=removeTabBarBadge&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=removeTabBarBadge&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=removeTabBarBadge&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=removeTabBarBadge&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=removeTabBarBadge)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=removeTabBarBadge&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"setTabBarStyle":{"name":"## uni.setTabBarStyle(options) @settabbarstyle","description":"动态设置 tabBar 的整体样式\n","compatibility":"### setTabBarStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetTabBarStyleOptions** | 是 | - | - | - |\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 | string | 否 | - | - | 背景图平铺方式 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| repeat | - | 背景图片在垂直方向和水平方向平铺 |\n@@| repeat-x | - | 背景图片在水平方向平铺,垂直方向拉伸 |\n@@| repeat-y | - | 背景图片在垂直方向平铺,水平方向拉伸 |\n@@| no-repeat | - | 背景图片在垂直方向和水平方向都拉伸 |\n@| borderColor | string ([string.ColorString](/uts/data-type.md#ide-string)) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.23\",\"x\",\"4.23\"]]}' /> | tabbar上边框的颜色(优先级高于 borderStyle) |\n@| borderStyle | string | 否 | - | - | tabbar上边框的颜色 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| black | - | - |\n@@| white | - | - |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.setTabBarStyle)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#settabbarstyle)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setTabBarStyle&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setTabBarStyle&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setTabBarStyle&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setTabBarStyle&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setTabBarStyle&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setTabBarStyle)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setTabBarStyle&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"setTabBarItem":{"name":"## uni.setTabBarItem(options) @settabbaritem","description":"动态设置 tabBar 某一项的内容\n","compatibility":"### setTabBarItem 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetTabBarItemOptions** | 是 | - | - | - |\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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 100 | - | TabBar 不存在 |\n@| 200 | - | 参数错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.setTabBar.setTabBarItem)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#settabbaritem)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setTabBarItem&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setTabBarItem&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setTabBarItem&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setTabBarItem&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setTabBarItem&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setTabBarItem)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setTabBarItem&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"startPullDownRefresh":{"name":"## uni.startPullDownRefresh(options?) @startpulldownrefresh","description":"开始下拉刷新\n","compatibility":"### startPullDownRefresh 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **StartPullDownRefreshOptions** | 否 | - | - |  |\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 | 是 | - | - | 下拉刷新错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pullDownRefresh.startPullDownRefresh)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/pulldown.html#startpulldownrefresh)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=startPullDownRefresh&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=startPullDownRefresh&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=startPullDownRefresh&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=startPullDownRefresh&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=startPullDownRefresh&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=startPullDownRefresh)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=startPullDownRefresh&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"stopPullDownRefresh":{"name":"## uni.stopPullDownRefresh() @stoppulldownrefresh","description":"停止当前页面下拉刷新\n","compatibility":"### stopPullDownRefresh 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pullDownRefresh.stopPullDownRefresh)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/pulldown.html#stoppulldownrefresh)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=stopPullDownRefresh&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=stopPullDownRefresh&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=stopPullDownRefresh&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=stopPullDownRefresh&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=stopPullDownRefresh&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=stopPullDownRefresh)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=stopPullDownRefresh&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"pullDownRefresh":{"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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/pull-down-refresh/pull-down-refresh\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1;\">\r\n  <!-- #endif -->\r\n    <!-- 实际开发中,长列表应该使用list-view -->\r\n    <view class=\"uni-padding-wrap uni-common-mt\">\r\n      <text class=\"text\" v-for=\"(num,index) in data\" :key=\"index\">list - {{num}}</text>\r\n      <view v-if=\"showLoadMore\">{{loadMoreText}}</view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<style>\r\n  .text {\r\n    margin: 6px 0;\r\n    width: 100%;\r\n    background-color: #fff;\r\n    height: 52px;\r\n    line-height: 52px;\r\n    text-align: center;\r\n    color: #555;\r\n    border-radius: 4px;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        data: [] as Array<number>,\r\n        loadMoreText: \"加载中...\",\r\n        showLoadMore: false,\r\n        max: 0,\r\n        pulldownRefreshTriggered: false\r\n      }\r\n    },\r\n    onReady() {\r\n      uni.startPullDownRefresh();\r\n      this.initData();\r\n    },\r\n    onReachBottom() {\r\n      console.log(\"onReachBottom\");\r\n      if (this.max > 40) {\r\n        this.loadMoreText = \"没有更多数据了!\"\r\n        return;\r\n      }\r\n      this.showLoadMore = true;\r\n      setTimeout(() => {\r\n        this.setListData();\r\n      }, 300);\r\n    },\r\n    onPullDownRefresh() {\r\n      console.log('onPullDownRefresh');\r\n      this.pulldownRefreshTriggered = true\r\n      this.initData();\r\n    },\r\n    methods: {\r\n      initData() {\r\n        setTimeout(() => {\r\n          this.max = 0;\r\n          this.data = [];\r\n          let data : Array<number> = [];\r\n          this.max += 20;\r\n          for (let i : number = this.max - 19; i < this.max + 1; i++) {\r\n            data.push(i)\r\n          }\r\n          this.data = this.data.concat(data);\r\n          uni.stopPullDownRefresh();\r\n        }, 1000);\r\n      },\r\n      setListData() {\r\n        let data : Array<number> = [];\r\n        this.max += 10;\r\n        for (let i : number = this.max - 9; i < this.max + 1; i++) {\r\n          data.push(i)\r\n        }\r\n        this.data = this.data.concat(data);\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"pageScrollTo":{"name":"## uni.pageScrollTo(options) @pagescrollto","description":"将页面滚动到目标位置\n","compatibility":"### pageScrollTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **PageScrollToOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| scrollTop | number | 否 | - | - | 滚动到页面的目标位置 |\n@| selector | string | 否 | - | - | 选择器 |\n@| offsetTop | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.91\",\"4.11\"]]}' /> | 偏移距离,可以滚动到 selector 加偏移距离的位置 |\n@| duration | number | 否 | - | - | 滚动动画的时长 |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (result: [PageScrollToFail](#pagescrolltofail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (result: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### PageScrollToFail 的属性值 @pagescrolltofail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 设置页面滚动错误码<br/>- 4: 框架内部异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.pageScrollTo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/scroll.html#pagescrollto)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=pageScrollTo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=pageScrollTo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=pageScrollTo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=pageScrollTo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=pageScrollTo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=pageScrollTo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=pageScrollTo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/page-scroll-to/page-scroll-to\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\" scroll-with-animation=\"true\">\r\n  <!-- #endif -->\r\n    <view class=\"uni-padding-wrap\">\r\n      <page-head :title=\"title\"></page-head>\r\n      <button type=\"default\" class=\"btn-scrollTo\" @click=\"scrollTo\">\r\n        scrollTo\r\n      </button>\r\n      <button type=\"default\" class=\"btn-scrollToElement\" @click=\"scrollToElement\">\r\n        scrollToElement\r\n      </button>\r\n      <view class=\"uni-list\" v-for=\"(_, index) in 10\" :key=\"index\">\r\n        <view class=\"uni-list-cell list-item\">{{ index }}</view>\r\n      </view>\r\n      <view class=\"custom-element\">scrollTo-custom-element</view>\r\n      <view class=\"uni-list\" v-for=\"(_, index2) in 10\" :key=\"index2\">\r\n        <view class=\"uni-list-cell list-item\">{{ index2 }}</view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .list-item {\r\n    height: 100px;\r\n    padding-left: 30px;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'pageScrollTo',\r\n      }\r\n    },\r\n    methods: {\r\n      scrollTo() {\r\n        uni.pageScrollTo({\r\n          scrollTop: 100,\r\n          duration: 300,\r\n          success: () => {\r\n            console.log('success')\r\n          },\r\n        })\r\n      },\r\n      scrollToElement() {\r\n        uni.pageScrollTo({\r\n          selector: '.custom-element',\r\n          duration: 300,\r\n          success: () => {\r\n            console.log('success')\r\n          },\r\n        })\r\n      },\r\n    },\r\n  }\r\n\n```\n\n:::"},"onTabBarMidButtonTap":{"name":"## uni.onTabBarMidButtonTap(options) @ontabbarmidbuttontap","description":"监听中间按钮的点击事件","compatibility":"### onTabBarMidButtonTap 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | () => void | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.page.onTabBarMidButtonTap)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/tabbar.html#ontabbarmidbuttontap)"},"getElementById":{"name":"## uni.getElementById(id) @getelementbyid","description":"返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n","compatibility":"### getElementById 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 | iOS uni-app UTS 插件 |\n| :- | :- | :- | :- | :- |\n| 4.0 | 3.91 | 4.11 | 4.25 | x |\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) | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.dom.getElementById)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-element-by-id/get-element-by-id\n\n>Template\n```vue\n<template>\r\n  <page-head id=\"page-head\" title=\"getElementById\"></page-head>\r\n  <view style=\"margin: 0 15px;\">\r\n    <text id=\"text\">this is text</text>\r\n    <view id=\"view\" class=\"uni-common-mt\" style=\"border: 1px solid red\">this is view</view>\r\n    <button class=\"uni-btn\" @click=\"changePageHeadBackgroundColor\">\r\n      修改 page-head 背景色\r\n    </button>\r\n    <button class=\"uni-btn\" @click=\"changeTextColor\">\r\n      修改 text 字体颜色\r\n    </button>\r\n    <button class=\"uni-btn\" @click=\"changeViewStyle\">\r\n      修改 view 宽高及背景色\r\n    </button>\r\n    <button class=\"uni-btn\" @click=\"goMultipleRootNode\">\r\n      跳转多根节点示例\r\n    </button>\r\n  </view>\r\n</template>\r\n\r\n\n\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<UniViewElement>('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      //自动化测试获取text元素的offsetLeft属性值\r\n      getTextOffsetLeft() : number {\r\n        const text = uni.getElementById('text')!\r\n        return text.offsetLeft\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"createSelectorQuery":{"name":"## uni.createSelectorQuery() @createselectorquery","description":"返回一个SelectorQuery对象实例\n","compatibility":"### createSelectorQuery 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.91 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n\n#### SelectorQuery 的方法 @selectorquery-values \n\n#### in(component: any \\| null): SelectorQuery @in\n将选择器的选取范围更改为自定义组件component内\n##### in 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| component | any | 否 | - | - |  | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n#### select(selector: string): NodesRef @select\n在当前页面下选择第一个匹配选择器selector的节点\n##### select 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\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: SelectorQueryNodeInfoCallback \\| null,    ): SelectorQuery @boundingclientrect\n添加节点的布局位置的查询请求,相对于显示区域,以像素为单位\n###### boundingClientRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 否 | - | - |  | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n###### scrollOffset(callback: SelectorQueryNodeInfoCallback): SelectorQuery @scrolloffset\n添加节点的滚动位置查询请求,以像素为单位\n###### scrollOffset 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - |  | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n###### fields( fields: NodeField,        callback: SelectorQueryNodeInfoCallback \\| null,    ): SelectorQuery @fields\n获取节点的相关信息,需要获取的字段在fields中指定\n###### fields 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.25 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| fields | **NodeField** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| id | boolean | 否 | - | - | 是否返回节点 id |\n@| dataset | boolean | 否 | - | - | 是否返回节点 dataset |\n@| rect | boolean | 否 | - | - | 是否返回节点布局位置(left right top bottom) |\n@| size | boolean | 否 | - | - | 是否返回节点尺寸(width height) |\n@| scrollOffset | boolean | 否 | - | - | 是否返回节点的 scrollLeft scrollTop,节点必须是 scroll-view 或者 viewport |\n@| properties | Array\\<string\\> | 否 | - | - | 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) |\n@| computedStyle | Array\\<string\\> | 否 | - | - | 指定样式名列表,返回节点对应样式名的当前值 |\n@| context | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否返回节点对应的 Context 对象 |\n@| node | boolean | 否 | - | - | 是否返回节点对应的 Node 实例 |\n| callback | (result: any) => void | 否 | - | - |  | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n###### context(callback: SelectorQueryNodeInfoCallback): SelectorQuery @context\n添加节点的 Context 对象查询请求\n###### context 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - |  | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n\n###### node(callback: (result: any) => void): SelectorQuery @node\n获取 Node 节点实例。目前支持 Canvas 的获取。\n获取节点的相关信息,需要获取的字段在fields中指定\n###### node 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.25 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| [SelectorQuery](#selectorquery-values) |\n \n \n\n#### selectAll(selector: string): NodesRef @selectall\n在当前页面下选择匹配选择器selector的所有节点\n##### selectAll 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| selector | string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n \n\n#### selectViewport(): NodesRef @selectviewport\n选择显示区域\n##### selectViewport 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [NodesRef](#nodesref-values) |\n \n\n#### exec(callback: (result: Array\\<any>) => void \\| null): NodesRef \\| null @exec\n执行所有的请求\n##### exec 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: Array\\<any\\>) => void | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [NodesRef](#nodesref-values) | 否 |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.dom.createSelectorQuery)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/nodes-info.html#createselectorquery)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createSelectorQuery&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createSelectorQuery&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createSelectorQuery&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createSelectorQuery&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createSelectorQuery&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createSelectorQuery)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createSelectorQuery&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/create-selector-query/create-selector-query.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/create-selector-query/create-selector-query\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/create-selector-query/create-selector-query\n\n>Template\n```vue\n<template>\n  <!-- #ifdef APP -->\n  <scroll-view class=\"page-scroll-view\">\n  <!-- #endif -->\n    <view class=\"page\" id=\"page\">\n      <page-head :title=\"title\"></page-head>\n      <button class=\"btn btn-get-node-info\" @click=\"getNodeInfo\">getNodeInfo</button>\n      <button class=\"btn btn-get-all-node-info\" @click=\"getAllNodeInfo\">getAllNodeInfo</button>\n      <view id=\"rect-1-2\" class=\"rect-1-2\">\n        <view class=\"rect rect1\"></view>\n        <view class=\"rect rect2\"></view>\n      </view>\n      <view class=\"rect-info-1-2\">\n        <view class=\"rect-info\" v-for=\"(nodeInfo, index) in nodeInfoList\" :key=\"index\">\n          <view class=\"node-info-item\">\n            <text class=\"node-info-item-k\">left: </text>\n            <text class=\"node-info-item-v\">{{nodeInfo.left}}</text>\n          </view>\n          <view class=\"node-info-item\">\n            <text class=\"node-info-item-k\">top: </text>\n            <text class=\"node-info-item-v\">{{nodeInfo.top}}</text>\n          </view>\n          <view class=\"node-info-item\">\n            <text class=\"node-info-item-k\">right: </text>\n            <text class=\"node-info-item-v\">{{nodeInfo.right}}</text>\n          </view>\n          <view class=\"node-info-item\">\n            <text class=\"node-info-item-k\">bottom: </text>\n            <text class=\"node-info-item-v\">{{nodeInfo.bottom}}</text>\n          </view>\n          <view class=\"node-info-item\">\n            <text class=\"node-info-item-k\">width: </text>\n            <text class=\"node-info-item-v\">{{nodeInfo.width}}</text>\n          </view>\n          <view class=\"node-info-item\">\n            <text class=\"node-info-item-k\">height: </text>\n            <text class=\"node-info-item-v\">{{nodeInfo.height}}</text>\n          </view>\n        </view>\n      </view>\n      <node-child class=\"node-child\"></node-child>\n      <text>子组件多根节点</text>\n      <multi-child ref=\"multi-child\" id=\"multi-child\"></multi-child>\n      <text>子组件多根节点(仅测试,用于验证查询是否超出范围)</text>\n      <multi-child id=\"multi-child-2\"></multi-child>\n      <view>\n        <text>测试.fields</text>\n        <text>{{fieldsResultContainNode}}</text>\n      </view>\n      <view>\n        <text>测试.node</text>\n        <text>{{nodeResultContainNode}}</text>\n      </view>\n      <canvas id=\"canvas1\"></canvas>\n    </view>\n  <!-- #ifdef APP -->\n  </scroll-view>\n  <!-- #endif -->\n</template>\n\n\n\n<style>\n  .page {\n    padding: 15px;\n  }\n\n  .btn {\n    margin-top: 15px;\n  }\n\n  .rect-1-2 {\n    flex-direction: row;\n    margin-top: 15px;\n  }\n\n  .rect {\n    width: 150px;\n    height: 100px;\n  }\n\n  .rect1 {\n    background-color: dodgerblue;\n  }\n\n  .rect2 {\n    margin-left: auto;\n    background-color: seagreen;\n  }\n\n  .rect-info-1-2 {\n    flex-direction: row;\n    margin-top: 15px;\n  }\n\n  .rect-info {\n    flex: 1;\n    flex-direction: column;\n  }\n\n  .node-info-item {\n    flex-direction: row;\n  }\n\n  .node-info-item-k {\n    width: 72px;\n    line-height: 2;\n  }\n\n  .node-info-item-v {\n    font-weight: bold;\n    line-height: 2;\n  }\n</style>\n\n```\n\n>Script\n```uts\n\n  import nodeChild from './nodes-info-child.uvue'\n  import multiChild from './selector-query-child-multi.uvue'\n\n  type NodeInfoType = {\n    left : number | null,\n    top : number | null,\n    right : number | null,\n    bottom : number | null,\n    width : number | null,\n    height : number | null,\n  }\n\n  export default {\n    components: {\n      nodeChild,\n      multiChild\n    },\n    data() {\n      return {\n        title: 'createSelectorQuery',\n        nodeInfoList: [] as NodeInfoType[],\n        // 仅用于自动化测试\n        rootNodeInfo: null as NodeInfoType | null,\n        //供自动化测试使用\n        // resizeRectValid: false\n        // TODO\n        selectCount: 0,\n        selectAllCount: 0,\n        fieldsResultContainNode: false,\n        nodeResultContainNode: false\n      }\n    },\n    onReady() {\n      const instance2 = (this.$refs['multi-child'] as ComponentPublicInstance)\n      this.selectCount = instance2.$data['selectCount'] as number\n      this.selectAllCount = instance2.$data['selectAllCount'] as number\n\n      this.testFields()\n      this.testNode()\n    },\n    onResize() {\n      //供自动化测试使用\n      /* var rect12Element = uni.getElementById(\"rect-1-2\")\n      if(rect12Element != null) {\n        var domRect = rect12Element.getBoundingClientRect()\n        if(domRect.width > 100) {\n          this.resizeRectValid = true\n        }\n      } */\n    },\n    methods: {\n      // 仅用于自动化测试\n      getRootNodeInfo(selector : string) {\n        uni.createSelectorQuery().select(selector).boundingClientRect().exec((ret) => {\n          if (ret.length == 1) {\n            const nodeInfo = ret[0] as NodeInfo;\n            const nodeType = {\n              left: nodeInfo.left,\n              top: nodeInfo.top,\n              right: nodeInfo.right,\n              bottom: nodeInfo.bottom,\n              width: nodeInfo.width,\n              height: nodeInfo.height,\n            } as NodeInfoType;\n            this.rootNodeInfo = nodeType\n          }\n        })\n      },\n      getNodeInfo() {\n        uni.createSelectorQuery().select('.rect1').boundingClientRect().exec((ret) => {\n          this.nodeInfoList.length = 0\n          const i = ret[0] as NodeInfo\n          this.nodeInfoList.push({\n            left: i.left,\n            top: i.top,\n            right: i.right,\n            bottom: i.bottom,\n            width: i.width,\n            height: i.height,\n          } as NodeInfoType)\n        })\n      },\n      getAllNodeInfo() {\n        uni.createSelectorQuery().selectAll('.rect').boundingClientRect().exec((ret) => {\n          this.nodeInfoList.length = 0\n          const array = ret[0] as NodeInfo[]\n          array.forEach((i) => {\n            this.nodeInfoList.push({\n              left: i.left,\n              top: i.top,\n              right: i.right,\n              bottom: i.bottom,\n              width: i.width,\n              height: i.height,\n            } as NodeInfoType)\n          })\n        })\n      },\n      // test .fields\n      testFields() {\n        uni.createSelectorQuery().select('.rect1').fields({\n          node: true\n        } as NodeField, (ret) => {\n          const isElement = (ret as NodeInfo).node instanceof UniElement\n          if (isElement) {\n            this.fieldsResultContainNode = true\n          } else {\n            this.fieldsResultContainNode = false\n          }\n        }).exec()\n      },\n      // test .node\n      testNode() {\n        uni.createSelectorQuery().select('#canvas1').node((ret) => {\n          const isElement = (ret as NodeInfo).node instanceof UniElement\n          const isCanvasElement = ((ret as NodeInfo).node as UniCanvasElement).tagName == 'CANVAS'\n          if (isElement && isCanvasElement) {\n            this.nodeResultContainNode = true\n          } else {\n            this.nodeResultContainNode = false\n          }\n        }).exec()\n      },\n    }\n  }\n\n```\n\n:::"},"createIntersectionObserver":{"name":"## uni.createIntersectionObserver(component, options) @createintersectionobserver","description":"创建并返回一个 IntersectionObserver 对象实例\n","compatibility":"### createIntersectionObserver 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| component | any | 是 | - | - | - |\n| options | **CreateIntersectionObserverOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| thresholds | Array\\<any\\> | 否 | - | - | 所有阈值 |\n@| initialRatio | number | 否 | - | - | 初始的相交比例 |\n@| observeAll | boolean | 否 | - | - | 是否同时观测多个参照节点(而非一个) | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [IntersectionObserver](#intersectionobserver-values) |\n\n#### IntersectionObserver 的方法 @intersectionobserver-values \n\n#### relativeTo(selector: string, margins?: any): IntersectionObserver; @relativeto\n使用选择器指定一个节点,作为参照区域之一\n##### relativeTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| selector | string | 是 | - | - | - |\n| margins | any | 否 | - | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [IntersectionObserver](#intersectionobserver-values) |\n \n\n#### relativeToViewport(margins?: any): IntersectionObserver; @relativetoviewport\n指定页面显示区域作为参照区域之一\n##### relativeToViewport 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| margins | any | 否 | - | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [IntersectionObserver](#intersectionobserver-values) |\n \n\n#### observe(targetSelector: string, callback: ObserveCallback): void; @observe\n指定目标节点并开始监听相交状态变化情况\n##### observe 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| targetSelector | string | 是 | - | - | - |\n| callback | (result: [ObserveResult](#observeresult-values)) => void | 是 | - | - | - | \n\n##### ObserveResult 的属性值 @observeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| intersectionRatio | number | 是 | - | - | 相交比例 |\n| intersectionRect | any | 是 | - | - | 相交区域的边界 |\n| boundingClientRect | **ObserveNodeRect** | 是 | - | - | 目标节点布局区域的边界 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| left | number | 是 | - | - | left |\n@| right | number | 是 | - | - | right |\n@| top | number | 是 | - | - | top |\n@| bottom | number | 是 | - | - | bottom |\n| relativeRect | [ObserveNodeRect](#observenoderect-values) | 是 | - | - | 参照区域的边界 |\n| time | number | 是 | - | - | 相交检测时的时间戳 |\n\n\n#### disconnect(): void; @disconnect\n停止监听\n##### disconnect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.createIntersectionObserver)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/intersection-observer.html#createintersectionobserver)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createIntersectionObserver&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createIntersectionObserver&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createIntersectionObserver&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createIntersectionObserver&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createIntersectionObserver&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createIntersectionObserver)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createIntersectionObserver&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"showActionSheet":{"name":"## uni.showActionSheet(options) @showactionsheet","description":"从底部向上弹出操作菜单","compatibility":"### showActionSheet 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ShowActionSheetOptions** | 是 | - | - | uni.showActionSheet函数参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| title | string | 否 | - | - | 菜单标题 |\n@| alertText | string | 否 | - | - | 警示文案(同菜单标题, app无效) |\n@| itemList | Array\\<string\\> | 是 | - | - | 按钮的文字数组 |\n@| itemColor | [string.ColorString](/uts/data-type.md#ide-string) | 否 | - | - | 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色) |\n@| popover | **Popover** | 否 | - | - | 大屏设备弹出原生选择按钮框的指示区域,默认居中显示 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| top | number | 是 | - | - | 指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度 |\n@@| left | number | 是 | - | - | 指示区域坐标 |\n@@| width | number | 是 | - | - | 指示区域宽度 |\n@@| height | number | 是 | - | - | 指示区域高度 |\n@| success | (res: [ShowActionSheetSuccess](#showactionsheetsuccess-values)) => void | 否 | - | - | uni.showActionSheet成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void | 否 | - | - | uni.showActionSheet成功回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.showActionSheet成功回调函数定义 | \n\n#### ShowActionSheetSuccess 的属性值 @showactionsheetsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tapIndex | number | 否 | - | - | 用户点击的按钮,从上到下的顺序,从0开始 |\n\n#### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1 | - | 撤销 |\n@| 1001 | - | 请求参数非法 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.showActionSheet)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=showActionSheet&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=showActionSheet&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=showActionSheet&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=showActionSheet&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=showActionSheet&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=showActionSheet)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=showActionSheet&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/show-action-sheet/show-action-sheet.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/show-action-sheet/show-action-sheet\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/show-action-sheet/show-action-sheet\n\n>Template\n```vue\n<template>\n  <!-- #ifdef APP -->\n  <scroll-view style=\"flex: 1;\">\n  <!-- #endif -->\r\n  <view>\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-list\">\r\n      <radio-group @change=\"radioChange\">\r\n        <radio class=\"uni-list-cell uni-list-cell-pd\" v-for=\"(item, index) in items\" :key=\"item.value\"\r\n          :class=\"index < items.length - 1 ? 'uni-list-cell-line': ''\" :value=\"item.value\" :checked=\"index === current\">\r\n          {{item.name}}\r\n        </radio>\r\n      </radio-group>\r\n    </view>\r\n    <view class=\"uni-list\">\r\n      <view class=\"uni-list-cell uni-list-cell-pd\">\r\n        <view class=\"uni-list-cell-db\">自定义itemColor</view>\r\n        <switch :checked=\"itemColorCustom\" @change=\"itemColorChange\" />\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-pd\">\r\n        <view class=\"uni-list-cell-db\">超长文本和空文本item</view>\r\n        <switch :checked=\"itemContentLarge\" @change=\"itemContentLargeChange\" />\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-pd\">\r\n        <view class=\"uni-list-cell-db\">超过6个item</view>\r\n        <switch :checked=\"itemNumLargeSelect\" @change=\"itemNumLargeChange\" />\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-btn-v\">\r\n        <button class=\"uni-btn-v\" type=\"default\" @tap=\"actionSheetTap\" id=\"btn-action-sheet-show\">弹出action\r\n          sheet</button>\r\n      </view>\r\n    </view>\r\n  </view>\n  <!-- #ifdef APP -->\n  </scroll-view>\n  <!-- #endif -->\r\n</template>\r\n\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,\r\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    },\r\n    onLoad() {\r\n      uni.showActionSheet({\r\n        title: \"onLoad 调用示例,请手动取消\",\r\n        itemList: ['item1', 'item2'],\r\n      })\r\n    },\r\n    methods: {\r\n      //自动化测试例专用\r\n      jest_getWindowInfo() : GetWindowInfoResult {\r\n        return uni.getWindowInfo();\r\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        }\r\n\r\n        if (this.itemNumLargeSelect) {\r\n          // 大量选项测试,不能超过6个元素 https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet\r\n          itemInfo = []\r\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) => {\r\n              if (this.showErrorToast) {\r\n                uni.showToast({\r\n                  title: e.errMsg,\r\n                  icon: \"none\"\r\n                })\r\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);\r\n              if (this.showErrorToast) {\r\n                uni.showToast({\r\n                  title: e.errMsg,\r\n                  icon: \"none\"\r\n                })\r\n              }\r\n            }\r\n          })\r\n        }\r\n      },\r\n    }\r\n  }\r\n\n```\n\n:::"},"showModal":{"name":"## uni.showModal(options) @showmodal","description":"显示模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。","compatibility":"### showModal 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ShowModalOptions** | 是 | - | - | uni.showModal 参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| title | string | 否 | - | - | 提示的标题 |\n@| content | string | 否 | - | - | 提示的内容 |\n@| showCancel | boolean | 否 | true<br/>是否显示取消按钮,默认为 true | - |  |\n@| cancelText | string | 否 | - | - | 取消按钮的文字,默认为\"取消\" |\n@| cancelColor | [string.ColorString](/uts/data-type.md#ide-string) | 否 | - | - | 取消按钮的文字颜色,默认为\"#000000\" |\n@| confirmText | string | 否 | - | - | 确定按钮的文字,默认为\"确定\" |\n@| confirmColor | [string.ColorString](/uts/data-type.md#ide-string) | 否 | - | - | 确定按钮的文字颜色 |\n@| editable | boolean | 否 | false<br/>是否显示输入框 | - |  |\n@| placeholderText | string | 否 | - | - | 显示输入框时的提示文本 |\n@| success | (res: [ShowModalSuccess](#showmodalsuccess-values)) => void | 否 | - | - | uni.showModal成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void | 否 | - | - | uni.showModal失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.showModal完成回调函数定义 | \n\n#### ShowModalSuccess 的属性值 @showmodalsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| confirm | boolean | 是 | - | - | 为 true 时,表示用户点击了确定按钮 |\n| cancel | boolean | 是 | - | - | 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) |\n| content | string | 否 | - | - | editable 为 true 时,用户输入的文本 |\n\n#### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1 | - | 撤销 |\n@| 1001 | - | 请求参数非法 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.showModal)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=showModal&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=showModal&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=showModal&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=showModal&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=showModal&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=showModal)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=showModal&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/show-modal/show-modal.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/show-modal/show-modal\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/show-modal/show-modal\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-list\">\r\n        <radio-group @change=\"radioChange\">\r\n          <radio class=\"uni-list-cell uni-list-cell-pd\" v-for=\"(item, index) in items\" :key=\"item.value\"\r\n            :class=\"index < items.length - 1 ? 'uni-list-cell-line' : ''\" :value=\"item.value\"\r\n            :checked=\"index === current\">\r\n            {{ item.name }}\r\n          </radio>\r\n        </radio-group>\r\n      </view>\r\n      <view class=\"uni-list\">\r\n        <view class=\"uni-list-cell uni-list-cell-pd\">\r\n          <view class=\"uni-list-cell-db\">是否显示取消按钮</view>\r\n          <switch :checked=\"showCancelSelect\" @change=\"showCancelChange\" />\r\n        </view>\r\n        <view class=\"uni-list-cell uni-list-cell-pd\">\r\n          <view class=\"uni-list-cell-db\">定制取消文案</view>\r\n          <switch :checked=\"cancelTextSelect\" @change=\"cancelTextChange\" />\r\n        </view>\r\n        <view class=\"uni-list-cell uni-list-cell-pd\">\r\n          <view class=\"uni-list-cell-db\">定制确认文案</view>\r\n          <switch :checked=\"confirmTextSelect\" @change=\"confirmTextChange\" />\r\n        </view>\r\n        <view class=\"uni-list-cell uni-list-cell-pd\">\r\n          <view class=\"uni-list-cell-db\">是否显示输入框</view>\r\n          <switch :checked=\"editableSelect\" @change=\"editableChange\" />\r\n        </view>\r\n        <view class=\"uni-list-cell uni-list-cell-pd\">\r\n          <view class=\"uni-list-cell-db\">是否定制输入提示词</view>\r\n          <switch :checked=\"placeholderTextSelect\" @change=\"placeholderTextChange\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"uni-btn-v\">\r\n          <button class=\"uni-btn-v\" type=\"default\" @tap=\"modalTap\" id=\"btn-modal-show\">\r\n            modal测试\r\n          </button>\r\n        </view>\r\n        <text>{{ exeRet }}</text>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\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: 'modal',\r\n        showCancelSelect: false,\r\n        cancelTextSelect: false,\r\n        confirmTextSelect: false,\r\n        editableSelect: false,\r\n        placeholderTextSelect: false,\r\n        exeRet: \"\",\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    },\r\n    onLoad() {\r\n      uni.showModal({\r\n        title: \"onLoad 调用示例,请手动取消\",\r\n        showCancel: false\r\n      })\r\n    },\r\n    methods: {\r\n      //自动化测试例专用\r\n      jest_getWindowInfo() : GetWindowInfoResult {\r\n        return uni.getWindowInfo();\r\n      },\r\n      showCancelChange: function (e : UniSwitchChangeEvent) {\r\n        this.showCancelSelect = e.detail.value\r\n      },\r\n      cancelTextChange: function (e : UniSwitchChangeEvent) {\r\n        this.cancelTextSelect = e.detail.value\r\n      },\r\n      confirmTextChange: function (e : UniSwitchChangeEvent) {\r\n        this.confirmTextSelect = e.detail.value\r\n      },\r\n      editableChange: function (e : UniSwitchChangeEvent) {\r\n        this.editableSelect = e.detail.value\r\n      },\r\n      placeholderTextChange: function (e : UniSwitchChangeEvent) {\r\n        this.placeholderTextSelect = e.detail.value\r\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      modalTap: function () {\r\n        let cancelTextVal : string\r\n        let cancelColorVal = ''\r\n        if (this.cancelTextSelect) {\r\n          cancelTextVal = \"修改后的取消文本\"\r\n          cancelColorVal = \"#ff00ff\"\r\n        } else {\r\n          cancelTextVal = \"取消\"\r\n        }\r\n\r\n        let confirmTextVal = '确定'\r\n        let confirmColorVal = ''\r\n        if (this.confirmTextSelect) {\r\n          confirmTextVal = \"修改后的确定文本\"\r\n          confirmColorVal = \"#00ffff\"\r\n        }\r\n\r\n        let placeholderTextVal = ''\r\n        let contentVal = \"弹窗内容,告知当前状态、信息和解决方法,描述文字尽量控制在三行内\"\r\n        if (this.placeholderTextSelect) {\r\n          placeholderTextVal = \"定制提示信息\"\r\n          contentVal = \"\"\r\n        }\r\n        uni.showModal({\r\n          title: this.items[this.current].value,\r\n          editable: this.editableSelect,\r\n          placeholderText: placeholderTextVal,\r\n          content: contentVal,\r\n          showCancel: this.showCancelSelect,\r\n          cancelText: cancelTextVal,\r\n          cancelColor: cancelColorVal,\r\n          confirmText: confirmTextVal,\r\n          confirmColor: confirmColorVal,\r\n          success: (res) => {\r\n            this.exeRet = JSON.stringify(res)\r\n          },\r\n          fail: (res) => {\r\n            this.exeRet = JSON.stringify(res)\r\n          }\r\n        })\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"showLoading":{"name":"## uni.showLoading(options) @showloading","description":"显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。","compatibility":"### showLoading 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ShowLoadingOptions** | 是 | - | - | uni.showLoading参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| title | string | 是 | - | - | 提示的内容,长度与 icon 取值有关。 |\n@| mask | boolean | 否 | - | - | 是否显示透明蒙层,防止触摸穿透,默认:false |\n@| success | (res: ShowLoadingSuccess) => void | 否 | - | - | uni.showLoading成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void | 否 | - | - | uni.showLoading失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.showLoading完成回调函数定义 | \n\n#### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1 | - | 撤销 |\n@| 1001 | - | 请求参数非法 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.showLoading.showLoading)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=showLoading&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=showLoading&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=showLoading&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=showLoading&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=showLoading&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=showLoading)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=showLoading&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/show-loading/show-loading.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/show-loading/show-loading\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/show-loading/show-loading\n\n>Template\n```vue\n<template>\r\n  <view>\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-list\">\r\n      <view class=\"uni-list-cell uni-list-cell-pd\">\r\n        <view class=\"uni-list-cell-db\">是否显示透明蒙层-屏蔽点击事件</view>\r\n        <switch :checked=\"maskSelect\" @change=\"maskChange\" />\r\n      </view>\r\n      <view class=\"uni-padding-wrap\">\r\n        <view class=\"uni-title uni-common-mt\">\r\n          <text class=\"uni-title-text\"> 设置标题 </text>\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list uni-common-pl\">\r\n        <radio-group @change=\"radioChange\">\r\n          <radio class=\"uni-list-cell uni-list-cell-pd radio\" v-for=\"(item, index) in items\" :key=\"item.value\"\r\n            :class=\"index < items.length - 1 ? 'uni-list-cell-line' : ''\" :value=\"item.value\"\r\n            :checked=\"index === current\">\r\n            {{ item.name }}\r\n          </radio>\r\n        </radio-group>\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-btn-v\">\r\n        <button class=\"uni-btn-v\" type=\"primary\" @click=\"showLoading\">显示 loading 提示框</button>\r\n        <button class=\"uni-btn-v\" @click=\"hideLoading\">隐藏 loading 提示框</button>\r\n        <text>为方便演示,loading弹出3秒后自动关闭</text>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\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: 'loading',\r\n        items: [\r\n          {\r\n            value: 'null',\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        maskSelect: false,\r\n        titleSelect: \"null\"\r\n      }\r\n    },\r\n    onLoad() {\r\n      uni.showLoading({\r\n        title: 'onLoad 调用示例,2秒后消失'\r\n      })\r\n      setTimeout(function () {\r\n        uni.hideLoading()\r\n      }, 2000);\r\n    },\r\n    methods: {\r\n      //自动化测试例专用\r\n      jest_getWindowInfo() : GetWindowInfoResult {\r\n        return uni.getWindowInfo();\r\n      },\r\n\r\n      radioChange(e : UniRadioGroupChangeEvent) {\r\n        const selected = this.items.find((item) : boolean => {\r\n          return item.value == e.detail.value\r\n        })\r\n        if (selected != null) {\r\n          this.titleSelect = selected.value\r\n        }\r\n      },\r\n      maskChange: function (e : UniSwitchChangeEvent) {\r\n        this.maskSelect = e.detail.value\r\n      },\r\n      showLoading: function () {\r\n\r\n        console.log(this.titleSelect)\r\n        if (this.titleSelect == \"null\") {\r\n          uni.showLoading({\r\n            title: \"\",\r\n            mask: this.maskSelect\r\n          });\r\n        } else {\r\n          uni.showLoading({\r\n            title: this.titleSelect,\r\n            mask: this.maskSelect\r\n          });\r\n        }\r\n        setTimeout(() => {\r\n          this.hideLoading();\r\n        }, 3000);\r\n      },\r\n      hideLoading: function () {\r\n        uni.hideLoading();\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"hideLoading":{"name":"## uni.hideLoading() @hideloading","description":"隐藏 loading 提示框。","compatibility":"### hideLoading 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.showLoading.hideLoading)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hideloading)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=hideLoading&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=hideLoading&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=hideLoading&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=hideLoading&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=hideLoading&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=hideLoading)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=hideLoading&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"showToast":{"name":"## uni.showToast(options) @showtoast","description":"显示消息提示框","compatibility":"### showToast 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ShowToastOptions** | 是 | - | - | uni.showToast参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| title | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 提示的内容,长度与 icon 取值有关。 |\n@| icon | string | 否 | \"success\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | icon值说明 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| success | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 显示成功图标 |\n@@| error | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 显示错误图标 |\n@@| fail | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"x\"]]}' /> | 显示错误图标,此时title文本无长度显示 |\n@@| exception | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"x\"]]}' /> | 显示异常图标,此时title文本无长度显示 |\n@@| loading | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 显示加载图标 |\n@@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 不显示图标 |\n@| image | [string.ImageURIString](/uts/data-type.md#ide-string) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 自定义图标的本地路径(app端暂不支持gif) |\n@| mask | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 是否显示透明蒙层,防止触摸穿透 |\n@| duration | number | 否 | 1500 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 提示的延迟时间,单位毫秒 |\n@| position | string | 否 | \"bottom\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9.0\",\"4.11\"]]}' /> | position值说明。纯文本轻提示显示位置,填写有效值后只有 title 属性生效,且不支持通过 uni.hideToast 隐藏。 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| top | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.11\"]]}' /> | 居上显示 |\n@@| center | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.11\"]]}' /> | 居中显示 |\n@@| bottom | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9.0\",\"4.11\"]]}' /> | 居底显示 |\n@| success | (res: ShowToastSuccess) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | uni.showToast成功回调函数定义 |\n@| fail | (res: [IPromptError](#iprompterror-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | uni.showToast失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | uni.showToast完成回调函数定义 | \n\n#### IPromptError 的属性值 @iprompterror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1 | - | 撤销 |\n@| 1001 | - | 请求参数非法 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.showToast.showToast)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=showToast&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=showToast&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=showToast&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=showToast&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=showToast&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=showToast)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=showToast&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/show-toast/show-toast.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/show-toast/show-toast\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/show-toast/show-toast\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view direction=\"vertical\" style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-padding-wrap\">\r\n        <text class=\"uni-title-text uni-common-mb\">设置icon</text>\r\n      </view>\r\n      <view class=\"uni-list uni-common-pl\">\r\n        <radio-group @change=\"radioChangeIcon\">\r\n          <radio class=\"uni-list-cell uni-list-cell-pd radio-icon\" v-for=\"(icon, index) in icon_enum\" :key=\"icon.value\"\r\n            :class=\"index < icon_enum.length - 1 ? 'uni-list-cell-line' : ''\" :value=\"icon.value\"\r\n            :checked=\"index === icon_current\">{{icon.name}}</radio>\r\n        </radio-group>\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-padding\">\r\n        <view class=\"uni-list-cell-db\">是否显示自定义图标</view>\r\n        <switch :checked=\"imageSelect\" @change=\"change_image_boolean\" />\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-padding\">\r\n        <view class=\"uni-list-cell-db\">是否显示透明蒙层-屏蔽点击事件</view>\r\n        <switch :checked=\"maskSelect\" @change=\"change_mask_boolean\" />\r\n      </view>\r\n      <view class=\"uni-title uni-list-cell-padding\">提示的延迟时间,默认:1500(单位毫秒)</view>\r\n      <view class=\"uni-list-cell-padding\">\r\n        <slider @change=\"sliderChange\" foreColor=\"#007AFF\" :value=\"intervalSelect\" :min=\"1500\" :max=\"5000\"\r\n          :show-value=\"true\" />\r\n      </view>\r\n      <view class=\"uni-btn-v\">\r\n        <button class=\"uni-btn-v\" type=\"default\" @tap=\"toast1Tap\" id=\"btn-toast-default\">点击弹出toast</button>\r\n        <button class=\"uni-btn-v\" type=\"default\" @tap=\"hideToast\" id=\"btn-toast-hide\">点击隐藏toast</button>\r\n      </view>\r\n      <!-- #ifdef APP -->\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <text class=\"uni-title-text uni-common-mb\"> 设置position,仅App生效 </text>\r\n      </view>\r\n      <view class=\"uni-list uni-common-pl\">\r\n        <radio-group @change=\"radioChangePosition\">\r\n          <radio class=\"uni-list-cell uni-list-cell-pd radio-position\" v-for=\"(position, index) in position_enum\"\r\n            :key=\"position.value\" :class=\"index < position_enum.length - 1 ? 'uni-list-cell-line' : ''\"\r\n            :value=\"position.value\" :checked=\"index === position_current\">{{position.name}}</radio>\r\n        </radio-group>\r\n      </view>\r\n      <button class=\"uni-btn uni-btn-v uni-common-mb\" type=\"default\" @tap=\"toast2Tap\">点击弹出设置position的toast</button>\r\n      <!-- #endif -->\r\n      <text>{{exeRet}}</text>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\n\n```\n\n>Script\n```uts\n\r\n  type IconItemType = {\r\n    value : \"success\" | \"error\" | \"fail\" | \"exception\" | \"loading\" | \"none\";\r\n    name : string\r\n  }\r\n  type PositionItemType = {\r\n    value : \"top\" | \"center\" | \"bottom\";\r\n    name : string\r\n  }\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'toast',\r\n        exeRet: '',\r\n        imageSelect: false,\r\n        maskSelect: false,\r\n        intervalSelect: 1500,\r\n        position_current: 0,\r\n        position_enum: [\r\n          { \"value\": \"top\", \"name\": \"top: 居上显示(Android 暂不支持)\" },\r\n          { \"value\": \"center\", \"name\": \"center: 居中显示(Android 暂不支持)\" },\r\n          { \"value\": \"bottom\", \"name\": \"bottom: 居底显示\" },\r\n        ] as PositionItemType[],\r\n        icon_current: 0,\r\n        icon_enum: [\r\n          {\r\n            value: 'success',\r\n            name: '显示成功图标',\r\n          },\r\n          {\r\n            value: 'error',\r\n            name: '显示错误图标',\r\n          },\r\n          // {\r\n          //   value: 'fail',\r\n          //   name: '显示错误图标',\r\n          // },\r\n          // {\r\n          //   value: 'exception',\r\n          //   name: '显示异常图标,此时title文本无长度显示',\r\n          // },\r\n          {\r\n            value: 'loading',\r\n            name: '显示加载图标',\r\n          },\r\n          {\r\n            value: 'none',\r\n            name: '不显示图标',\r\n          },\r\n        ] as IconItemType[],\r\n      }\r\n    },\r\n    onLoad() {\r\n      uni.showToast({\r\n        title: 'onLoad 调用示例,2秒后消失'\r\n      })\r\n      setTimeout(function () {\r\n        uni.hideToast()\r\n      }, 2000);\r\n    },\r\n    methods: {\r\n      //自动化测试例专用\r\n      jest_getWindowInfo() : GetWindowInfoResult {\r\n        return uni.getWindowInfo();\r\n      },\r\n      radioChangeIcon(e : UniRadioGroupChangeEvent) {\r\n        for (let i = 0; i < this.icon_enum.length; i++) {\r\n          if (this.icon_enum[i].value === e.detail.value) {\r\n            this.icon_current = i;\r\n            break;\r\n          }\r\n        }\r\n      },\r\n      change_image_boolean: function (e : UniSwitchChangeEvent) {\r\n        this.imageSelect = e.detail.value\r\n      },\r\n      change_mask_boolean: function (e : UniSwitchChangeEvent) {\r\n        this.maskSelect = e.detail.value\r\n      },\r\n      sliderChange(e : UniSliderChangeEvent) {\r\n        this.intervalSelect = e.detail.value\r\n      },\r\n      radioChangePosition(e : UniRadioGroupChangeEvent) {\r\n        for (let i = 0; i < this.position_enum.length; i++) {\r\n          if (this.position_enum[i].value === e.detail.value) {\r\n            this.position_current = i;\r\n            break;\r\n          }\r\n        }\r\n      },\r\n      toast1Tap: function () {\r\n        uni.showToast({\r\n          title: \"默认\",\r\n          icon: this.icon_enum[this.icon_current].value,\r\n          duration: this.intervalSelect,\r\n          image: this.imageSelect ? \"/static/uni.png\" : null,\r\n          mask: this.maskSelect,\r\n          success: (res) => {\r\n            // console.log('success:',res)\r\n            this.exeRet = \"success:\" + JSON.stringify(res)\r\n          },\r\n          fail: (res) => {\r\n            this.exeRet = \"fail:\" + JSON.stringify(res)\r\n          },\r\n        })\r\n      },\n      toast3Tap: function () {\n        uni.showToast({\n          title: \"默认\",\n          icon: 'none',\n          duration: this.intervalSelect,\n          image: this.imageSelect ? \"/static/uni.png\" : null,\n          mask: this.maskSelect,\n          success: (res) => {\n            // console.log('success:',res)\n            this.exeRet = \"success:\" + JSON.stringify(res)\n          },\n          fail: (res) => {\n            this.exeRet = \"fail:\" + JSON.stringify(res)\n          },\n        })\n      },\r\n      // #ifdef APP\r\n      toast2Tap: function () {\r\n        let positionValue = this.position_enum[this.position_current].value\r\n        uni.showToast({\r\n          title: \"显示一段轻提示,position:\" + positionValue,\r\n          position: positionValue,\r\n          success: (res) => {\r\n            this.exeRet = \"success:\" + JSON.stringify(res)\r\n          },\r\n          fail: (res) => {\r\n            this.exeRet = \"fail:\" + JSON.stringify(res)\r\n          },\r\n        })\r\n      },\r\n      // #endif\r\n      hideToast: function () {\r\n        uni.hideToast()\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"hideToast":{"name":"## uni.hideToast() @hidetoast","description":"隐藏消息提示框。","compatibility":"### hideToast 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.showToast.hideToast)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hidetoast)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=hideToast&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=hideToast&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=hideToast&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=hideToast&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=hideToast&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=hideToast)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=hideToast&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"loadFontFace":{"name":"## uni.loadFontFace(options) @loadfontface","description":"动态加载网络字体\n","compatibility":"### loadFontFace 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.10 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **LoadFontFaceOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| global | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"x\"]]}' /> | 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。 |\n@| family | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.10\"]]}' /> | 定义的字体名称 |\n@| source | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.10\"]]}' /> | 字体资源的地址, App-Android 平台不支持 woff、woff2 格式字体文件 |\n@| desc | **LoadFontFaceOptionDesc** | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"4.10\"]]}' /> | 可选的字体描述符 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| style | string | 否 | - | - |  |\n@@| weight | string | 否 | - | - |  |\n@@| variant | string | 否 | - | - |  |\n@| success | (result: AsyncApiSuccessResult) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.10\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (error: [LoadFontFaceFail](#loadfontfacefail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.10\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (res: [AsyncApiResult](#asyncapiresult-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"√\",\"4.10\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### LoadFontFaceFail 的属性值 @loadfontfacefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 4 | - | 框架内部异常 |\n@| 99 | - | page is not ready |\n@| 101 | - | 参数错误 |\n@| 100001 | - | family is null |\n@| 100002 | - | source is null |\n@| 200001 | - | local font not found |\n@| 300001 | - | same source task is loading |\n@| 300002 | - | download fail |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n#### AsyncApiResult 的属性值 @asyncapiresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Promise\\<AsyncApiSuccessResult> | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.loadFontFace)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/font.html#loadfontface)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=loadFontFace&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=loadFontFace&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=loadFontFace&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=loadFontFace&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=loadFontFace&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=loadFontFace)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=loadFontFace&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/load-font-face/load-font-face\n\n>Template\n```vue\n<template>\r\n  <page-head title=\"loadFontFace\"></page-head>\r\n  <view class=\"uni-padding-wrap\">\r\n    <text class=\"font-size-20\">全局加载字体:</text>\r\n    <text class=\"font-size-20 line-height-40\" style=\"font-family: UniFontFamily\">font-family: uni.ttf</text>\r\n    <view style=\"flex-direction: row;\">\r\n      <text class=\"font-size-20\" style=\"font-family: UniFontFamily;\">{{\r\n        uniIcon1\r\n      }}</text>\r\n      <text style=\"margin-left:5px;margin-right: 20px;line-height:22px;\">\\ue100</text>\r\n      <text class=\"font-size-20\" style=\"font-family: UniFontFamily;\">{{\r\n        uniIcon2\r\n      }}</text>\r\n      <text style=\"margin-left:5px;line-height:22px;\">\\ue101</text>\r\n    </view>\r\n    <text class=\"uni-common-mt font-size-20\">非全局加载字体:</text>\r\n    <text class=\"font-size-20 line-height-40\" style=\"font-family: AlimamaDaoLiTiTTF\">font-family: 阿里妈妈刀隶体-ttf\r\n      (网络字体下载后生效)</text>\r\n    <text class=\"font-size-20 line-height-40\" style=\"font-family: AlimamaDaoLiTiOTF\">font-family:\r\n      阿里妈妈刀隶体-otf</text>\r\n    <text class=\"item\" style=\"font-family: AlimamaDaoLiTiWOFF\">font-family: 阿里妈妈刀隶体-woff</text>\r\n    <text class=\"item\" style=\"font-family: AlimamaDaoLiTiWOFF2\">font-family: 阿里妈妈刀隶体-woff2</text>\r\n    <button class=\"uni-btn\" @click=\"navigateToChild\">跳转子页面测试字体生效范围</button>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n  .font-size-20 {\r\n    font-size: 20px;\r\n  }\r\n\r\n  .line-height-40 {\r\n    line-height: 40px;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        uniIcon1: '\\ue100',\r\n        uniIcon2: '\\ue101',\r\n      }\r\n    },\r\n    onLoad() {\r\n      uni.loadFontFace({\r\n        global: true,\r\n        family: 'UniFontFamily',\r\n        source: \"url('/static/font/uni.ttf')\",\r\n        success() {\r\n          console.log('global loadFontFace uni.ttf success')\r\n        },\r\n        fail(error) {\r\n          console.warn('global loadFontFace uni.ttf fail', error.errMsg)\r\n        },\r\n      })\r\n      uni.loadFontFace({\r\n        family: 'AlimamaDaoLiTiTTF',\r\n        source:\r\n          \"url('https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/font/AlimamaDaoLiTi.ttf')\",\r\n        success() {\r\n          console.log('loadFontFace Remote AlimamaDaoLiTi.ttf success')\r\n        },\r\n        fail(error) {\r\n          console.warn('loadFontFace Remote AlimamaDaoLiTi.ttf fail', error.errMsg)\r\n        },\r\n      })\r\n      uni.loadFontFace({\r\n        family: 'AlimamaDaoLiTiOTF',\r\n        source: \"url('/static/font/AlimamaDaoLiTi.otf')\",\r\n        success() {\r\n          console.log('loadFontFace AlimamaDaoLiTi.otf success')\r\n        },\r\n        fail(error) {\r\n          console.warn('loadFontFace AlimamaDaoLiTi.otf fail', error.errMsg)\r\n        },\r\n      })\r\n      uni.loadFontFace({\r\n        family: 'AlimamaDaoLiTiWOFF',\r\n        source: \"url('/static/font/AlimamaDaoLiTi.woff')\",\r\n        success() {\r\n          console.log('loadFontFace AlimamaDaoLiTi.woff success')\r\n        },\r\n        fail(error) {\r\n          console.warn('loadFontFace AlimamaDaoLiTi.woff fail', error.errMsg)\r\n        },\r\n      })\r\n      uni.loadFontFace({\r\n        family: 'AlimamaDaoLiTiWOFF2',\r\n        source: \"url('/static/font/AlimamaDaoLiTi.woff2')\",\r\n        success() {\r\n          console.log('loadFontFace AlimamaDaoLiTi.woff2 success')\r\n        },\r\n        fail(error) {\r\n          console.warn('loadFontFace AlimamaDaoLiTi.woff2 fail', error.errMsg)\r\n        },\r\n      })\r\n    },\r\n    methods: {\r\n      navigateToChild() {\r\n        uni.navigateTo({\r\n          url: '/pages/API/load-font-face/load-font-face-child',\r\n        })\r\n      },\r\n    },\r\n  }\r\n\n```\n\n:::"},"rpx2px":{"name":"## uni.rpx2px(number) @rpx2px","description":"将rpx单位值转换成px","compatibility":"### rpx2px 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.02 | 4.02 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| number | number | 是 | - | - | - | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.rpx2px)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/ui/font.html#upx2px)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/rpx2px/rpx2px\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view class=\"page\">\r\n      <page-head :title=\"title\"></page-head>\r\n      <view>\r\n        <view class=\"item\">\r\n          <text class=\"item-k\">输入:</text>\r\n          <text class=\"item-v\">{{rpxValue}}rpx</text>\r\n        </view>\r\n        <view class=\"item\">\r\n          <text class=\"item-k\">返回:</text>\r\n          <text class=\"item-v\">{{pxValue}}px</text>\r\n        </view>\r\n      </view>\r\n      <view>\r\n        <button class=\"convert\" type=\"primary\" @click=\"rpx2px\">转换</button>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<style>\r\n  .page {\r\n    padding: 15px;\r\n  }\r\n\r\n  .item {\r\n    flex-direction: row;\r\n  }\r\n\r\n  .item-k {\r\n    width: 72px;\r\n    line-height: 2;\r\n  }\r\n\r\n  .item-v {\r\n    font-weight: bold;\r\n    line-height: 2;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'rpx2px',\r\n        rpxValue: 750,\r\n        pxValue: 0,\r\n        result: false\r\n      }\r\n    },\r\n    methods: {\r\n      rpx2px: function () {\r\n        this.pxValue = uni.rpx2px(this.rpxValue);\r\n\r\n        // 仅限自动化测试\r\n        const windowInfo = uni.getWindowInfo();\r\n        if (windowInfo.windowWidth == this.pxValue) {\r\n          this.result = true\r\n        }\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"setAppTheme":{"name":"## uni.setAppTheme(options) @setapptheme","description":"设置应用主题","compatibility":"### setAppTheme 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetAppThemeOptions** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| theme | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 主题 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| light | - | - |\n@@| dark | - | - |\n@@| auto | - | - |\n@| success | (result: [SetAppThemeSuccessResult](#setappthemesuccessresult-values)) => void | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IAppThemeFail](#iappthemefail-values)) => void | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### SetAppThemeSuccessResult 的属性值 @setappthemesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| theme | string | 是 | - | - | - |\n\n#### IAppThemeFail 的属性值 @iappthemefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 错误码<br/>- 702001  参数错误<br/>- 2002000  未知错误 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 702001 | - | - |\n@| 2002000 | - | - |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.themeChange.setAppTheme)"},"onOsThemeChange":{"name":"## uni.onOsThemeChange(callback) @onosthemechange","description":"开启监听系统主题变化","compatibility":"### onOsThemeChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (res: [OsThemeChangeResult](#osthemechangeresult-values)) => void | 是 | - | - | - | \n\n### OsThemeChangeResult 的属性值 @osthemechangeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| osTheme | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 系统主题 |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.themeChange.onOsThemeChange)"},"offOsThemeChange":{"name":"## uni.offOsThemeChange(id) @offosthemechange","description":"取消监听系统主题变化","compatibility":"### offOsThemeChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | number | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.themeChange.offOsThemeChange)"},"onAppThemeChange":{"name":"## uni.onAppThemeChange(callback) @onappthemechange","description":"开启监听应用主题变化","compatibility":"### onAppThemeChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (res: [AppThemeChangeResult](#appthemechangeresult-values)) => void | 是 | - | - | - | \n\n### AppThemeChangeResult 的属性值 @appthemechangeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| appTheme | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 应用主题 |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.themeChange.onAppThemeChange)"},"offAppThemeChange":{"name":"## uni.offAppThemeChange(id) @offappthemechange","description":"取消监听应用主题变化","compatibility":"### offAppThemeChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | number | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.themeChange.offAppThemeChange)"},"themeChange":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/theme-change/theme-change.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/theme-change/theme-change\n```uvue\n<template>\r\n  <view class=\"uni-padding-wrap\">\r\n    <view class=\"uni-common-mt item-box\">\r\n      <text>osTheme:</text>\r\n      <text id=\"theme\">{{ osTheme }}</text>\r\n    </view>\r\n    <view class=\"uni-common-mt item-box\">\r\n      <text>应用当前主题:</text>\r\n      <text id=\"theme\">{{ appTheme }}</text>\r\n    </view>\r\n\r\n    <view>\r\n      <view class=\"uni-title uni-common-mt\">\r\n        <text class=\"uni-title-text\"> 修改appTheme主题(此处仅为演示API,本应用并未完整适配暗黑模式) </text>\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-list uni-common-pl\">\r\n      <radio-group @change=\"radioChange\" class=\"radio-group\">\r\n        <radio class=\"uni-list-cell uni-list-cell-pd radio\" v-for=\"(item, index) in items\" :key=\"item\"\r\n          :class=\"index < items.length - 1 ? 'uni-list-cell-line' : ''\" :value=\"item\" :checked=\"index === current\">\r\n          {{ item }}\r\n        </radio>\r\n      </radio-group>\r\n    </view>\r\n\r\n  </view>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        osThemeChangeId: 0,\r\n        appThemeChangeId: 0,\r\n        osTheme: \"light\" as string,\r\n        appTheme: \"light\" as string,\r\n        originalTheme: \"light\" as string,\r\n        current: 0,\r\n        items: [\r\n          \"light\",\r\n          \"dark\",\r\n          \"auto\"\r\n        ] as string[]\r\n      }\r\n    },\r\n    methods: {\r\n      bindOsThemeChange() : number {\r\n        //注册osTheme变化监听\r\n        return uni.onOsThemeChange((res : OsThemeChangeResult) => {\r\n          this.osTheme = res.osTheme\r\n        })\r\n      },\r\n      bindAppThemeChange() : number {\r\n        //注册appTheme变化监听\r\n        return uni.onAppThemeChange((res : AppThemeChangeResult) => {\r\n          this.appTheme = res.appTheme\r\n        })\r\n      },\r\n      radioChange(e : UniRadioGroupChangeEvent) {\r\n        const theme = e.detail.value\r\n        this.setAppTheme(theme)\r\n        uni.showToast({\r\n          icon: 'none',\r\n          title: '当前选中:' + theme,\r\n        })\r\n      },\r\n      setAppTheme(value : string) {\r\n        uni.setAppTheme({\r\n          theme: value,\r\n          success: function () {\r\n            console.log(\"设置appTheme为\", value, \"成功\")\r\n          },\r\n          fail: function (e : IAppThemeFail) {\r\n            console.log(\"设置appTheme为\", value, \"失败,原因:\", e.errMsg)\r\n          }\r\n        })\r\n      }\r\n    },\r\n    onReady() {\r\n      uni.getSystemInfo({\r\n        success: (res : GetSystemInfoResult) => {\r\n          this.osTheme = res.osTheme!\r\n          this.originalTheme = res.appTheme!\r\n          this.appTheme = res.appTheme == \"auto\" ? res.osTheme! : res.appTheme!\r\n          this.current = this.items.indexOf(res.appTheme!)\r\n        }\r\n      })\r\n      this.osThemeChangeId = this.bindOsThemeChange()\r\n      this.appThemeChangeId = this.bindAppThemeChange()\r\n    },\r\n    onUnload() {\r\n      //注销监听\r\n      uni.offAppThemeChange(this.appThemeChangeId)\r\n      uni.offOsThemeChange(this.osThemeChangeId)\r\n      uni.showToast({\r\n        \"position\": \"bottom\",\r\n        \"title\": \"已停止监听主题切换\"\r\n      })\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .item-box {\r\n    display: flex;\r\n    flex-direction: row;\r\n    justify-content: space-between;\r\n  }\r\n\r\n  .uni-list-cell {\r\n    justify-content: flex-start;\r\n  }\r\n</style>\n\n```\n:::"},"getLocale":{"name":"## uni.getLocale() @getlocale","description":"获取当前设置的语言\n","compatibility":"### getLocale 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.locale.getLocale)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/ui/locale.html#getlocale)"},"setLocale":{"name":"## uni.setLocale(locale) @setlocale","description":"设置当前语言\n","compatibility":"### setLocale 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| locale | string | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.locale.setLocale)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/ui/locale.html#setlocale)"},"onLocaleChange":{"name":"## uni.onLocaleChange(callback) @onlocalechange","description":"设置当前语言\n","compatibility":"### onLocaleChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnLocaleChangeCallbackResult](#onlocalechangecallbackresult-values)) => void | 是 | - | - | - | \n\n### OnLocaleChangeCallbackResult 的属性值 @onlocalechangecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| locale | string | 否 | - | - | 当前语言 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ui.locale.onLocaleChange)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/ui/locale.html#onlocalechange)"},"request":{"name":"## uni.request(param) @request","description":"发起网络请求。","compatibility":"### request 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| param | [RequestOptions\\<T>](#requestoptions-values) | 是 | - | - | 网络请求参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器接口地址<br/> |\n@| data | any | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 请求的参数 在`app-android端,参数类型只能为`UTSJSONObject`或者`string`类型 |\n@| header | UTSJSONObject | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设置请求的 header,header 中不能设置 Referer |\n@| method | string | 否 | \"GET\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 请求方法 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| GET | - | GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。 |\n@@| POST | - | POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。 |\n@@| PUT | - | PUT方法用有效载荷请求替换目标资源的所有当前表示。 |\n@@| PATCH | - | PATCH方法用于对资源应用部分修改。 |\n@@| DELETE | - | DELETE方法删除指定的资源。 |\n@@| HEAD | - | HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。 |\n@@| OPTIONS | - | OPTIONS 方法用于描述目标资源的通信选项。 |\n@| timeout | number | 否 | 60000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 超时时间,单位 ms |\n@| withCredentials | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 跨域请求时是否携带凭证(cookies)<br/> |\n@| success | (option: [RequestSuccess\\<T>](#requestsuccess-values)) => void | 否 | null | - | 网络请求成功回调。 |\n@| fail | (option: [RequestFail](#requestfail-values)) => void | 否 | null | - | 网络请求失败回调。 |\n@| complete | (option: any) => void | 否 | null | - | 网络请求完成回调,成功或者失败都会调用。 | \n\n#### RequestSuccess\\<T> 的属性值 @requestsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | T | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的数据 |\n| statusCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的 HTTP 状态码 |\n| header | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的 HTTP Response Header |\n| cookies | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的 cookies,格式为字符串数组 |\n\n#### RequestFail 的属性值 @requestfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 5 | - | 接口超时 |\n@| 1000 | - | 服务端系统错误 |\n@| 100001 | - | json数据解析错误 |\n@| 100002 | - | 错误信息json解析失败 |\n@| 600003 | - | 网络中断 |\n@| 600008 | - | data参数类型不合法 |\n@| 600009 | - | URL格式不合法 |\n@| 602001 | - | request系统错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [RequestTask](#requesttask-values) |\n\n#### RequestTask 的方法 @requesttask-values \n\n#### abort(): void @abort\n中断网络请求。\n##### abort 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.request)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/request.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=request&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=request&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=request&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=request&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=request&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=request)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=request&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/request/request\n\n>Template\n```vue\n<template>\r\n  <view style=\"flex: 1;\">\r\n    <view class=\"uni-padding-wrap uni-common-mt\">\r\n      <view class=\"uni-common-mt\" style=\"border-width: 2px;border-style: solid; border-radius: 4px;\">\r\n        <textarea :value=\"res\" class=\"uni-textarea\" style=\"width: 100%;\"></textarea>\r\n      </view>\r\n      <view>\r\n        <text>地址 : {{ host + url}}</text>\r\n        <text>请求方式 : {{method}}</text>\r\n      </view>\r\n      <view class=\"uni-btn-v uni-common-mt\">\r\n        <button type=\"primary\" @click=\"sendRequest\">发起请求</button>\r\n      </view>\r\n    </view>\r\n    <scroll-view style=\"flex: 1;\" show-scrollbar=\"true\">\r\n      <view style=\"padding: 20px;\">\r\n        <text>设置请求方式</text>\r\n        <view class=\"uni-common-pb\"></view>\r\n        <view style=\"flex-direction: row;flex-wrap: wrap;\">\r\n          <button style=\"padding: 5px; margin-right: 10px;\" type=\"primary\" size=\"mini\"\r\n            @click=\"changeMethod('GET')\">GET</button>\r\n          <button style=\"padding: 5px; margin-right: 10px; \" type=\"primary\" size=\"mini\"\r\n            @click=\"changeMethod('POST')\">POST</button>\r\n          <button style=\"padding: 5px; margin-right: 10px; \" type=\"primary\" size=\"mini\"\r\n            @click=\"changeMethod('PUT')\">PUT</button>\r\n          <button style=\"padding: 5px; margin-right: 10px;\" type=\"primary\" size=\"mini\"\r\n            @click=\"changeMethod('DELETE')\">DELETE</button>\r\n          <button style=\"padding: 5px; margin-right: 10px; \" type=\"primary\" size=\"mini\"\r\n            @click=\"changeMethod('PATCH')\">PATCH</button>\r\n          <button style=\"padding: 5px;margin-right: 10px;\" type=\"primary\" size=\"mini\"\r\n            @click=\"changeMethod('OPTIONS')\">OPTIONS</button>\r\n          <button style=\"padding: 5px;\" type=\"primary\" size=\"mini\" @click=\"changeMethod('HEAD')\">HEAD</button>\r\n        </view>\r\n      </view>\r\n      <view style=\"padding: 20px;\">\r\n        <text>请求返回错误码的接口(默认为GET)</text>\r\n        <view class=\"uni-common-pb\"></view>\r\n        <view style=\"flex-direction: row;flex-wrap: wrap;\">\r\n          <button style=\"padding: 5px;\" type=\"primary\" size=\"mini\" v-for=\"(item, index) in errorCodeUrls\" :key=\"index\"\r\n            @click=\"changeUrl(item)\">{{item}}</button>\r\n        </view>\r\n      </view>\r\n      <view style=\"padding: 20px;\">\r\n        <text>请求不同header的接口(默认为GET)</text>\r\n        <view class=\"uni-common-pb\"></view>\r\n        <view style=\"flex-direction: row;flex-wrap: wrap;\">\r\n          <button style=\"padding: 5px;\" type=\"primary\" size=\"mini\" v-for=\"(item, index) in headerUrls\" :key=\"index\"\r\n            @click=\"changeUrl(item)\">{{item}}</button>\r\n        </view>\r\n      </view>\r\n      <view style=\"padding: 20px;\">\r\n        <text>请求不同content-type的接口(默认为GET)</text>\r\n        <view class=\"uni-common-pb\"></view>\r\n        <view style=\"flex-direction: row;flex-wrap: wrap;\">\r\n          <button style=\"padding: 5px;\" type=\"primary\" size=\"mini\" v-for=\"(item, index) in contentTypeUrls\" :key=\"index\"\r\n            @click=\"changeUrl(item)\">{{item}}</button>\r\n        </view>\r\n      </view>\r\n\r\n      <view style=\"padding: 20px;\">\r\n        <text>POST请求(有body)</text>\r\n        <view class=\"uni-common-pb\"></view>\r\n        <view style=\"flex-direction: row;flex-wrap: wrap;\">\r\n          <button style=\"padding: 5px;\" type=\"primary\" size=\"mini\" v-for=\"(item, index) in postUrls\" :key=\"index\"\r\n            @click=\"changeUrlFromPost(item)\">{{item}}</button>\r\n        </view>\r\n      </view>\r\n    </scroll-view>\r\n  </view>\r\n</template>\r\n\r\n\n```\n\n>Script\n```uts\n\r\n  // #ifdef APP\r\n  import {\r\n    testInovkeRequest,\r\n    CommonOptions\r\n  } from '@/uni_modules/test-invoke-network-api'\r\n  // #endif\r\n\r\n  class GETDataType {\r\n    data : UTSJSONObject | null = null\r\n  }\r\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        jest_result_data: \"\"\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            this.task = null\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_set_cookie_expires() {\r\n        uni.request({\r\n          url: this.host + \"/api/http/header/setCookie?expires=5\",\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            this.jest_result_data = JSON.stringify(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: () => {\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_get_with_data() {\r\n        uni.request({\r\n          url: \"https://unidemo.dcloud.net.cn/api/banner/36kr\",\r\n          method: \"GET\",\r\n          data: {\r\n            column: 'id,post_id,title,author_name,cover,published_at' //需要的字段名\r\n          },\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_get_with_generics() {\r\n        uni.request<GETDataType>({\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: (res : RequestSuccess<GETDataType>) => {\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_get_array() {\r\n        uni.request<UTSJSONObject[]>({\r\n          url: 'https://unidemo.dcloud.net.cn/api/news?column=title,author_name,cover,published_at',\r\n          method: \"GET\",\r\n          success: (res : RequestSuccess<UTSJSONObject[]>) => {\r\n            if (res.statusCode == 200 && Array.isArray(res.data)) {\r\n              this.jest_result = true\r\n            } else {\r\n              this.jest_result = false\r\n            }\r\n          },\r\n          fail: () => {\r\n            this.jest_result = false\r\n          }\r\n        });\r\n      },\r\n      jest_uts_module_invoked() {\r\n        // #ifdef APP\r\n        testInovkeRequest({\r\n          success: (res : any) => {\r\n            this.jest_result = true\r\n          },\r\n          fail: (err : any) => {\r\n            this.jest_result = false\r\n          }\r\n        } as CommonOptions)\r\n        // #endif\r\n      },\r\n      jest_respone_json_string() {\r\n        uni.request({\r\n          url: \"https://request.dcloud.net.cn/api/http/contentType/text/json\",\r\n          success: (res : RequestSuccess<any>) => {\r\n            this.jest_result = typeof res.data == \"object\"\r\n          },\r\n          fail: (e : RequestFail) => {\r\n            this.jest_result = false\r\n          }\r\n        })\r\n      },\r\n      jest_respone_with_string_generics() {\r\n        uni.request<string>({\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: (res : RequestSuccess<string>) => {\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\n:::"},"uploadFile":{"name":"## uni.uploadFile(options) @uploadfile","description":"将本地资源上传到开发者服务器。","compatibility":"### uploadFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **UploadFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器 url |\n@| filePath | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 要上传文件资源的路径, 支持uni.env |\n@| name | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容 |\n@| files | Array\\<**UploadFileOptionFiles**\\> | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 需要上传的文件列表。 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| name | string | 否 | \"file\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。 |\n@@| uri | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 要上传文件资源的路径 |\n@@| file | any | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 要上传的文件对象 |\n@| header | UTSJSONObject | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | HTTP 请求 Header, header 中不能设置 Referer |\n@| formData | UTSJSONObject | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | HTTP 请求中其他额外的 form data |\n@| timeout | number | 否 | 120000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 超时时间,单位 ms |\n@| success | (result: [UploadFileSuccess](#uploadfilesuccess-values)) => void | 否 | null | - | 成功返回的回调函数 |\n@| fail | (result: [UploadFileFail](#uploadfilefail-values)) => void | 否 | null | - | 失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 结束的回调函数(调用成功、失败都会执行) | \n\n#### UploadFileSuccess 的属性值 @uploadfilesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的数据 |\n| statusCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的 HTTP 状态码 |\n\n#### UploadFileFail 的属性值 @uploadfilefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 5 | - | 接口超时 |\n@| 1000 | - | 服务端系统错误 |\n@| 100001 | - | json数据解析错误 |\n@| 100002 | - | 错误信息json解析失败 |\n@| 600003 | - | 网络中断 |\n@| 600008 | - | data参数类型不合法 |\n@| 600009 | - | URL格式不合法 |\n@| 602001 | - | request系统错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [UploadTask](#uploadtask-values) |\n\n#### UploadTask 的方法 @uploadtask-values \n\n#### abort(): void, @abort\n中断上传任务。\n##### abort 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n\n\n#### onProgressUpdate(callback: UploadFileProgressUpdateCallback): void, @onprogressupdate\n监听上传进度变化。\n##### onProgressUpdate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnProgressUpdateResult](#onprogressupdateresult-values)) => void | 是 | - | - | - | \n\n##### OnProgressUpdateResult 的属性值 @onprogressupdateresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| progress | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 上传进度百分比 |\n| totalBytesSent | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 已经上传的数据长度,单位 Bytes |\n| totalBytesExpectedToSend | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 预期需要上传的数据总长度,单位 Bytes |\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.uploadFile)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=uploadFile&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=uploadFile&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=uploadFile&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=uploadFile&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=uploadFile&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=uploadFile)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=uploadFile&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/upload-file/upload-file\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"demo\">\r\n          <image v-if=\"imageSrc\" :src=\"imageSrc\" class=\"image\" mode=\"widthFix\"></image>\r\n          <text v-else class=\"uni-hello-addfile\" @click=\"chooseImage\">+ 选择图片</text>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<style>\r\n  .image {\r\n    width: 100%;\r\n  }\r\n\r\n  .demo {\r\n    background: #fff;\r\n    padding: 25px;\r\n    justify-content: center;\r\n    align-items: center;\r\n  }\r\n\r\n  .uni-hello-addfile {\r\n    text-align: center;\r\n    background: #fff;\r\n    padding: 25px;\r\n    margin-top: 10px;\r\n    font-size: 19px;\r\n    color: #808080;\r\n  }\r\n</style>\r\n\n```\n\n>Script\n```uts\n\r\n  // #ifdef APP\r\n  import {\r\n    testInovkeUploadFile,\r\n    CommonOptions\r\n  } from '@/uni_modules/test-invoke-network-api'\r\n  // #endif\r\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.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.showModal({\r\n                  content: err.errMsg,\r\n                  showCancel: false\r\n                });\r\n              },\r\n              complete: (res) => {\r\n                uni.hideLoading();\r\n                this.task = null\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        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_uploadFile_with_uni_env() {\r\n        const filePath = `${uni.env.CACHE_PATH}/download/uni-app.png`\r\n        uni.downloadFile({\r\n          url: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png\",\r\n          filePath: filePath,\r\n          success: () => {\r\n            uni.uploadFile({\r\n              url: 'https://unidemo.dcloud.net.cn/upload', //仅为示例,非真实的接口地址\r\n              filePath: filePath,\r\n              name: 'file',\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          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        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        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      jest_uts_module_invoked() {\r\n        // #ifdef APP\r\n        testInovkeUploadFile({\r\n          success: (res : any) => {\r\n            this.jest_result = true\r\n          },\r\n          fail: (err : any) => {\r\n            this.jest_result = false\r\n          }\r\n        } as CommonOptions)\r\n        // #endif\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"downloadFile":{"name":"## uni.downloadFile(options) @downloadfile","description":"下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。","compatibility":"### downloadFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **DownloadFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 下载资源的 url |\n@| header | UTSJSONObject | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | HTTP 请求 Header,header 中不能设置 Referer |\n@| filePath | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定文件下载路径<br/>支持相对路径与绝对路径,例:<br/>`/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`<br/>并且支持指定下载目录,例:<br/>`/imgs/`<br/>支持uni.env的平台兼容性:Android自3.9开始支持uni.env,iOS自4.13开始支持uni.env |\n@| timeout | number | 否 | 120000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 超时时间,单位 ms |\n@| success | (result: [DownloadFileSuccess](#downloadfilesuccess-values)) => void | 否 | null | - | 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'} |\n@| fail | (result: [DownloadFileFail](#downloadfilefail-values)) => void | 否 | null | - | 失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 结束的回调函数(调用成功、失败都会执行) | \n\n#### DownloadFileSuccess 的属性值 @downloadfilesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 临时文件路径,下载后的文件会存储到一个临时文件 |\n| statusCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器返回的 HTTP 状态码 |\n\n#### DownloadFileFail 的属性值 @downloadfilefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 5 | - | 接口超时 |\n@| 1000 | - | 服务端系统错误 |\n@| 100001 | - | json数据解析错误 |\n@| 100002 | - | 错误信息json解析失败 |\n@| 600003 | - | 网络中断 |\n@| 600008 | - | data参数类型不合法 |\n@| 600009 | - | URL格式不合法 |\n@| 602001 | - | request系统错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [DownloadTask](#downloadtask-values) |\n\n#### DownloadTask 的方法 @downloadtask-values \n\n#### abort(): void, @abort\n中断下载任务\n##### abort 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n\n\n#### onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void, @onprogressupdate\n监听下载进度变化。\n##### onProgressUpdate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnProgressDownloadResult](#onprogressdownloadresult-values)) => void | 是 | - | - | - | \n\n##### OnProgressDownloadResult 的属性值 @onprogressdownloadresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| progress | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 下载进度百分比 |\n| totalBytesWritten | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 已经下载的数据长度,单位 Bytes |\n| totalBytesExpectedToWrite | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 预期需要下载的数据总长度,单位 Bytes |\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.downloadFile)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=downloadFile&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=downloadFile&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=downloadFile&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=downloadFile&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=downloadFile&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=downloadFile)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=downloadFile&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/download-file/download-file\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view>\r\n        <view v-if=\"imageSrc\">\r\n          <image class=\"img\" :src=\"imageSrc\" mode=\"aspectFit\" />\r\n        </view>\r\n        <view v-else style=\"margin: 10px;\">\r\n          <text class=\"uni-hello-text\">点击按钮下载服务端示例图片(下载网络文件到本地临时目录)</text>\r\n          <button type=\"primary\" @tap=\"downloadImage\">下载</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<style>\r\n  .img {\r\n    margin: 0 auto;\r\n  }\r\n</style>\r\n\n```\n\n>Script\n```uts\n\r\n  // #ifdef APP\r\n  import {\r\n    testInovkeDownloadFile,\r\n    CommonOptions\r\n  } from '@/uni_modules/test-invoke-network-api'\r\n  // #endif\r\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          },\r\n          fail: (err) => {\r\n            console.log('downloadFile fail, err is:', err)\r\n          },\r\n          complete: (res) => {\r\n            uni.hideLoading();\r\n            this.task = null;\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      },\r\n\r\n      jest_downloadFile_with_uni_env() {\r\n        uni.downloadFile({\r\n          url: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-app.png\",\r\n          filePath: `${uni.env.CACHE_PATH}/a/b/`,\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      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: true,\r\n          firstIpv4: false,\r\n          success: () => {\r\n            this.jest_cookie_download(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: true,\r\n          firstIpv4: false,\r\n          success: () => {\r\n            this.jest_cookie_download(false)\r\n          },\r\n          fail: () => {\r\n            this.jest_result = false;\r\n          },\r\n        });\r\n      },\r\n      jest_cookie_download(needCookie : boolean) {\r\n        uni.downloadFile({\r\n          url: \"https://request.dcloud.net.cn/api/http/header/download\",\r\n          success: () => {\r\n            this.jest_result = needCookie ? true : false;\r\n          },\r\n          fail: () => {\r\n            this.jest_result = needCookie ? false : true;\r\n          }\r\n        });\r\n      },\r\n      jest_uts_module_invoked() {\r\n        // #ifdef APP\r\n        testInovkeDownloadFile({\r\n          success: (res : any) => {\r\n            this.jest_result = true\r\n          },\r\n          fail: (err : any) => {\r\n            this.jest_result = false\r\n          }\r\n        } as CommonOptions)\r\n        // #endif\r\n      },\r\n      jest_special_characters_download() {\r\n        uni.downloadFile({\r\n          url: \"https://web-ext-storage.dcloud.net.cn/hello-uni-app-x/1789834995055525889-你好%23你好.png\",\r\n          success: (res : DownloadFileSuccess) => {\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\n:::"},"getNetworkType":{"name":"## uni.getNetworkType(options) @getnetworktype","description":"获取网络类型","compatibility":"### getNetworkType 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetNetworkTypeOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [GetNetworkTypeSuccess](#getnetworktypesuccess-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#### GetNetworkTypeSuccess 的属性值 @getnetworktypesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| networkType | string | 是 | - | - | 网络类型 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.getNetworkType)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/network.html#getnetworktype)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getNetworkType&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getNetworkType&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getNetworkType&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getNetworkType&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getNetworkType&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getNetworkType)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getNetworkType&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-network-type/get-network-type\n\n>Template\n```vue\n<template>\r\n  <page-head :title=\"title\"></page-head>\r\n  <view class=\"uni-padding-wrap uni-common-mt\">\r\n    <view style=\"background:#FFFFFF; padding:20px;\">\r\n      <view class=\"uni-center\">网络状态</view>\r\n      <view v-if=\"hasNetworkType == false\">\r\n        <view class=\"uni-center uni-common-mt\">未获取</view>\r\n        <view class=\"uni-center uni-common-mt\">请点击下面按钮获取网络状态</view>\r\n      </view>\r\n      <view v-if=\"hasNetworkType == true\">\r\n        <view class=\"uni-center uni-common-mt\">{{networkType}}</view>\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-btn-v uni-common-mt\">\r\n      <button type=\"primary\" @tap=\"getNetworkType\">获取设备网络状态</button>\r\n      <button class=\"uni-common-mt\" @tap=\"clear\">清空</button>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n\r\n</style>\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\n:::"},"connectSocket":{"name":"## uni.connectSocket(options) @connectsocket","description":"创建一个 WebSocket 连接。","compatibility":"### connectSocket 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ConnectSocketOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| url | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 开发者服务器接口地址 |\n@| header | UTSJSONObject | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | HTTP 请求 Header,header 中不能设置 Referer |\n@| protocols | Array\\<string\\> | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 子协议数组 |\n@| success | (result: [ConnectSocketSuccess](#connectsocketsuccess-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: [ConnectSocketFail](#connectsocketfail-values)) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### ConnectSocketSuccess 的属性值 @connectsocketsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n\n#### ConnectSocketFail 的属性值 @connectsocketfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码<br/>- 600009 URL格式不合法 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [SocketTask](#sockettask-values) |\n\n#### SocketTask 的方法 @sockettask-values \n\n#### send(options: SendSocketMessageOptions): void; @send\n通过 WebSocket 连接发送数据\n##### send 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SendSocketMessageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| data | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 需要发送的内容 |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: [SendSocketMessageFail](#sendsocketmessagefail-values)) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### SendSocketMessageFail 的属性值 @sendsocketmessagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 10001 | - | 发送数据超限,发送队列不能超过16M大小。 |\n@| 10002 | - | websocket未连接 |\n@| 602001 | - | websocket系统错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### close(options: CloseSocketOptions): void; @close\n关闭 WebSocket 连接\n##### close 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CloseSocketOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| code | number | 否 | 1000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |\n@| reason | string | 否 | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### onOpen(callback: (result: OnSocketOpenCallbackResult) => void): void; @onopen\n监听 WebSocket 连接打开事件\n##### onOpen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnSocketOpenCallbackResult](#onsocketopencallbackresult-values)) => void | 是 | - | - | - | \n\n##### OnSocketOpenCallbackResult 的属性值 @onsocketopencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| header | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 连接成功的 HTTP 响应 Header |\n\n\n#### onClose(callback: (result: any) => void): void; @onclose\n监听 WebSocket 连接关闭事件\n##### onClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### onError(callback: (result: GeneralCallbackResult) => void): void; @onerror\n监听 WebSocket 错误\n##### onError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 是 | - | - | - | \n\n\n#### onMessage(callback: (result: OnSocketMessageCallbackResult) => void): void; @onmessage\n监听 WebSocket 接受到服务器的消息事件\n##### onMessage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnSocketMessageCallbackResult](#onsocketmessagecallbackresult-values)) => void | 是 | - | - | - | \n\n##### OnSocketMessageCallbackResult 的属性值 @onsocketmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 服务器返回的消息 |\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.connectSocket)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=connectSocket&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=connectSocket&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=connectSocket&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=connectSocket&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=connectSocket&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=connectSocket)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=connectSocket&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onSocketOpen":{"name":"## uni.onSocketOpen(options) @onsocketopen","description":"监听WebSocket连接打开事件。","compatibility":"### onSocketOpen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | (result: [OnSocketOpenCallbackResult](#onsocketopencallbackresult-values)) => void | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.onSocketOpen)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onSocketOpen&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onSocketOpen&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onSocketOpen&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onSocketOpen&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onSocketOpen&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onSocketOpen)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onSocketOpen&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onSocketError":{"name":"## uni.onSocketError(callback) @onsocketerror","description":"监听WebSocket错误。","compatibility":"### onSocketError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnSocketErrorCallbackResult](#onsocketerrorcallbackresult-values)) => void | 是 | - | - | - | \n\n### OnSocketErrorCallbackResult 的属性值 @onsocketerrorcallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | 错误信息 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.onSocketError)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onSocketError&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onSocketError&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onSocketError&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onSocketError&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onSocketError&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onSocketError)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onSocketError&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"sendSocketMessage":{"name":"## uni.sendSocketMessage(options) @sendsocketmessage","description":"通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。","compatibility":"### sendSocketMessage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SendSocketMessageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| data | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 需要发送的内容 |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: [SendSocketMessageFail](#sendsocketmessagefail-values)) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### SendSocketMessageFail 的属性值 @sendsocketmessagefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 10001 | - | 发送数据超限,发送队列不能超过16M大小。 |\n@| 10002 | - | websocket未连接 |\n@| 602001 | - | websocket系统错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.sendSocketMessage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=sendSocketMessage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=sendSocketMessage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=sendSocketMessage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=sendSocketMessage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=sendSocketMessage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=sendSocketMessage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=sendSocketMessage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onSocketMessage":{"name":"## uni.onSocketMessage(callback) @onsocketmessage","description":"监听WebSocket接受到服务器的消息事件。","compatibility":"### onSocketMessage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnSocketMessageCallbackResult](#onsocketmessagecallbackresult-values)) => void | 是 | - | - | - | \n\n### OnSocketMessageCallbackResult 的属性值 @onsocketmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | any | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 服务器返回的消息 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.onSocketMessage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onSocketMessage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onSocketMessage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onSocketMessage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onSocketMessage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onSocketMessage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onSocketMessage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onSocketMessage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"closeSocket":{"name":"## uni.closeSocket(options) @closesocket","description":"关闭 WebSocket 连接。","compatibility":"### closeSocket 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CloseSocketOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| code | number | 否 | 1000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭) |\n@| reason | string | 否 | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符) |\n@| success | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: [GeneralCallbackResult](#generalcallbackresult-values)) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.closeSocket)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=closeSocket&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=closeSocket&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=closeSocket&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=closeSocket&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=closeSocket&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=closeSocket)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=closeSocket&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onSocketClose":{"name":"## uni.onSocketClose(callback) @onsocketclose","description":"监听WebSocket关闭。","compatibility":"### onSocketClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnSocketCloseCallbackResult](#onsocketclosecallbackresult-values)) => void | 是 | - | - | - | \n\n### OnSocketCloseCallbackResult 的属性值 @onsocketclosecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| code | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 |\n| reason | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 一个可读的字符串,表示连接被关闭的原因。 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.network.websocket.onSocketClose)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onSocketClose&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onSocketClose&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onSocketClose&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onSocketClose&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onSocketClose&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onSocketClose)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onSocketClose&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"websocket":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/websocket/websocket.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/websocket/websocket\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/websocket/websocket\n\n>Template\n```vue\n<template>\r\n  <page-head title=\"websocket通讯示例\"></page-head>\r\n  <view class=\"uni-padding-wrap\">\r\n    <view class=\"uni-btn-v\">\r\n      <text class=\"websocket-msg\">{{ showMsg }}</text>\r\n      <button class=\"uni-btn-v\" type=\"primary\" @click=\"connect\">\r\n        连接websocket服务\r\n      </button>\r\n      <button class=\"uni-btn-v\" v-show=\"connected\" type=\"primary\" @click=\"send\">\r\n        发送一条消息\r\n      </button>\r\n      <button class=\"uni-btn-v\" type=\"primary\" @click=\"close\">\r\n        断开websocket服务\r\n      </button>\r\n      <text class=\"websocket-tips\">发送消息后会收到一条服务器返回的消息(与发送的消息内容一致)</text>\r\n      <button class=\"uni-btn-v\" type=\"primary\" @click=\"goSocketTask\">\r\n        跳转 socketTask 示例\r\n      </button>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .uni-btn-v {\r\n    padding: 5px 0;\r\n  }\r\n\r\n  .uni-btn-v {\r\n    margin: 10px 0;\r\n  }\r\n\r\n  .websocket-msg {\r\n    padding: 40px 0px;\r\n    text-align: center;\r\n    font-size: 14px;\r\n    line-height: 40px;\r\n    color: #666666;\r\n  }\r\n\r\n  .websocket-tips {\r\n    padding: 40px 0px;\r\n    text-align: center;\r\n    font-size: 14px;\r\n    line-height: 24px;\r\n    color: #666666;\r\n  }\r\n</style>\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      goSocketTask() {\r\n        uni.navigateTo({\r\n          url: '/pages/API/websocket/socketTask',\r\n        })\r\n      }\r\n    },\r\n  }\r\n\n```\n\n:::"},"getSystemInfo":{"name":"## uni.getSystemInfo(options) @getsysteminfo","description":"异步获取系统信息","compatibility":"### getSystemInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetSystemInfoOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [GetSystemInfoResult](#getsysteminforesult-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#### GetSystemInfoResult 的属性值 @getsysteminforesult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| SDKVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 客户端基础库版本<br/> |\n| appId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用appid。<br/> |\n| appLanguage | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 应用设置的语言。<br/> |\n| appName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用名称。<br/> |\n| appVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用版本名称。<br/> |\n| appVersionCode | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用版本名号。<br/> |\n| browserName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空<br/> |\n| browserVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 浏览器版本、webview 版本。<br/> |\n| deviceId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备 ID<br/> |\n| deviceBrand | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备品牌。如:`apple`、`huawei`。<br/> |\n| deviceModel | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备型号<br/> |\n| deviceType | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备类型。<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| phone | - | - |\n@| pad | - | - |\n@| tv | - | - |\n@| watch | - | - |\n@| pc | - | - |\n@| undefined | - | - |\n@| car | - | - |\n@| vr | - | - |\n@| appliance | - | - |\n| devicePixelRatio | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备像素比<br/> |\n| deviceOrientation | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备方向。<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| portrait | - | 纵向 |\n@| landscape | - | 横向 |\n| osName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 系统名称<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| ios | - | - |\n@| android | - | - |\n@| harmonyos | - | - |\n@| macos | - | - |\n@| windows | - | - |\n@| linux | - | - |\n| osVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统版本。如 ios 版本,andriod 版本<br/> |\n| osLanguage | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统语言<br/> |\n| osTheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"√\",\"4.11\"]]}' /> | 操作系统主题<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| light | - | - |\n@| dark | - | - |\n| screenWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 屏幕宽度,单位为px<br/> |\n| screenHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 屏幕高度,单位为px<br/> |\n| statusBarHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 状态栏的高度,单位为px<br/> |\n| safeArea | **SafeArea** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在竖屏正方向下的安全区域<br/> |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左上角横坐标,单位为px<br/> |\n@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右下角横坐标,单位为px<br/> |\n@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左上角纵坐标,单位为px<br/> |\n@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右下角纵坐标,单位为px<br/> |\n@| width | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域的宽度,单位为px<br/> |\n@| height | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域的高度,单位为px<br/> |\n| safeAreaInsets | **SafeAreaInsets** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在竖屏正方向下的安全区域插入位置<br/> |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左侧插入位置(距离左边边界距离),单位为px<br/> |\n@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右侧插入位置(距离右边边界距离),单位为px<br/> |\n@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区顶部插入位置(距离顶部边界距离),单位为px<br/> |\n@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域底部插入位置(距离底部边界距离),单位为px<br/> |\n| ua | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 用户标识。小程序端为空<br/> |\n| uniCompilerVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本。<br/> |\n| uniPlatform | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni-app 运行平台,与条件编译平台相同。<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| app | - | - |\n@| web | - | - |\n@| mp-weixin | - | - |\n@| mp-alipay | - | - |\n@| mp-baidu | - | - |\n@| mp-toutiao | - | - |\n@| mp-lark | - | - |\n@| mp-qq | - | - |\n@| mp-kuaishou | - | - |\n@| mp-jd | - | - |\n@| mp-360 | - | - |\n@| quickapp-webview | - | - |\n@| quickapp-webview-union | - | - |\n@| quickapp-webview-huawei | - | - |\n| uniRuntimeVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 运行时版本。<br/> |\n| uniCompilerVersionCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本号。<br/> |\n| uniRuntimeVersionCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 运行时版本号。<br/> |\n| romName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios`<br/> |\n| romVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | rom 版本号。Android 部分机型获取不到值。iOS 为操作系统版本号(同 `osVersion`)。<br/> |\n| windowWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 可使用窗口宽度,单位为px<br/> |\n| windowHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 可使用窗口高度,单位为px<br/> |\n| windowTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 内容区域距离顶部的距离(同CSS变量 `--window-top`),单位为px<br/> |\n| windowBottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 内容区域距离底部的距离(同CSS变量 `--window-bottom`),单位为px<br/> |\n| osAndroidAPILevel | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"√\",\"x\"]]}' /> | Android 系统API库的版本。<br/> |\n| appTheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 当前App的主题<br/> |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| light | - | - |\n@| dark | - | - |\n@| auto | - | - |\n| ~~version~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 引擎版本号。  **已废弃,仅为了向下兼容保留** |\n| ~~uniCompileVersionCode~~ | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本号。  **已废弃,仅为了向下兼容保留** |\n| ~~uniCompileVersion~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本。  **已废弃,仅为了向下兼容保留** |\n| ~~system~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统版本  **已废弃,仅为了向下兼容保留** |\n| ~~platform~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 客户端平台  **已废弃,仅为了向下兼容保留** |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| ios | - | - |\n@| android | - | - |\n@| harmonyos | - | - |\n@| mac | - | - |\n@| windows | - | - |\n@| linux | - | - |\n| ~~pixelRatio~~ | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备像素比  **已废弃,仅为了向下兼容保留** |\n| ~~model~~ | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 手机型号  **已废弃,仅为了向下兼容保留** |\n| ~~language~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 程序设置的语言  **已废弃,仅为了向下兼容保留** |\n| ~~brand~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 手机品牌。  **已废弃,仅为了向下兼容保留** |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getSystemInfo.getSystemInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/info.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getSystemInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getSystemInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getSystemInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getSystemInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getSystemInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getSystemInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getSystemInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-system-info/get-system-info\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-common-mt\">\r\n        <view class=\"uni-list\">\r\n          <view class=\"uni-list-cell\" v-for=\"(item, _) in items\" style=\"align-items: center\">\r\n            <view class=\"uni-pd\">\r\n              <view class=\"uni-label\" style=\"width: 180px\">{{\r\n                item.label\r\n              }}</view>\r\n            </view>\r\n            <view class=\"uni-list-cell-db\">\r\n              <text style=\"width: 100%;\">{{ item.value == '' ? '未获取' : item.value }}</text>\r\n            </view>\r\n          </view>\r\n        </view>\r\n        <view class=\"uni-padding-wrap\">\r\n          <view class=\"uni-btn-v\">\r\n            <button type=\"primary\" @tap=\"getSystemInfoSync\">\r\n              同步获取设备系统信息\r\n            </button>\r\n            <button type=\"primary\" @tap=\"getSystemInfo\" style=\"margin-top: 20px;\">\r\n              异步获取设备系统信息\r\n            </button>\r\n          </view>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<style>\r\n  .uni-pd {\r\n    padding-left: 15px;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  type Item = {\r\n    label : string,\r\n    value : string,\r\n  }\r\n\r\n  let globalScreenHeight = 0\r\n  try {\r\n    globalScreenHeight = uni.getSystemInfoSync().screenHeight\r\n  } catch (e) {\r\n    // 兼容本地测试\r\n    console.error(e)\r\n  }\r\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'getSystemInfo',\r\n        items: [] as Item[],\r\n        screenHeightAtReady: 0,\r\n        jest_result: false,\r\n      }\r\n    },\r\n    onUnload: function () {\r\n    },\r\n    onReady() {\r\n      this.screenHeightAtReady = uni.getSystemInfoSync().screenHeight\r\n      console.log(`全局获取屏幕高度: ${globalScreenHeight}  onReady内获取屏幕高度: ${this.screenHeightAtReady}`);\r\n    },\r\n    methods: {\r\n      getSystemInfo: function () {\r\n        uni.getSystemInfo({\r\n          success: (res) => {\r\n            this.items = [] as Item[];\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      },\r\n      getSystemInfoSync: function () {\r\n        this.items = [] as Item[];\r\n        const res = uni.getSystemInfoSync()\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_getSystemInfo() : GetSystemInfoResult {\r\n        return uni.getSystemInfoSync();\r\n      },\r\n      jest_getScreenHeight_at_different_stages() {\r\n        this.jest_result = (globalScreenHeight == this.screenHeightAtReady)\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"getSystemInfoSync":{"name":"## uni.getSystemInfoSync() @getsysteminfosync","description":"同步获取系统信息","compatibility":"### getSystemInfoSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetSystemInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SDKVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 客户端基础库版本<br/> |\n@| appId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用appid。<br/> |\n@| appLanguage | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 应用设置的语言。<br/> |\n@| appName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用名称。<br/> |\n@| appVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用版本名称。<br/> |\n@| appVersionCode | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用版本名号。<br/> |\n@| browserName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空<br/> |\n@| browserVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 浏览器版本、webview 版本。<br/> |\n@| deviceId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备 ID<br/> |\n@| deviceBrand | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备品牌。如:`apple`、`huawei`。<br/> |\n@| deviceModel | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备型号<br/> |\n@| deviceType | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备类型。<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| phone | - | - |\n@@| pad | - | - |\n@@| tv | - | - |\n@@| watch | - | - |\n@@| pc | - | - |\n@@| null | - | - |\n@@| car | - | - |\n@@| vr | - | - |\n@@| appliance | - | - |\n@| devicePixelRatio | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备像素比<br/> |\n@| deviceOrientation | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备方向。<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| portrait | - | 纵向 |\n@@| landscape | - | 横向 |\n@| osName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 系统名称<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ios | - | - |\n@@| android | - | - |\n@@| harmonyos | - | - |\n@@| macos | - | - |\n@@| windows | - | - |\n@@| linux | - | - |\n@| osVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统版本。如 ios 版本,andriod 版本<br/> |\n@| osLanguage | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统语言<br/> |\n@| osTheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"√\",\"4.11\"]]}' /> | 操作系统主题<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| light | - | - |\n@@| dark | - | - |\n@| screenWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 屏幕宽度,单位为px<br/> |\n@| screenHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 屏幕高度,单位为px<br/> |\n@| statusBarHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 状态栏的高度,单位为px<br/> |\n@| safeArea | **SafeArea** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在竖屏正方向下的安全区域<br/> |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左上角横坐标,单位为px<br/> |\n@@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右下角横坐标,单位为px<br/> |\n@@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左上角纵坐标,单位为px<br/> |\n@@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右下角纵坐标,单位为px<br/> |\n@@| width | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域的宽度,单位为px<br/> |\n@@| height | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域的高度,单位为px<br/> |\n@| safeAreaInsets | **SafeAreaInsets** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在竖屏正方向下的安全区域插入位置<br/> |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左侧插入位置(距离左边边界距离),单位为px<br/> |\n@@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右侧插入位置(距离右边边界距离),单位为px<br/> |\n@@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区顶部插入位置(距离顶部边界距离),单位为px<br/> |\n@@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域底部插入位置(距离底部边界距离),单位为px<br/> |\n@| ua | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 用户标识。小程序端为空<br/> |\n@| uniCompilerVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本。<br/> |\n@| uniPlatform | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni-app 运行平台,与条件编译平台相同。<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| app | - | - |\n@@| web | - | - |\n@@| mp-weixin | - | - |\n@@| mp-alipay | - | - |\n@@| mp-baidu | - | - |\n@@| mp-toutiao | - | - |\n@@| mp-lark | - | - |\n@@| mp-qq | - | - |\n@@| mp-kuaishou | - | - |\n@@| mp-jd | - | - |\n@@| mp-360 | - | - |\n@@| quickapp-webview | - | - |\n@@| quickapp-webview-union | - | - |\n@@| quickapp-webview-huawei | - | - |\n@| uniRuntimeVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 运行时版本。<br/> |\n@| uniCompilerVersionCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本号。<br/> |\n@| uniRuntimeVersionCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 运行时版本号。<br/> |\n@| romName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios`<br/> |\n@| romVersion | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | rom 版本号。Android 部分机型获取不到值。iOS 为操作系统版本号(同 `osVersion`)。<br/> |\n@| windowWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 可使用窗口宽度,单位为px<br/> |\n@| windowHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 可使用窗口高度,单位为px<br/> |\n@| windowTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 内容区域距离顶部的距离(同CSS变量 `--window-top`),单位为px<br/> |\n@| windowBottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 内容区域距离底部的距离(同CSS变量 `--window-bottom`),单位为px<br/> |\n@| osAndroidAPILevel | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"√\",\"x\"]]}' /> | Android 系统API库的版本。<br/> |\n@| appTheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 当前App的主题<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| light | - | - |\n@@| dark | - | - |\n@@| auto | - | - |\n@| ~~version~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 引擎版本号。  **已废弃,仅为了向下兼容保留** |\n@| ~~uniCompileVersionCode~~ | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本号。  **已废弃,仅为了向下兼容保留** |\n@| ~~uniCompileVersion~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本。  **已废弃,仅为了向下兼容保留** |\n@| ~~system~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统版本  **已废弃,仅为了向下兼容保留** |\n@| ~~platform~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 客户端平台  **已废弃,仅为了向下兼容保留** |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ios | - | - |\n@@| android | - | - |\n@@| harmonyos | - | - |\n@@| mac | - | - |\n@@| windows | - | - |\n@@| linux | - | - |\n@| ~~pixelRatio~~ | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备像素比  **已废弃,仅为了向下兼容保留** |\n@| ~~model~~ | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 手机型号  **已废弃,仅为了向下兼容保留** |\n@| ~~language~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 程序设置的语言  **已废弃,仅为了向下兼容保留** |\n@| ~~brand~~ | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 手机品牌。  **已废弃,仅为了向下兼容保留** | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getSystemInfo.getSystemInfoSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/info.html#getsysteminfosync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getSystemInfoSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getSystemInfoSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getSystemInfoSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getSystemInfoSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getSystemInfoSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getSystemInfoSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getSystemInfoSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getDeviceInfo":{"name":"## uni.getDeviceInfo(options?) @getdeviceinfo","description":"获取设备信息","compatibility":"### getDeviceInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetDeviceInfoOptions** | 否 | 包含所有字段的过滤对象 | - | \\[options=包含所有字段的过滤对象]过滤的字段对象, 不传参数默认为获取全部字段。 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filter | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"-\"]]}' /> | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetDeviceInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| deviceBrand | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设备品牌<br/> |\n@| deviceId | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变<br/> |\n@| deviceModel | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备型号<br/> |\n@| deviceType | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备类型phone、pad、pc<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| phone | - | - |\n@@| pad | - | - |\n@@| tv | - | - |\n@@| watch | - | - |\n@@| pc | - | - |\n@@| null | - | - |\n@@| car | - | - |\n@@| vr | - | - |\n@@| appliance | - | - |\n@| deviceOrientation | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备方向 竖屏 portrait、横屏 landscape<br/> |\n@| devicePixelRatio | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备像素比<br/> |\n@| system | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 操作系统及版本<br/> |\n@| platform | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 客户端平台<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ios | - | - |\n@@| android | - | - |\n@@| harmonyos | - | - |\n@@| mac | - | - |\n@@| windows | - | - |\n@@| linux | - | - |\n@| isRoot | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 是否root。iOS 为是否越狱<br/> |\n@| isSimulator | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 是否是模拟器<br/> |\n@| isUSBDebugging | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"√\",\"x\"]]}' /> | adb是否开启<br/> |\n@| osName | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | 系统名称<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ios | - | - |\n@@| android | - | - |\n@@| harmonyos | - | - |\n@@| macos | - | - |\n@@| windows | - | - |\n@@| linux | - | - |\n@| osVersion | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | 操作系统版本。如 ios 版本,andriod 版本<br/> |\n@| osLanguage | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 操作系统语言<br/> |\n@| osTheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 操作系统主题<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| light | - | - |\n@@| dark | - | - |\n@| osAndroidAPILevel | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"x\"]]}' /> | Android 系统API库的版本。<br/> |\n@| romName | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios`<br/> |\n@| romVersion | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | rom 版本号。Android 部分机型获取不到值。iOS 为操作系统版本号(同 `osVersion`)。<br/> |\n@| ~~model~~ | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备型号  **已废弃,仅为了向下兼容保留** |\n@| ~~brand~~ | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设备品牌  **已废弃,仅为了向下兼容保留** | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getDeviceInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getDeviceInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getDeviceInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getDeviceInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getDeviceInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getDeviceInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getDeviceInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getDeviceInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-device-info/get-device-info\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-common-mt\">\r\n        <view class=\"uni-list\">\r\n          <view class=\"uni-list\">\r\n            <view class=\"uni-list-cell\" v-for=\"(item, _) in items\" style=\"align-items: center\">\r\n              <view class=\"uni-pd\">\r\n                <view class=\"uni-label\" style=\"width: 180px\">{{\r\n                  item.label\r\n                }}</view>\r\n              </view>\r\n              <view class=\"uni-list-cell-db\">\r\n                <text style=\"width: 100%\">{{\r\n                  item.value == \"\" ? \"未获取\" : item.value\r\n                }}</text>\r\n              </view>\r\n            </view>\r\n          </view>\r\n        </view>\r\n        <view class=\"uni-padding-wrap\">\r\n          <view class=\"uni-btn-v\">\r\n            <button type=\"primary\" @tap=\"getDeviceInfo\">获取设备信息</button>\r\n          </view>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<style>\r\n  .uni-pd {\r\n    padding-left: 15px;\r\n  }\r\n</style>\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 ? res.devicePixelRatio! : 1)\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  }\r\n\n```\n\n:::"},"getWindowInfo":{"name":"## uni.getWindowInfo() @getwindowinfo","description":"同步获取窗口信息","compatibility":"### getWindowInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 | 描述 |\n| :- | :- |\n| **GetWindowInfoResult** | result |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| pixelRatio | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设备像素比<br/> |\n@| screenWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 屏幕宽度,单位为px<br/> |\n@| screenHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 屏幕高度,单位为px<br/> |\n@| windowWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 可使用窗口宽度,单位为px<br/> |\n@| windowHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 可使用窗口高度,单位为px<br/> |\n@| statusBarHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 状态栏的高度,单位为px<br/> |\n@| windowTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 内容区域距离顶部的距离(同CSS变量 `--window-top`),单位为px<br/> |\n@| windowBottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 内容区域距离底部的距离(同CSS变量 `--window-bottom`),单位为px<br/> |\n@| safeArea | **SafeArea** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域在屏幕中的位置信息<br/> |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左上角横坐标,单位为px<br/> |\n@@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右下角横坐标,单位为px<br/> |\n@@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左上角纵坐标,单位为px<br/> |\n@@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右下角纵坐标,单位为px<br/> |\n@@| width | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域的宽度,单位为px<br/> |\n@@| height | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域的高度,单位为px<br/> |\n@| safeAreaInsets | **SafeAreaInsets** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域插入位置(与屏幕边界的距离)信息<br/> |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域左侧插入位置(距离左边边界距离),单位为px<br/> |\n@@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域右侧插入位置(距离右边边界距离),单位为px<br/> |\n@@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区顶部插入位置(距离顶部边界距离),单位为px<br/> |\n@@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 安全区域底部插入位置(距离底部边界距离),单位为px<br/> |\n@| cutoutArea | Array\\<**CutoutRect**\\> | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android 系统版本\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"9.0\",\"4.31\",\"x\"]]}' /> | 挖孔、刘海区域在屏幕中的位置信息<br/> |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| left | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android 系统版本\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"9.0\",\"4.31\",\"x\"]]}' /> | 挖孔、刘海区域左上角横坐标,单位为px<br/> |\n@@| right | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android 系统版本\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"9.0\",\"4.31\",\"x\"]]}' /> | 挖孔、刘海区域右下角横坐标,单位为px<br/> |\n@@| top | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android 系统版本\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"9.0\",\"4.31\",\"x\"]]}' /> | 挖孔、刘海区域左上角纵坐标,单位为px<br/> |\n@@| bottom | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android 系统版本\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"9.0\",\"4.31\",\"x\"]]}' /> | 挖孔、刘海区域右下角纵坐标,单位为px<br/> |\n@| ~~screenTop~~ | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 窗口上边缘的 y 值,单位为px<br/>  **已废弃,仅为了向下兼容保留** | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getWindowInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/getWindowInfo.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getWindowInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getWindowInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getWindowInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getWindowInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getWindowInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getWindowInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getWindowInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-window-info/get-window-info\n\n>Template\n```vue\n<template>\r\n  <page-head :title=\"title\"></page-head>\r\n  <view class=\"uni-common-mt\">\r\n    <view class=\"uni-list\">\r\n      <view class=\"uni-list-cell\" v-for=\"(item, _) in items\" style=\"align-items: center\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width: 180px\">{{ item.label }}</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <text style=\"width: 100%;\">{{ item.value == '' ? '未获取' : item.value }}</text>\r\n        </view>\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @tap=\"getWindowInfo\">获取窗口信息</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n  .uni-pd {\r\n    padding-left: 15px;\r\n  }\r\n</style>\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\n:::"},"getAppBaseInfo":{"name":"## uni.getAppBaseInfo(options?) @getappbaseinfo","description":"获取app基本信息","compatibility":"### getAppBaseInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetAppBaseInfoOptions** | 否 | 包含所有字段的过滤对象 | - | \\[options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filter | Array\\<string\\> | 是 | - | - | 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetAppBaseInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| appId | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | manifest.json 中应用appid,即DCloud appid。<br/> |\n@| appName | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用名称。<br/> |\n@| appVersion | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用版本名称。<br/> |\n@| appVersionCode | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | `manifest.json` 中应用版本名号。<br/> |\n@| appLanguage | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 应用设置的语言en、zh-Hans、zh-Hant、fr、es<br/> |\n@| language | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 应用设置的语言<br/> |\n@| isUniAppX | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"3.9\",\"4.11\"]]}' /> | 是否uni-app x<br/> |\n@| uniCompilerVersion | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.0\",\"4.11\"]]}' /> | uni 编译器版本<br/> |\n@| uniPlatform | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | uni-app 运行平台。<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| app | - | - |\n@@| web | - | - |\n@@| mp-weixin | - | - |\n@@| mp-alipay | - | - |\n@@| mp-baidu | - | - |\n@@| mp-toutiao | - | - |\n@@| mp-lark | - | - |\n@@| mp-qq | - | - |\n@@| mp-kuaishou | - | - |\n@@| mp-jd | - | - |\n@@| mp-360 | - | - |\n@@| quickapp-webview | - | - |\n@@| quickapp-webview-union | - | - |\n@@| quickapp-webview-huawei | - | - |\n@| uniRuntimeVersion | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"3.9\",\"4.11\"]]}' /> | uni 运行时版本<br/> |\n@| uniCompilerVersionCode | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.0\",\"4.11\"]]}' /> | uni 编译器版本号<br/> |\n@| uniRuntimeVersionCode | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | uni 运行时版本号<br/> |\n@| packageName | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.97\",\"x\"]]}' /> | Android的包名<br/> |\n@| bundleId | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.11\"]]}' /> | iOS的bundleId<br/> |\n@| signature | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.97\",\"4.11\"]]}' /> | Android: 应用签名证书的SHA1值(全部为小写,中间不包含“:”)。 为了保证应用的安全性,请使用自己生成的证书(不要使用公共测试证书)。<br/>iOS: 应用签名证书中绑定的Bundle ID(AppleID)的md5值(全部为小写)。<br/> |\n@| appTheme | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.18\",\"4.18\"]]}' /> | 当前App的主题<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| light | - | - |\n@@| dark | - | - |\n@@| auto | - | - |\n@| channel | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.28\",\"4.31\"]]}' /> | 当前应用分发的渠道<br/> |\n@| ~~uniCompileVersionCode~~ | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本号  **已废弃,仅为了向下兼容保留** |\n@| ~~uniCompileVersion~~ | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | uni 编译器版本  **已废弃,仅为了向下兼容保留** |\n@| ~~version~~ | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 引擎版本号。已废弃,仅为了向下兼容保留  **已废弃,仅为了向下兼容保留** | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getAppBaseInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/getAppBaseInfo.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getAppBaseInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getAppBaseInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getAppBaseInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getAppBaseInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getAppBaseInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getAppBaseInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getAppBaseInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-app-base-info/get-app-base-info\n\n>Template\n```vue\n<template>\r\n  <page-head :title=\"title\"></page-head>\r\n  <view class=\"uni-common-mt\">\r\n    <view class=\"uni-list\">\r\n      <view class=\"uni-list-cell\" v-for=\"(item,_) in items\" style=\"align-items: center;\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">{{item.label}}</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <text style=\"width: 100%;\">{{ item.value == '' ? '未获取' : item.value }}</text>\r\n        </view>\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @tap=\"getAppBaseInfo\">获取App基础信息</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n  .uni-pd {\r\n    padding-left: 15px;\r\n  }\r\n</style>\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: 'getAppBaseInfo',\r\n        items: [] as Item[],\r\n      }\r\n    },\r\n    onUnload: function () {\r\n    },\r\n    methods: {\r\n      getAppBaseInfo: function () {\r\n        const res = uni.getAppBaseInfo();\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\r\n        this.items = [] as Item[];\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    }\r\n  }\r\n\n```\n\n:::"},"getAppAuthorizeSetting":{"name":"## uni.getAppAuthorizeSetting() @getappauthorizesetting","description":"获取 APP 授权设置。","compatibility":"### getAppAuthorizeSetting 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetAppAuthorizeSettingResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| albumAuthorized | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.11\"]]}' /> | 允许 App 使用相册的开关<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | Android平台:表示没有配置[相册相关权限](https://doc.dcloud.net.cn/uni-app-x/native/permission/android_permission_adapter.html),[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:当前应用没有配置相册权限描述 |\n@| bluetoothAuthorized | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.11\"]]}' /> | 允许 App 使用蓝牙的开关<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | Android平台:表示没有配置[蓝牙相关权限](https://doc.dcloud.net.cn/uni-app-x/native/permission/android_permission_adapter.html),[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:当前应用没有配置蓝牙权限描述 |\n@| cameraAuthorized | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 允许 App 使用摄像头的开关<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | Android平台:表示没有配置 `android.permission.CAMERA` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:当前应用没有配置相机权限描述 |\n@| locationAuthorized | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 允许 App 使用定位的开关<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | Android平台:表示没有配置 `android.permission.ACCESS_COARSE_LOCATION` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:当前应用没有配置定位权限描述 |\n@| locationAccuracy | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 定位准确度。<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| reduced | - | 模糊定位 |\n@@| full | - | 精准定位 |\n@@| unsupported | - | 不支持(包括用户拒绝定位权限和没有包含定位权限描述) |\n@| locationReducedAccuracy | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"x\",\"4.11\"]]}' /> | 定位准确度(推荐使用 locationAccuracy 属性)。true 表示模糊定位,false 表示精确定位(仅 iOS 支持) |\n@| microphoneAuthorized | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 允许 App 使用麦克风的开关<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | Android平台:表示没有配置 `android.permission.RECORD_AUDIO` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:当前应用没有配置麦克风权限描述 |\n@| notificationAuthorized | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 允许 App 通知的开关<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | Android平台没有该值;iOS平台:没有包含推送权限描述 |\n@| notificationAlertAuthorized | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"x\",\"4.11\"]]}' /> | 允许 App 通知带有提醒的开关(仅 iOS 支持)<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | 当前应用没有配置推送权限描述 |\n@| notificationBadgeAuthorized | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"x\",\"4.11\"]]}' /> | 允许 App 通知带有标记的开关(仅 iOS 支持)<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | 当前应用没有配置推送权限描述 |\n@| notificationSoundAuthorized | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"x\",\"4.11\"]]}' /> | 允许 App 通知带有声音的开关(仅 iOS 支持)<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| authorized | - | 已经获得授权,无需再次请求授权 |\n@@| denied | - | 请求授权被拒绝,无法再次请求授权。Android平台:需要申请相册相关权限;iOS平台:此情况需要引导用户打开系统设置,在设置页中打开权限 |\n@@| not determined | - | 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) |\n@@| config error | - | 当前应用没有配置推送权限描述 | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getAppAuthorizeSetting)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/getappauthorizesetting.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getAppAuthorizeSetting&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getAppAuthorizeSetting&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getAppAuthorizeSetting&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getAppAuthorizeSetting&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getAppAuthorizeSetting&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getAppAuthorizeSetting)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getAppAuthorizeSetting&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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 >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-app-authorize-setting/get-app-authorize-setting\n```uvue\n<template>\r\n  <page-head :title=\"title\"></page-head>\r\n  <view class=\"uni-common-mt\">\r\n    <view class=\"uni-list\">\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否授权使用相册</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"albumAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否授权使用蓝牙</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"bluetoothAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否授权使用摄像头</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"cameraAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否授权使用定位</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"locationAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">定位准确度</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"locationAccuracy\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否授权使用麦克风</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"microphoneAuthorized\" />\r\n        </view>\r\n      </view>\r\n\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否授权通知</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"notificationAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <!-- #ifdef APP-IOS -->\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否允许通知带有提醒</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"notificationAlertAuthorized\" />\r\n        </view>\r\n      </view>\r\n\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否允许通知带有标记</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"notificationBadgeAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">是否允许通知带有声音</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"notificationSoundAuthorized\" />\r\n        </view>\r\n      </view>\r\n      <!-- #endif -->\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @tap=\"getAppAuthorizeSetting\">获取App授权设置</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'getAppAuthorizeSetting',\r\n        cameraAuthorized: \"\",\r\n        albumAuthorized: \"\",\r\n        locationAuthorized: \"\",\r\n        locationAccuracy: \"\",\r\n        microphoneAuthorized: \"\",\r\n        bluetoothAuthorized: \"\",\r\n        notificationAuthorized: \"\",\r\n        notificationAlertAuthorized: \"\",\r\n        notificationBadgeAuthorized: \"\",\r\n        notificationSoundAuthorized: \"\"\r\n      }\r\n    },\r\n    onUnload: function () {\r\n    },\r\n    methods: {\r\n      getAppAuthorizeSetting: function () {\r\n        const res = uni.getAppAuthorizeSetting();\r\n        this.albumAuthorized = res.albumAuthorized;\r\n        this.bluetoothAuthorized = res.bluetoothAuthorized;\r\n        this.cameraAuthorized = res.cameraAuthorized;\r\n        this.locationAuthorized = res.locationAuthorized;\r\n        this.locationAccuracy = res.locationAccuracy ?? \"unsupported\";\r\n        this.microphoneAuthorized = res.microphoneAuthorized;\r\n        this.notificationAuthorized = res.notificationAuthorized;\r\n        // #ifdef APP-IOS\r\n        this.notificationAlertAuthorized = res.notificationAlertAuthorized;\r\n        this.notificationBadgeAuthorized = res.notificationBadgeAuthorized;\r\n        this.notificationSoundAuthorized = res.notificationSoundAuthorized;\r\n        // #endif\r\n\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .uni-pd {\r\n    padding-left: 15px;\r\n  }\r\n</style>\n\n```\n:::"},"getSystemSetting":{"name":"## uni.getSystemSetting() @getsystemsetting","description":"获取系统设置","compatibility":"### getSystemSetting 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetSystemSettingResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| bluetoothEnabled | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 蓝牙是否开启<br/> |\n@| bluetoothError | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 蓝牙的报错信息<br/> |\n@| locationEnabled | boolean | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 位置是否开启<br/> |\n@| wifiEnabled | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | wifi是否开启<br/> |\n@| wifiError | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"x\"]]}' /> | wifi的报错信息<br/> |\n@| deviceOrientation | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 设备方向<br/> |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| portrait | - | 纵向 |\n@@| landscape | - | 横向 | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getSystemSetting)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/getsystemsetting.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getSystemSetting&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getSystemSetting&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getSystemSetting&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getSystemSetting&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getSystemSetting&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getSystemSetting)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getSystemSetting&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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 >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-system-setting/get-system-setting\n```uvue\n<template>\r\n  <page-head :title=\"title\"></page-head>\r\n  <view class=\"uni-common-mt\">\r\n    <view class=\"uni-list\">\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">蓝牙的系统开关</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"bluetoothEnabled\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">地理位置的系统开关</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"locationEnabled\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">Wi-Fi 的系统开关</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"wifiEnabled\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-list-cell\">\r\n        <view class=\"uni-pd\">\r\n          <view class=\"uni-label\" style=\"width:180px;\">设备方向</view>\r\n        </view>\r\n        <view class=\"uni-list-cell-db\">\r\n          <input type=\"text\" :disabled=\"true\" placeholder=\"未获取\" :value=\"deviceOrientation\" />\r\n        </view>\r\n      </view>\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @tap=\"getSystemSetting\">获取系统设置</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'getSystemSetting',\r\n        bluetoothEnabled: \"\",\r\n        locationEnabled: \"\",\r\n        wifiEnabled: \"\",\r\n        deviceOrientation: \"\"\r\n      }\r\n    },\r\n    onUnload: function () {\r\n    },\r\n    methods: {\r\n      getSystemSetting: function () {\r\n        const res = uni.getSystemSetting();\r\n        this.bluetoothEnabled = (res.bluetoothEnabled ?? false) ? \"开启\" : \"关闭\";\r\n        this.locationEnabled = res.locationEnabled ? \"开启\" : \"关闭\";\r\n        this.wifiEnabled = (res.wifiEnabled ?? false) ? \"开启\" : \"关闭\";\r\n        this.deviceOrientation = res.deviceOrientation\r\n\r\n        if (res.bluetoothError != null) {\r\n          this.bluetoothEnabled = \"无蓝牙权限\"\r\n        }\r\n\r\n        if (res.wifiError != null) {\r\n          this.wifiEnabled = \"无WiFi权限\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .uni-pd {\r\n    padding-left: 15px;\r\n  }\r\n</style>\n\n```\n:::"},"installApk":{"name":"## uni.installApk(options) @installapk","description":"安装apk","compatibility":"### installApk 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.94 | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **InstallApkOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | string | 是 | - | - | apk文件地址 |\n@| success | (res: [InstallApkSuccess](#installapksuccess-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (err: [InstallApkFail](#installapkfail-values)) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### InstallApkSuccess 的属性值 @installapksuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | 安装成功消息 |\n\n#### InstallApkFail 的属性值 @installapkfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码<br/>- 1300002 找不到文件 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.installApk)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/install-apk/install-apk.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/install-apk/install-apk\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-common-mt\">\r\n        <view class=\"uni-padding-wrap\">\r\n          <view class=\"uni-btn-v\">\r\n            <button type=\"primary\" @tap=\"installApk\">\r\n              installApk\r\n            </button>\r\n          </view>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'installApk'\r\n      }\r\n    },\r\n    onUnload: function () {\r\n    },\r\n    methods: {\r\n      installApk: function () {\r\n        uni.installApk({\r\n          filePath: \"/static/test-apk/test.apk\",\r\n          complete(res : any) {\r\n            console.log(res);\r\n          }\r\n        })\r\n      },\r\n    }\r\n  }\r\n</script>\r\n<style>\r\n</style>\n\n```\n:::"},"getBatteryInfo":{"name":"## uni.getBatteryInfo(options) @getbatteryinfo","description":"获取电池电量信息\n\n\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","compatibility":"### getBatteryInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetBatteryInfoOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [GetBatteryInfoSuccess](#getbatteryinfosuccess-values)) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#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":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getBatteryInfo.getBatteryInfo)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getBatteryInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getBatteryInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getBatteryInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getBatteryInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getBatteryInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getBatteryInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getBatteryInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-battery-info/get-battery-info\n\n>Template\n```vue\n<template>\r\n  <view>\r\n    <text>当前电量:{{level}}%</text>\r\n    <text>是否充电中:{{isCharging}}</text>\r\n  </view>\r\n</template>\r\n\r\n\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        level: 0,\r\n        isCharging: false\r\n      }\r\n    },\r\n    onLoad() {\r\n      try {\r\n        uni.getBatteryInfo({\r\n          success: res => {\r\n            this.level = res.level;\r\n            this.isCharging = res.isCharging;\r\n          }\r\n        });\r\n      } catch (e) {\r\n        console.error((e as Error).message);\r\n        uni.showModal({\r\n          content: (e as Error).message,\r\n          showCancel: false\r\n        });\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"getBatteryInfoSync":{"name":"## uni.getBatteryInfoSync() @getbatteryinfosync","description":"同步获取电池电量信息\n\n\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","compatibility":"### getBatteryInfoSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| **GetBatteryInfoResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| level | number | 是 | - | - | 设备电量,范围1 - 100 |\n@| isCharging | boolean | 是 | - | - | 是否正在充电中 | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.getBatteryInfo.getBatteryInfoSync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getBatteryInfoSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getBatteryInfoSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getBatteryInfoSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getBatteryInfoSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getBatteryInfoSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getBatteryInfoSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getBatteryInfoSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"makePhoneCall":{"name":"## uni.makePhoneCall(options) @makephonecall","description":"拨打电话\n","compatibility":"### makePhoneCall 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MakePhoneCallOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| phoneNumber | string | 是 | - | - | 需要拨打的电话号码 |\n@| success | (result: MakePhoneCallSuccess) => void | 否 | - | - | 成功返回的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | 失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | - | 结束的回调函数(调用成功、失败都会执行) | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.makePhoneCall)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/phone.html#makephonecall)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=makePhoneCall&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=makePhoneCall&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=makePhoneCall&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=makePhoneCall&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=makePhoneCall&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=makePhoneCall)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=makePhoneCall&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/make-phone-call/make-phone-call.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/make-phone-call/make-phone-call\n\n>Template\n```vue\n<template>\r\n  <view>\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap uni-common-mt\">\r\n      <view class=\"uni-hello-text uni-center\">请在下方输入电话号码</view>\r\n      <input class=\"input uni-common-mt\" type=\"number\" name=\"input\" @input=\"bindInput\" />\r\n      <view class=\"uni-btn-v uni-common-mt\">\r\n        <button @tap=\"makePhoneCall\" type=\"primary\" :disabled=\"disabled\">拨打</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n  .input {\r\n    height: 119rpx;\r\n    line-height: 119rpx;\r\n    font-size: 78rpx;\r\n    border-bottom: 1rpx solid #E2E2E2;\r\n    text-align: center;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'makePhoneCall',\r\n        disabled: true,\r\n        inputValue: ''\r\n      }\r\n    },\r\n    methods: {\r\n      bindInput: function (e : UniInputEvent) {\r\n        this.inputValue = e.detail.value\r\n        if (this.inputValue.length > 0) {\r\n          this.disabled = false\r\n        } else {\r\n          this.disabled = true\r\n        }\r\n      },\r\n      makePhoneCall: function () {\r\n        uni.makePhoneCall({\r\n          phoneNumber: this.inputValue,\r\n          success: () => {\r\n            console.log(\"成功拨打电话\")\r\n          }\r\n        })\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"getClipboardData":{"name":"## uni.getClipboardData(options) @getclipboarddata","description":"获得系统剪贴板的内容\n","compatibility":"### getClipboardData 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetClipboardDataOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [GetClipboardDataSuccess](#getclipboarddatasuccess-values)) => void | 否 | - | - | 成功返回的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | 失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | - | 结束的回调函数(调用成功、失败都会执行) | \n\n#### GetClipboardDataSuccess 的属性值 @getclipboarddatasuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | string | 是 | - | - | 剪贴板的内容 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.clipboard.getClipboardData)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/clipboard.html#getclipboarddata)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getClipboardData&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getClipboardData&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getClipboardData&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getClipboardData&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getClipboardData&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getClipboardData)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getClipboardData&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"setClipboardData":{"name":"## uni.setClipboardData(options) @setclipboarddata","description":"设置系统剪贴板的内容\n","compatibility":"### setClipboardData 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetClipboardDataOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| data | string | 是 | - | - | 需要设置的内容 |\n@| showToast | boolean | 否 | - | - | 是否弹出提示,默认弹出提示 |\n@| success | (result: SetClipboardDataSuccess) => void | 否 | - | - | 成功返回的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | 失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | - | 结束的回调函数(调用成功、失败都会执行) | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.clipboard.setClipboardData)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/clipboard.html#setclipboarddata)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setClipboardData&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setClipboardData&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setClipboardData&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setClipboardData&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setClipboardData&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setClipboardData)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setClipboardData&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"clipboard":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/clipboard/clipboard.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/clipboard/clipboard\n\n>Template\n```vue\n<template>\r\n  <view>\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-title\">请输入剪贴板内容</view>\r\n      <view class=\"uni-list\">\r\n        <view class=\"uni-list-cell\">\r\n          <input class=\"uni-input\" type=\"text\" placeholder=\"请输入剪贴板内容\" :value=\"data\" @input=\"dataChange\" />\r\n        </view>\r\n      </view>\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @click=\"setClipboard\">存储数据</button>\r\n        <button @tap=\"getClipboard\">读取数据</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'get/setClipboardData',\r\n        data: '',\r\n        // 自动化测试\r\n        getDataTest: '',\r\n        setClipboardTest: false\r\n      }\r\n    },\r\n    methods: {\r\n      dataChange: function (e) {\r\n        this.data = e.detail.value\r\n      },\r\n      getClipboard: function () {\r\n        uni.getClipboardData({\r\n          success: (res) => {\r\n            console.log(res.data);\r\n            this.getDataTest = res.data;\r\n            const content = res.data ? '剪贴板内容为:' + res.data : '剪贴板暂无内容';\r\n            uni.showModal({\r\n              content,\r\n              title: '读取剪贴板',\r\n              showCancel: false\r\n            })\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      setClipboard: function () {\r\n        if (this.data.length === 0) {\r\n          uni.showModal({\r\n            title: '设置剪贴板失败',\r\n            content: '内容不能为空',\r\n            showCancel: false\r\n          })\r\n        } else {\r\n          uni.setClipboardData({\r\n            data: this.data,\r\n            success: () => {\r\n              this.setClipboardTest = true\r\n              // 成功处理\r\n              uni.showToast({\r\n                title: '设置剪贴板成功',\r\n                icon: \"success\",\r\n                mask: !1\r\n              })\r\n            },\r\n            fail: () => {\r\n              // bug:自动化测试时设置成功也进入了fail\r\n              this.setClipboardTest = false\r\n              // 失败处理\r\n              uni.showToast({\r\n                title: '储存数据失败!',\r\n                icon: \"none\",\r\n                mask: !1\r\n              })\r\n            }\r\n          });\r\n        }\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"onCompassChange":{"name":"## uni.onCompassChange(callback) @oncompasschange","description":"监听罗盘数据\n","compatibility":"### onCompassChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnCompassChangeSuccess](#oncompasschangesuccess-values)) => void | 是 | - | - | - | \n\n### OnCompassChangeSuccess 的属性值 @oncompasschangesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| direction | number | 是 | - | - | 面对的方向度数 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.onCompassChange)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/system/compass.html#oncompasschange)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onCompassChange&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onCompassChange&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onCompassChange&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onCompassChange&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onCompassChange&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onCompassChange)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onCompassChange&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"offCompassChange":{"name":"## uni.offCompassChange(callback) @offcompasschange","description":"取消监听罗盘数据\n","compatibility":"### offCompassChange 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.offCompassChange)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/system/compass.html#offcompasschange)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=offCompassChange&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=offCompassChange&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=offCompassChange&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=offCompassChange&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=offCompassChange&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=offCompassChange)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=offCompassChange&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"startCompass":{"name":"## uni.startCompass(options?) @startcompass","description":"开始监听罗盘数据\n","compatibility":"### startCompass 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **StartCompassOptions** | 否 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: CompassSuccess) => void | 否 | - | - | uni.startCompass成功回调函数定义 |\n@| fail | (res: [ICompassError](#icompasserror-values)) => void | 否 | - | - | uni.startCompass失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.startCompass完成回调函数定义 | \n\n#### ICompassError 的属性值 @icompasserror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | - |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.startCompass)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/system/compass.html#startcompass)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=startCompass&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=startCompass&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=startCompass&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=startCompass&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=startCompass&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=startCompass)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=startCompass&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"stopCompass":{"name":"## uni.stopCompass(options?) @stopcompass","description":"停止监听罗盘数据\n","compatibility":"### stopCompass 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **StopCompassOptions** | 否 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: CompassSuccess) => void | 否 | - | - | 成功返回的回调函数 |\n@| fail | (res: [ICompassError](#icompasserror-values)) => void | 否 | - | - | 失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 结束的回调函数(调用成功、失败都会执行) | \n\n#### ICompassError 的属性值 @icompasserror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | - |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.stopCompass)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/system/compass.html#stopcompass)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=stopCompass&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=stopCompass&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=stopCompass&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=stopCompass&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=stopCompass&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=stopCompass)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=stopCompass&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"compass":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/compass/compass.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/compass/compass\n\n>Template\n```vue\n<template>\r\n  <view>\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-hello-text uni-center\" style=\"padding-bottom:50rpx;\">\r\n        旋转手机即可获取方位信息\r\n      </view>\r\n      <view class=\"direction\">\r\n        <view class=\"bg-compass-line\"></view>\r\n        <image class=\"bg-compass\" src=\"../../../static/compass.png\" :style=\"'transform: rotate('+direction+'deg)'\">\r\n        </image>\r\n        <view class=\"direction-value\">\r\n          <text>{{direction}}</text>\r\n          <text class=\"direction-degree\">o</text>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n\r\n<style>\r\n  .direction {\r\n    position: relative;\r\n    margin-top: 70rpx;\r\n    display: flex;\r\n    width: 540rpx;\r\n    height: 540rpx;\r\n    align-items: center;\r\n    justify-content: center;\r\n    margin: 0 auto;\r\n  }\r\n\r\n  .direction-value {\r\n    position: relative;\r\n    font-size: 200rpx;\r\n    color: #353535;\r\n    line-height: 1;\r\n    z-index: 1;\r\n  }\r\n\r\n  .direction-degree {\r\n    position: absolute;\r\n    top: 0;\r\n    right: -40rpx;\r\n    font-size: 60rpx;\r\n  }\r\n\r\n  .bg-compass {\r\n    position: absolute;\r\n    top: 0;\r\n    left: 0;\r\n    width: 540rpx;\r\n    height: 540rpx;\r\n    transition: .1s;\r\n  }\r\n\r\n  .bg-compass-line {\r\n    position: absolute;\r\n    left: 267rpx;\r\n    top: -10rpx;\r\n    width: 6rpx;\r\n    height: 56rpx;\r\n    background-color: #1AAD19;\r\n    border-radius: 999rpx;\r\n    z-index: 1;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'onCompassChange',\r\n        direction: 0\r\n      }\r\n    },\r\n    onReady: function () {\r\n      uni.onCompassChange((res) => {\r\n        console.log('onCompassChange', res)\r\n        this.direction = res.direction\r\n      })\r\n    },\r\n    onUnload() {\r\n      uni.stopCompass();\r\n      this.direction = 0;\r\n    }\r\n  }\r\n\n```\n\n:::"},"startWifi":{"name":"## uni.startWifi(option) @startwifi","description":"初始化Wi-Fi模块\n\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","compatibility":"### startWifi 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **WifiOption** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - | - |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#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** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SSID | string | 是 | - | - | - |\n@| BSSID | string | 否 | - | - | - |\n@| secure | boolean | 否 | - | - | - |\n@| signalStrength | number | 否 | - | - | - |\n@| frequency | number | 否 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.startWifi)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=startWifi&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=startWifi&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=startWifi&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=startWifi&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=startWifi&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=startWifi)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=startWifi&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"stopWifi":{"name":"## uni.stopWifi(option) @stopwifi","description":"关闭 Wi-Fi 模块\n\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","compatibility":"### stopWifi 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | x | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **WifiOption** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - | - |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#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** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SSID | string | 是 | - | - | - |\n@| BSSID | string | 否 | - | - | - |\n@| secure | boolean | 否 | - | - | - |\n@| signalStrength | number | 否 | - | - | - |\n@| frequency | number | 否 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.stopWifi)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=stopWifi&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=stopWifi&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=stopWifi&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=stopWifi&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=stopWifi&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=stopWifi)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=stopWifi&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"connectWifi":{"name":"## uni.connectWifi(option) @connectwifi","description":"","compatibility":"### connectWifi 兼容性 \n| Web | Android 系统版本 | Android | iOS |\n| :- | :- | :- | :- |\n| - | >=4.4 && <10.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **WifiConnectOption** | 是 | - | - |  |\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](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#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** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SSID | string | 是 | - | - | - |\n@| BSSID | string | 否 | - | - | - |\n@| secure | boolean | 否 | - | - | - |\n@| signalStrength | number | 否 | - | - | - |\n@| frequency | number | 否 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.connectWifi)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#connectWifi)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=connectWifi&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=connectWifi&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=connectWifi&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=connectWifi&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=connectWifi&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=connectWifi)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=connectWifi&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getWifiList":{"name":"## uni.getWifiList(option) @getwifilist","description":"请求获取 Wi-Fi 列表。wifiList 数据会在 onGetWifiList 注册的回调中返回。\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","compatibility":"### getWifiList 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **WifiOption** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - | - |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#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** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SSID | string | 是 | - | - | - |\n@| BSSID | string | 否 | - | - | - |\n@| secure | boolean | 否 | - | - | - |\n@| signalStrength | number | 否 | - | - | - |\n@| frequency | number | 否 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.getWifiList)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#getWifiList)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getWifiList&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getWifiList&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getWifiList&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getWifiList&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getWifiList&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getWifiList)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getWifiList&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onGetWifiList":{"name":"## uni.onGetWifiList(callback) @ongetwifilist","description":"监听获取到 Wi-Fi 列表数据事件。\n\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","compatibility":"### onGetWifiList 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (wifiInfo: Record\\<string, any>) => void | 是 | - | - |  | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onGetWifiList)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#onGetWifiList)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onGetWifiList&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onGetWifiList&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onGetWifiList&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onGetWifiList&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onGetWifiList&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onGetWifiList)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onGetWifiList&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"offGetWifiList":{"name":"## uni.offGetWifiList(callback) @offgetwifilist","description":"移除获取到 Wi-Fi 列表数据事件的监听函数。\n\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","compatibility":"### offGetWifiList 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | () => void | 是 | - | - |  | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.offGetWifiList)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#offGetWifiList)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=offGetWifiList&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=offGetWifiList&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=offGetWifiList&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=offGetWifiList&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=offGetWifiList&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=offGetWifiList)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=offGetWifiList&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getConnectedWifi":{"name":"## uni.getConnectedWifi(option) @getconnectedwifi","description":"获取已连接的 Wi-Fi 信息\n\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","compatibility":"### getConnectedWifi 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **GetConnectedWifiOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| partialInfo | boolean | 否 | - | - | - |\n@| success | (res: [UniWifiResult](#uniwifiresult-values)) => void | 否 | - | - | - |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#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** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SSID | string | 是 | - | - | - |\n@| BSSID | string | 否 | - | - | - |\n@| secure | boolean | 否 | - | - | - |\n@| signalStrength | number | 否 | - | - | - |\n@| frequency | number | 否 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.getConnectedWifi)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#getConnectedWifi)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getConnectedWifi&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getConnectedWifi&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getConnectedWifi&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getConnectedWifi&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getConnectedWifi&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getConnectedWifi)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getConnectedWifi&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onWifiConnected":{"name":"## uni.onWifiConnected(callback) @onwificonnected","description":"监听连接上 Wi-Fi 的事件\n\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","compatibility":"### onWifiConnected 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\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** | 否 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| SSID | string | 是 | - | - | - |\n@| BSSID | string | 否 | - | - | - |\n@| secure | boolean | 否 | - | - | - |\n@| signalStrength | number | 否 | - | - | - |\n@| frequency | number | 否 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onWifiConnected)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnected)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onWifiConnected&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onWifiConnected&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onWifiConnected&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onWifiConnected&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onWifiConnected&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onWifiConnected)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onWifiConnected&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onWifiConnectedWithPartialInfo":{"name":"## uni.onWifiConnectedWithPartialInfo(callback) @onwificonnectedwithpartialinfo","description":"监听连接上 Wi-Fi 的事件。\n\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","compatibility":"### onWifiConnectedWithPartialInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\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":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.onWifiConnectedWithPartialInfo)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnectedWithPartialInfo)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onWifiConnectedWithPartialInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onWifiConnectedWithPartialInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onWifiConnectedWithPartialInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onWifiConnectedWithPartialInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onWifiConnectedWithPartialInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onWifiConnectedWithPartialInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onWifiConnectedWithPartialInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"offWifiConnected":{"name":"## uni.offWifiConnected(callback?) @offwificonnected","description":"移除连接上 Wi-Fi 的事件的监听函数。\n\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","compatibility":"### offWifiConnected 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | () => void | 否 | - | - |  | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.wifi.offWifiConnected)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnected)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=offWifiConnected&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=offWifiConnected&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=offWifiConnected&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=offWifiConnected&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=offWifiConnected&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=offWifiConnected)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=offWifiConnected&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"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","compatibility":"### onMemoryWarning 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\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":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.memory.onMemoryWarning)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onMemoryWarning&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onMemoryWarning&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onMemoryWarning&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onMemoryWarning&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onMemoryWarning&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onMemoryWarning)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onMemoryWarning&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"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","compatibility":"### offMemoryWarning 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\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":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.memory.offMemoryWarning)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=offMemoryWarning&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=offMemoryWarning&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=offMemoryWarning&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=offMemoryWarning&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=offMemoryWarning&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=offMemoryWarning)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=offMemoryWarning&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"onUserCaptureScreen":{"name":"## uni.onUserCaptureScreen(callback?) @onusercapturescreen","description":"开启截屏监听\r\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","compatibility":"### onUserCaptureScreen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (res: [OnUserCaptureScreenCallbackResult](#onusercapturescreencallbackresult-values)) => void | 否 | - | - |  | \n\n### OnUserCaptureScreenCallbackResult 的属性值 @onusercapturescreencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| path | string | 否 | - | - | 截屏文件路径(仅Android返回) |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.captureScreen.onUserCaptureScreen)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=onUserCaptureScreen&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=onUserCaptureScreen&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=onUserCaptureScreen&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=onUserCaptureScreen&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=onUserCaptureScreen&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=onUserCaptureScreen)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=onUserCaptureScreen&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"offUserCaptureScreen":{"name":"## uni.offUserCaptureScreen(callback?) @offusercapturescreen","description":"关闭截屏监听\r\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","compatibility":"### offUserCaptureScreen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (res: [OnUserCaptureScreenCallbackResult](#onusercapturescreencallbackresult-values)) => void | 否 | - | - |  | \n\n### OnUserCaptureScreenCallbackResult 的属性值 @onusercapturescreencallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| path | string | 否 | - | - | 截屏文件路径(仅Android返回) |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.captureScreen.offUserCaptureScreen)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=offUserCaptureScreen&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=offUserCaptureScreen&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=offUserCaptureScreen&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=offUserCaptureScreen&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=offUserCaptureScreen&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=offUserCaptureScreen)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=offUserCaptureScreen&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"createRequestPermissionListener":{"name":"## uni.createRequestPermissionListener() @createrequestpermissionlistener","description":"创建一个监听权限申请的对象。","compatibility":"### createRequestPermissionListener 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | x |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [RequestPermissionListener](#requestpermissionlistener-values) |\n\n#### RequestPermissionListener 的方法 @requestpermissionlistener-values \n\n#### onRequest(callback : RequestPermissionListenerRequestCallback) : void @onrequest\n监听申请系统权限\n##### onRequest 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (permissions: Array\\<string\\>) => void | 是 | - | - | 申请系统权限回调,permissions为触发权限申请的所有权限 | \n\n\n#### onConfirm(callback : RequestPermissionListenerConfirmCallback) : void @onconfirm\n监听弹出系统权限授权框\n##### onConfirm 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (permissions: Array\\<string\\>) => void | 是 | - | - | 弹出系统权限授权框回调,permissions为触发弹出权限授权框的所有权限 | \n\n\n#### onComplete(callback : RequestPermissionListenerCompleteCallback) : void @oncomplete\n监听权限申请完成\n##### onComplete 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (permissions: Array\\<string\\>) => void | 是 | - | - | 权限申请完成回调,permissions为申请完成的所有权限 | \n\n\n#### stop() : void @stop\n取消所有监听\n##### stop 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.device.createRequestPermissionListener)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/system/create-request-permission-listener.html)","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 >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/create-request-permission-listener/create-request-permission-listener\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <page-head title=\"权限申请监听\"></page-head>\r\n    <view class=\"permission-alert\" id=\"permission-alert\"\r\n      :style=\"{'transform':isPermissionAlertShow ? 'translateY(0)':'translateY(-110px)'}\">\r\n      <text style=\"font-size: 20px;margin-bottom: 10px;margin-top: 5px;\">访问日历权限申请说明:</text>\r\n      <text style=\"color: darkgray;\">uni-app x正在申请访问日历权限用于演示,允许或拒绝均不会获取任何隐私信息。</text>\r\n    </view>\r\n    <button type=\"primary\" style=\"margin: 10px;\" @click=\"requestPermission\">点击申请日历权限</button>\r\n\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        isPermissionAlertShow: false,\r\n        permissionAlert: null as UniElement | null,\r\n        timeoutId: -1,\r\n        permissionListener: null as RequestPermissionListener | null\r\n      }\r\n    },\r\n\r\n    onReady() {\r\n      this.watchPermissionRRequest()\r\n    },\r\n    onUnload() {\r\n      this.permissionListener?.stop()\r\n      this.permissionListener = null\r\n      clearTimeout(this.timeoutId)\r\n    },\r\n    methods: {\r\n      watchPermissionRRequest() {\r\n        this.permissionListener = uni.createRequestPermissionListener()\r\n        this.permissionListener!.onConfirm((_) => {\r\n          // TODO 目前onConfirm监听实现的在时间上不够精确,暂时需要延迟弹框,后续修复\r\n          // TODO 这里的弹框仅为演示,实际开发中监听权限申请的代码应该在app.uvue中,弹框应全局处理,可参考https://gitcode.net/dcloud/uni-api/-/tree/master/uni_modules/uni-prompt/utssdk/app-android 代码自行封装一个uts的全局弹框\r\n          this.timeoutId = setTimeout(() => {\r\n            this.isPermissionAlertShow = true\r\n          }, 100)\r\n        })\r\n        this.permissionListener!.onComplete((_) => {\r\n          clearTimeout(this.timeoutId)\r\n          this.isPermissionAlertShow = false\r\n        })\r\n      },\r\n      requestPermission() {\r\n        // #ifdef APP-ANDROID\r\n        if (UTSAndroid.checkSystemPermissionGranted(UTSAndroid.getUniActivity()!, [\"android.permission.READ_CALENDAR\"])) {\r\n          uni.showToast({\r\n            title: \"权限已经同意了,不需要再申请\",\r\n            position: \"bottom\"\r\n          })\r\n          return\r\n        }\r\n        UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, [\"android.permission.READ_CALENDAR\"], (_ : boolean, p : string[]) => {\r\n          console.log(p)\r\n        }, (_ : boolean, p : string[]) => {\r\n          uni.showToast({\r\n            title: \"权限被拒绝了\",\r\n            position: \"bottom\"\r\n          })\r\n          console.log(p)\r\n        })\r\n        // #endif\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .permission-alert {\r\n    width: 90%;\r\n    height: 100px;\r\n    margin: 10px 5%;\r\n    position: absolute;\r\n    top: 0px;\r\n    z-index: 3;\r\n    border-radius: 5px;\r\n    transition-property: transform;\r\n    transition-duration: 200ms;\r\n    background-color: white;\r\n    padding: 10px;\r\n  }\r\n</style>\n\n```\n:::"},"chooseImage":{"name":"## uni.chooseImage(options) @chooseimage","description":"从本地相册选择图片或使用相机拍照","compatibility":"### chooseImage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ChooseImageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| count | number | 否 | 9 | - | 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。 |\n@| sourceType | Array\\<string\\> | 否 | ['album','camera'\\] | - | album 从相册选图,camera 使用相机,默认二者都有 |\n@| extension | Array\\<string\\> | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"-\"]]}' /> | 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。仅H5支持 |\n@| success | (callback: [ChooseImageSuccess](#chooseimagesuccess-values)) => void | 否 | - | - | 成功则返回图片的本地文件路径列表 tempFilePaths |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### ChooseImageSuccess 的属性值 @chooseimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errSubject | string | 是 | - | - | 调用API的名称 |\n| errMsg | string | 是 | - | - | 描述信息 |\n| tempFilePaths | Array\\<string\\> | 是 | - | - | 图片的本地文件路径列表 |\n| tempFiles | Array\\<**ChooseImageTempFile**\\> | 是 | - | - | 图片的本地文件列表 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| path | string | 是 | - | - | 本地文件路径 |\n@| size | number | 是 | - | - | 本地文件大小,单位:B |\n@| name | string | 否 | - | - | 包含扩展名的文件名称,仅H5支持 |\n@| type | string | 否 | - | - | 文件类型,仅H5支持 |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.chooseImage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/image.html#chooseimage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=chooseImage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=chooseImage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=chooseImage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=chooseImage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=chooseImage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=chooseImage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=chooseImage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/choose-image/choose-image\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-common-mt\">\r\n        <view class=\"uni-list\">\r\n          <view class=\"uni-list-cell cell-pd\">\r\n            <view class=\"uni-list-cell-left uni-label\">\r\n              图片来源\r\n            </view>\r\n            <view class=\"uni-list-cell-right\" @click=\"chooseImageSource\">\r\n              <text class=\"click-t\">{{sourceType[sourceTypeIndex]}}</text>\r\n            </view>\r\n          </view>\r\n\r\n          <view class=\"uni-list-cell cell-pd\">\r\n            <view class=\"uni-list-cell-left uni-label\">\r\n              图片质量\r\n            </view>\r\n            <view class=\"uni-list-cell-right\" @click=\"chooseImageType\">\r\n              <text class=\"click-t\">{{sizeType[sizeTypeIndex]}}</text>\r\n            </view>\r\n          </view>\r\n\r\n          <view class=\"uni-list-cell cell-pd\">\r\n            <view class=\"uni-list-cell-left uni-label\">\r\n              数量限制\r\n            </view>\r\n            <view class=\"uni-list-cell-right\">\r\n              <input class=\"click-t\" :value=\"countIndex+1\" type=\"number\" :maxlength=\"1\" @confirm=\"chooseImageCount\"\r\n                confirm-type=\"done\" />\r\n            </view>\r\n          </view>\r\n          <view class=\"uni-list-cell cell-pd\">\r\n            <view class=\"uni-list-cell-left uni-label\">\r\n              图像裁剪\r\n            </view>\r\n            <view class=\"uni-list-cell-right\">\r\n              <switch :checked=\"isCrop\" @change=\"switchCrop\"></switch>\r\n            </view>\r\n          </view>\r\n          <view ref=\"cropOptionNode\" class=\"crop-option\"\r\n            :style=\"{'height':isCrop?'200px':'0px','margin-bottom':isCrop?'11px':'0px'}\">\r\n            <view class=\"uni-list-cell cell-pd\">\r\n              <view class=\"uni-list-cell-left item_width\">\r\n                图片质量(%)\r\n              </view>\r\n              <view class=\"uni-list-cell-right\">\r\n                <input :value=\"cropPercent\" @confirm=\"cropPercentConfim\" type=\"number\" maxlength=\"-1\" />\r\n              </view>\r\n            </view>\r\n            <view class=\"uni-list-cell cell-pd\">\r\n              <view class=\"uni-list-cell-left item_width\">\r\n                裁剪宽度(px)\r\n              </view>\r\n              <view class=\"uni-list-cell-right\">\r\n                <input :value=\"cropWidth\" @confirm=\"cropWidthConfim\" type=\"number\" maxlength=\"-1\" />\r\n              </view>\r\n            </view>\r\n            <view class=\"uni-list-cell cell-pd\">\r\n              <view class=\"uni-list-cell-left item_width\">\r\n                裁剪高度(px)\r\n              </view>\r\n              <view class=\"uni-list-cell-right\">\r\n                <input :value=\"cropHeight\" @confirm=\"cropHeightConfim\" type=\"number\" maxlength=\"-1\" />\r\n              </view>\r\n            </view>\r\n            <view class=\"uni-list-cell cell-pd\">\r\n              <view class=\"uni-list-cell-left item_width\">\r\n                保留原宽高\r\n              </view>\r\n              <view class=\"uni-list-cell-right\">\r\n                <switch :checked=\"cropResize\" @change=\"cropResizeChange\"></switch>\r\n              </view>\r\n            </view>\r\n          </view>\r\n        </view>\r\n\r\n        <view class=\"uni-list list-pd\" style=\"padding: 15px;\">\r\n          <view class=\"uni-flex\" style=\"margin-bottom: 10px;\">\r\n            <view class=\"uni-list-cell-left\">点击可预览选好的图片</view>\r\n            <view style=\"margin-left: auto;\">\r\n              <text class=\"click-t\">{{imageList.length}}/{{countIndex+1}}</text>\r\n            </view>\r\n          </view>\r\n          <view class=\"uni-flex\" style=\"flex-wrap: wrap;\">\r\n            <view v-for=\"(image,index) in imageList\" :key=\"index\" class=\"uni-uploader__input-box\" style=\"border: 0;\">\r\n              <image style=\"width: 104px; height: 104px;\" :src=\"image\" :data-src=\"image\" @tap=\"previewImage(index)\">\r\n              </image>\r\n              <image src=\"/static/plus.png\" class=\"image-remove\" @click=\"removeImage(index)\"></image>\r\n            </view>\r\n            <image class=\"uni-uploader__input-box\" @tap=\"chooseImage\" src=\"/static/plus.png\"></image>\r\n          </view>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .cell-pd {\r\n    padding: 11px 15px;\r\n  }\r\n\r\n  .click-t {\r\n    color: darkgray;\r\n  }\r\n\r\n  .list-pd {\r\n    margin-top: 25px;\r\n  }\r\n\r\n  .uni-uploader__input-box {\r\n    margin: 5px;\r\n    width: 104px;\r\n    height: 104px;\r\n    border: 1px solid #D9D9D9;\r\n  }\r\n\r\n  .uni-uploader__input {\r\n    position: absolute;\r\n    z-index: 1;\r\n    top: 0;\r\n    left: 0;\r\n    width: 100%;\r\n    height: 100%;\r\n    opacity: 0;\r\n  }\r\n\r\n  .image-remove {\r\n    transform: rotate(45deg);\r\n    width: 25px;\r\n    height: 25px;\r\n    position: absolute;\r\n    top: 0;\r\n    right: 0;\r\n    border-radius: 13px;\r\n    background-color: rgba(200, 200, 200, 0.8);\r\n  }\r\n\r\n  .item_width {\r\n    width: 130px;\r\n  }\r\n\r\n  .crop-option {\r\n    margin-left: 11px;\r\n    margin-right: 11px;\r\n    border-radius: 11px;\r\n    background-color: #eee;\r\n    transition-property: height, margin-bottom;\r\n    transition-duration: 200ms;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  var sourceTypeArray = [\r\n    ['camera'],\r\n    ['album'],\r\n    ['camera', 'album']\r\n  ]\r\n  var sizeTypeArray = [\r\n    ['compressed'],\r\n    ['original'],\r\n    ['compressed', 'original']\r\n  ]\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'chooseImage',\r\n        imageList: [] as Array<string>,\r\n        sourceTypeIndex: 2,\r\n        sourceType: ['拍照', '相册', '拍照或相册'],\r\n        sizeTypeIndex: 2,\r\n        sizeType: ['压缩', '原图', '压缩或原图'],\r\n        countIndex: 8,\r\n        count: [1, 2, 3, 4, 5, 6, 7, 8, 9],\r\n        isCrop: false,\r\n        cropPercent: 80,\r\n        cropWidth: 100,\r\n        cropHeight: 100,\r\n        cropResize: false\r\n      }\r\n    },\r\n    onUnload() {\r\n      this.imageList = [];\r\n      this.sourceTypeIndex = 2\r\n      this.sourceType = ['拍照', '相册', '拍照或相册']\r\n      this.sizeTypeIndex = 2\r\n      this.sizeType = ['压缩', '原图', '压缩或原图']\r\n      this.countIndex = 8\r\n    },\r\n    methods: {\r\n      cropHeightConfim(e : InputConfirmEvent) {\r\n        let value = parseInt(e.detail.value)\r\n        if (value > 0) {\r\n          this.cropHeight = value\r\n        } else {\r\n          uni.showToast({\r\n            position: \"bottom\",\r\n            title: \"裁剪高度需要大于0\"\r\n          })\r\n        }\r\n      },\r\n      cropWidthConfim(e : InputConfirmEvent) {\r\n        let value = parseInt(e.detail.value)\r\n        if (value > 0) {\r\n          this.cropWidth = value\r\n        } else {\r\n          uni.showToast({\r\n            position: \"bottom\",\r\n            title: \"裁剪宽度需要大于0\"\r\n          })\r\n        }\r\n      },\r\n      cropPercentConfim(e : InputConfirmEvent) {\r\n        let value = parseInt(e.detail.value)\r\n        if (value > 0 && value <= 100) {\r\n          this.cropPercent = value\r\n        } else {\r\n          uni.showToast({\r\n            position: \"bottom\",\r\n            title: \"请输入0~100之间的值\"\r\n          })\r\n        }\r\n      },\r\n      cropResizeChange(e : UniSwitchChangeEvent) {\r\n        this.cropResize = e.detail.value\r\n      },\r\n      switchCrop(e : UniSwitchChangeEvent) {\r\n        this.isCrop = e.detail.value\r\n      },\r\n      removeImage(index : number) {\r\n        this.imageList.splice(index, 1)\r\n      },\r\n      chooseImageSource() {\r\n        uni.showActionSheet({\r\n          itemList: ['拍照', '相册', '拍照或相册'],\r\n          success: (e) => {\r\n            this.sourceTypeIndex = e.tapIndex!\r\n          }\r\n        })\r\n      },\r\n      chooseImageType() {\r\n        uni.showActionSheet({\r\n          itemList: ['压缩', '原图', '压缩或原图'],\r\n          success: (e) => {\r\n            this.sizeTypeIndex = e.tapIndex!\r\n          }\r\n        })\r\n      },\r\n      chooseImageCount(event : InputConfirmEvent) {\r\n        let count = parseInt(event.detail.value) - 1\r\n        if (count < 0) {\r\n          uni.showToast({\r\n            position: \"bottom\",\r\n            title: \"图片数量应该大于0\"\r\n          })\r\n          return\r\n        }\r\n        this.countIndex = count\r\n      },\r\n      chooseImage: function () {\r\n        // var cropOption:ChooseImageCropOptions|null = this.isCrop ? null : new ChooseImageCropOptions(  )\r\n        if (this.imageList.length >= 9) {\r\n          uni.showToast({\r\n            position: \"bottom\",\r\n            title: \"已经有9张图片了,请删除部分图片之后重新选择\"\r\n          })\r\n          return\r\n        }\r\n        uni.chooseImage({\r\n          sourceType: sourceTypeArray[this.sourceTypeIndex],\r\n          sizeType: sizeTypeArray[this.sizeTypeIndex],\r\n          crop: this.isCrop ? { \"quality\": this.cropPercent, \"width\": this.cropWidth, \"height\": this.cropHeight, \"resize\": this.cropResize } as ChooseImageCropOptions : null,\r\n          count: this.imageList.length + this.count[this.countIndex] > 9 ? 9 - this.imageList.length : this.count[this.countIndex],\r\n          success: (res) => {\r\n            this.imageList = this.imageList.concat(res.tempFilePaths);\r\n          },\r\n          fail: (err) => {\r\n            console.log(\"err: \", JSON.stringify(err));\r\n          }\r\n        })\r\n      },\r\n      previewImage: function (index : number) {\r\n        uni.previewImage({\r\n          current: index,\r\n          urls: this.imageList\r\n        })\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"previewImage":{"name":"## uni.previewImage(options) @previewimage","description":"预览图片","compatibility":"### previewImage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **PreviewImageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| current | any | 否 | - | - | current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。APP平台仅支持索引值。 |\n@| urls | Array\\<[string.ImageURIString](/uts/data-type.md#ide-string)\\> | 是 | - | - | 需要预览的图片链接列表 |\n@| showmenu | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否显示长按菜单<br/> |\n@| loop | boolean | 否 | - | - | 是否可循环预览 |\n@| success | (callback: [PreviewImageSuccess](#previewimagesuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \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 | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.previewImage.previewImage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/image.html#unipreviewimageobject)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=previewImage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=previewImage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=previewImage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=previewImage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=previewImage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=previewImage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=previewImage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/preview-image/preview-image\n\n>Template\n```vue\n<template>\n  <!-- #ifdef APP -->\n  <scroll-view style=\"flex: 1\">\n  <!-- #endif -->\n    <view style=\"padding-left: 8px; padding-right: 8px\">\n      <view>\n        <text class=\"text-desc\">图片指示器样式</text>\n        <radio-group class=\"cell-ct\" style=\"background-color: white\" @change=\"onIndicatorChanged\">\n          <view class=\"indicator-it\" v-for=\"(item, index) in indicator\" :key=\"item.value\">\n            <radio :checked=\"index == 0\" :value=\"item.value\">{{\n              item.name\n            }}</radio>\n          </view>\n        </radio-group>\n      </view>\n      <view>\n        <checkbox-group @change=\"onCheckboxChange\" style=\"margin-top: 16px; margin-bottom: 16px; margin-left: 8px\">\n          <checkbox :checked=\"isLoop\" style=\"margin-right: 15px\">循环播放</checkbox>\n        </checkbox-group>\n      </view>\n      <view style=\"background-color: white\">\n        <text class=\"text-desc\">点击图片开始预览</text>\n        <view class=\"cell-ct\" style=\"margin: 8px;\">\n          <view class=\"cell cell-choose-image\" v-for=\"(image, index) in imageList\" :key=\"index\">\n            <image style=\"width: 100px; height: 100px\" mode=\"aspectFit\" :src=\"image\" @click=\"previewImage(index)\">\n            </image>\n          </view>\n          <image class=\"cell cell-choose-image\" src=\"/static/plus.png\" @click=\"chooseImage\">\n            <view></view>\n          </image>\n        </view>\n      </view>\n    </view>\n  <!-- #ifdef APP -->\n  </scroll-view>\n  <!-- #endif -->\n</template>\n\n\n\n<style>\n  .text-desc {\n    margin-top: 16px;\n    margin-left: 8px;\n    margin-bottom: 16px;\n    font-weight: bold;\n  }\n\n  .cell-ct {\n    display: flex;\n    flex-wrap: wrap;\n    flex-direction: row;\n  }\n\n  .cell {\n    margin-left: 3px;\n    margin-right: 3px;\n    width: 100px;\n    height: 100px;\n  }\n\n  .cell-choose-image {\n    border-width: 1px;\n    border-style: solid;\n    border-color: lightgray;\n  }\n\n  .indicator-it {\n    margin: 8px;\n  }\n</style>\n\n```\n\n>Script\n```uts\n\n  type Indicator = \"number\" | \"default\" | \"none\"\n  type ItemType = {\n    value : Indicator,\n    name : string\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\" as Indicator,\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 as Indicator\n      },\n      onCheckboxChange(_ : UniCheckboxGroupChangeEvent) {\n        this.isLoop = !this.isLoop\n      }\n    }\n  }\n\n```\n\n:::"},"closePreviewImage":{"name":"## uni.closePreviewImage(options) @closepreviewimage","description":"关闭图片预览","compatibility":"### closePreviewImage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ClosePreviewImageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (callback: [ClosePreviewImageSuccess](#closepreviewimagesuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### ClosePreviewImageSuccess 的属性值 @closepreviewimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | 错误信息 |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.previewImage.closePreviewImage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/image.html#closepreviewimage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=closePreviewImage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=closePreviewImage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=closePreviewImage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=closePreviewImage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=closePreviewImage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=closePreviewImage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=closePreviewImage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"saveImageToPhotosAlbum":{"name":"## uni.saveImageToPhotosAlbum(options) @saveimagetophotosalbum","description":"保存图片到系统相册","compatibility":"### saveImageToPhotosAlbum 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SaveImageToPhotosAlbumOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.ImageURIString](/uts/data-type.md#ide-string) | 是 | - | - | 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径 |\n@| success | (callback: [SaveImageToPhotosAlbumSuccess](#saveimagetophotosalbumsuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### SaveImageToPhotosAlbumSuccess 的属性值 @saveimagetophotosalbumsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| path | string | 是 | - | - | 保存到相册的图片路径 |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.saveImageToPhotosAlbum)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/image.html#saveimagetophotosalbum)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=saveImageToPhotosAlbum&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=saveImageToPhotosAlbum&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=saveImageToPhotosAlbum&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=saveImageToPhotosAlbum&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=saveImageToPhotosAlbum&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=saveImageToPhotosAlbum)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=saveImageToPhotosAlbum&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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 >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/save-image-to-photos-album/save-image-to-photos-album\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <image class=\"image\" src=\"/static/uni.png\"></image>\r\n      <button class=\"margin-top-10\" type=\"primary\" @click=\"saveImage\">将图片保存到手机相册</button>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: \"saveImageToPhotosAlbum\",\r\n        // 自动化测试\r\n        success: false\r\n      }\r\n    },\r\n    methods: {\r\n      saveImage() {\r\n        uni.saveImageToPhotosAlbum({\r\n          filePath: \"/static/uni.png\",\r\n          success: (res) => {\r\n            console.log(\"saveImageToPhotosAlbum success\", JSON.stringify(res));\r\n            uni.showToast({\r\n              position: \"center\",\r\n              icon: \"none\",\r\n              title: \"图片保存成功,请到手机相册查看\"\r\n            });\r\n            this.success = true;\r\n          },\r\n          fail: (err) => {\r\n            uni.showModal({\r\n              title: \"保存图片到相册失败\",\r\n              content: JSON.stringify(err),\r\n              showCancel: false\r\n            });\r\n            this.success = false;\r\n          }\r\n        })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .margin-top-10 {\r\n    margin-top: 10px;\r\n  }\r\n\r\n  .image {\r\n    width: 196px;\r\n    height: 196px;\r\n    align-self: center;\r\n  }\r\n</style>\n\n```\n:::"},"getImageInfo":{"name":"## uni.getImageInfo(options) @getimageinfo","description":"获取图片信息","compatibility":"### getImageInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.18 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetImageInfoOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| src | [string.ImageURIString](/uts/data-type.md#ide-string) | 是 | - | - | 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径 |\n@| success | (callback: [GetImageInfoSuccess](#getimageinfosuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### GetImageInfoSuccess 的属性值 @getimageinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| width | number | 是 | - | - | 图片宽度,单位px |\n| height | number | 是 | - | - | 图片高度,单位px |\n| path | string | 是 | - | - | 返回图片的本地路径 |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.getImageInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/image.html#getimageinfo)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getImageInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getImageInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getImageInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getImageInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getImageInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getImageInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getImageInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/get-image-info/get-image-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-image-info/get-image-info\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-image-info/get-image-info\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-title\">\r\n        <text class=\"uni-subtitle-text\">获取本地相对路径图片信息</text>\r\n      </view>\r\n      <image class=\"image\" :src=\"relativeImagePath\" mode=\"aspectFit\"></image>\r\n      <text class=\"margin-top-10\">{{absoluteImageInfo}}</text>\r\n      <view class=\"uni-title\">\r\n        <text class=\"uni-subtitle-text\">获取网络路径图片信息</text>\r\n      </view>\r\n      <image class=\"image\" :src=\"remoteImagePath\" mode=\"aspectFit\"></image>\r\n      <text class=\"margin-top-10\">{{remoteImageInfo}}</text>\r\n      <view class=\"uni-title\">\r\n        <text class=\"uni-subtitle-text\">获取本地绝对路径图片信息</text>\r\n      </view>\r\n      <image class=\"image\" :src=\"absoluteImagePath\" mode=\"aspectFit\"></image>\r\n      <text class=\"margin-top-10\">{{relativeImageInfo}}</text>\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @click=\"chooseImage\">拍摄照片或从相册中选择照片</button>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .image {\r\n    align-self: center;\r\n  }\r\n\r\n  .margin-top-10 {\r\n    margin-top: 10px;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: \"getImageInfo\",\r\n        relativeImagePath: \"/static/test-image/logo.png\",\r\n        relativeImageInfo: \"\",\r\n        absoluteImagePath: \"\",\r\n        absoluteImageInfo: \"\",\r\n        remoteImagePath: \"https://qiniu-web-assets.dcloud.net.cn/uni-app-x/static/img/building.jpg\",\r\n        remoteImageInfo: \"\",\r\n        // 自动化测试\r\n        imageInfoForTest: null as UTSJSONObject | null,\r\n      }\r\n    },\r\n    methods: {\r\n      chooseImage() {\r\n        uni.chooseImage({\r\n          count: 1,\r\n          success: (res) => {\r\n            this.absoluteImagePath = res.tempFilePaths[0];\r\n            uni.getImageInfo({\r\n              src: res.tempFilePaths[0],\r\n              success: (_res) => {\r\n                console.log(\"getImageInfo success\", JSON.stringify(_res));\r\n                this.relativeImageInfo = `图片宽度: ${_res.width}\\n图片高度: ${_res.height}\\n图片路径: ${_res.path}\\n图片方向: ${_res.orientation}\\n图片格式: ${_res.type}`;\r\n              },\r\n              fail: (err) => {\r\n                uni.showModal({\r\n                  title: \"获取图片信息失败\",\r\n                  content: JSON.stringify(err),\r\n                  showCancel: false\r\n                });\r\n              }\r\n            });\r\n          }\r\n        });\r\n      }\r\n    },\r\n    onReady() {\r\n      uni.getImageInfo({\r\n        src: this.relativeImagePath,\r\n        success: (res) => {\r\n          console.log(\"getImageInfo success\", JSON.stringify(res));\r\n          this.absoluteImageInfo = `图片宽度: ${res.width}\\n图片高度: ${res.height}\\n图片路径: ${res.path}\\n图片方向: ${res.orientation}\\n图片格式: ${res.type}`;\r\n          this.imageInfoForTest = {\r\n            \"width\": res.width,\r\n            \"height\": res.height,\r\n            \"path\": res.path.slice(res.path.indexOf('/static')),\r\n            \"orientation\": res.orientation,\r\n            \"type\": res.type\r\n          };\r\n        },\r\n        fail: (err) => {\r\n          uni.showModal({\r\n            title: \"获取图片信息失败\",\r\n            content: JSON.stringify(err),\r\n            showCancel: false\r\n          });\r\n          this.imageInfoForTest = null;\r\n        }\r\n      });\r\n      uni.getImageInfo({\r\n        src: this.remoteImagePath,\r\n        success: (res) => {\r\n          console.log(\"getImageInfo success\", JSON.stringify(res));\r\n          this.remoteImageInfo = `图片宽度: ${res.width}\\n图片高度: ${res.height}\\n图片路径: ${res.path}\\n图片方向: ${res.orientation}\\n图片格式: ${res.type}`;\r\n        },\r\n        fail: (err) => {\r\n          uni.showModal({\r\n            title: \"获取图片信息失败\",\r\n            content: JSON.stringify(err),\r\n            showCancel: false\r\n          });\r\n        }\r\n      });\r\n    }\r\n  }\r\n\n```\n\n:::"},"compressImage":{"name":"## uni.compressImage(options) @compressimage","description":"压缩图片","compatibility":"### compressImage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CompressImageOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| src | [string.ImageURIString](/uts/data-type.md#ide-string) | 是 | - | - | 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径 |\n@| quality | number | 否 | - | - | 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效) |\n@| rotate | number | 否 | - | - | 旋转度数,范围0~360 |\n@| compressedHeight | number | 否 | - | - | 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放 |\n@| compressedWidth | number | 否 | - | - | 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。 |\n@| success | (callback: [CompressImageSuccess](#compressimagesuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) |\n@| ~~height~~ | string | 否 | - | - | 缩放图片的高度  **已废弃** |\n@| ~~width~~ | string | 否 | - | - | 缩放图片的宽度  **已废弃** | \n\n#### CompressImageSuccess 的属性值 @compressimagesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | - | 压缩后图片的临时文件路径 |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.compressImage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/image.html#compressimage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=compressImage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=compressImage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=compressImage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=compressImage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=compressImage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=compressImage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=compressImage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/compress-image/compress-image.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/compress-image/compress-image\n```uvue\n<template>\n  <!-- #ifdef APP -->\n  <scroll-view style=\"flex:1\">\n  <!-- #endif -->\n    <view>\n      <page-head :title=\"title\"></page-head>\n      <view class=\"uni-padding-wrap\">\n        <view class=\"image-container\">\n          <image class=\"image\" :src=\"beforeCompressPath\" mode=\"aspectFit\"></image>\n          <image class=\"image\" :src=\"afterCompressPath\" mode=\"aspectFit\"></image>\n        </view>\n        <view class=\"uni-title\">\n          <text class=\"uni-subtitle-text\">压缩前图片信息</text>\n        </view>\n        <text>{{beforeCompressImageInfo}}</text>\n        <view class=\"uni-title\">\n          <text class=\"uni-subtitle-text\">压缩后图片信息</text>\n        </view>\n        <text>{{afterCompressImageInfo}}</text>\n        <view class=\"uni-btn-v\">\n          <button type=\"primary\" @click=\"chooseImage\">从相册中选取待压缩的图片</button>\n        </view>\n        <view class=\"uni-btn-v\">\n          <button type=\"primary\" @click=\"compressImage\">压缩图片</button>\n        </view>\n      </view>\n      <input-data defaultValue=\"80\" title=\"压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)\" type=\"number\"\n        @confirm=\"onQualityConfirm\"></input-data>\n      <input-data title=\"压缩后图片的宽度,单位px\" type=\"string\" @confirm=\"onCompressedWidthConfirm\"></input-data>\n      <input-data title=\"压缩后图片的高度,单位px\" type=\"string\" @confirm=\"onCompressedHeightConfirm\"></input-data>\n      <input-data defaultValue=\"0\" title=\"旋转度数,范围0~360\" type=\"number\" @confirm=\"onRotateConfirm\"></input-data>\n    </view>\n  <!-- #ifdef APP -->\n  </scroll-view>\n  <!-- #endif -->\n</template>\n\n<script>\n  // #ifdef APP-ANDROID\n  import FileInputStream from 'java.io.FileInputStream';\n  // #endif\n  export default {\n    data() {\n      return {\n        title: \"compressImage\",\n        beforeCompressImageInfo: \"\",\n        afterCompressImageInfo: \"\",\n        beforeCompressPath: \"\",\n        afterCompressPath: \"\",\n        quality: 80,\n        compressedWidth: null as number | null,\n        compressedHeight: null as number | null,\n        rotate: 0,\n        // 自动化测试\n        imageInfoForTest: null,\n        imageSrcForTest: '/static/test-image/logo.png'\n      }\n    },\n    methods: {\n      compressImage() {\n        if (this.beforeCompressPath == \"\") {\n          uni.showToast({\n            title: \"请先选择图片\",\n            icon: \"error\"\n          });\n          return;\n        }\n        uni.showLoading({\n          title: \"图片压缩中\"\n        });\n        uni.compressImage({\n          src: this.beforeCompressPath,\n          quality: this.quality,\n          compressedWidth: this.compressedWidth,\n          compressedHeight: this.compressedHeight,\n          rotate: this.rotate,\n          success: (res) => {\n            console.log(\"compressImage success\", JSON.stringify(res));\n            this.afterCompressPath = res.tempFilePath;\n            uni.showToast({\n              title: \"压缩成功\",\n              icon: null\n            });\n            uni.getImageInfo({\n              src: res.tempFilePath,\n              success: (_res) => {\n                this.afterCompressImageInfo = `图片宽度: ${_res.width}\\n图片高度: ${_res.height}\\n`;\n                // #ifdef APP-ANDROID\n                const size = new FileInputStream(res.tempFilePath.substring(\"file://\".length)).available() / 1024;\n                this.afterCompressImageInfo = this.afterCompressImageInfo.concat(`图片大小: ${size}KB`);\n                // #endif\n              }\n            });\n          },\n          fail: (err) => {\n            uni.showModal({\n              title: \"压缩图片失败\",\n              content: JSON.stringify(err),\n              showCancel: false\n            });\n          },\n          complete: (_) => {\n            uni.hideLoading();\n          }\n        });\n      },\n      chooseImage() {\n        uni.chooseImage({\n          count: 1,\n          sizeType: [\"original\"],\n          sourceType: [\"album\"],\n          success: (res) => {\n            this.beforeCompressPath = res.tempFilePaths[0];\n            uni.getImageInfo({\n              src: res.tempFilePaths[0],\n              success: (_res) => {\n                this.beforeCompressImageInfo = `图片宽度: ${_res.width}\\n图片高度: ${_res.height}\\n`;\n                // #ifdef APP-ANDROID\n                const size = new FileInputStream(res.tempFilePaths[0].substring(\"file://\".length)).available() / 1024;\n                this.beforeCompressImageInfo = this.beforeCompressImageInfo.concat(`图片大小: ${size}KB`);\n                // #endif\n              }\n            });\n          }\n        });\n      },\n      onQualityConfirm(value : number) {\n        this.quality = value;\n      },\n      onCompressedWidthConfirm(value : string) {\n        this.compressedWidth = parseInt(value);\n      },\n      onCompressedHeightConfirm(value : string) {\n        this.compressedHeight = parseInt(value);\n      },\n      onRotateConfirm(value : number) {\n        this.rotate = value;\n      },\n      testCompressImage() {\n        uni.compressImage({\n          src: this.imageSrcForTest,\n          quality: 50,\n          compressedWidth: 100,\n          compressedHeight: 100,\n          success: (res) => {\n            uni.getImageInfo({\n              src: res.tempFilePath,\n              success: (_res) => {\n                let beforeCompressSize : number, afterComoressSize : number;\n                // #ifdef APP-ANDROID\n                beforeCompressSize = new FileInputStream(UTSAndroid.convert2AbsFullPath(this.imageSrcForTest)).available();\n                afterComoressSize = new FileInputStream(res.tempFilePath.substring(\"file://\".length)).available();\n                // #endif\n                this.imageInfoForTest = {\n                  \"width\": _res.width,\n                  \"height\": _res.height,\n                  \"isSizeReduce\": afterComoressSize < beforeCompressSize\n                };\n              }\n            });\n          },\n          fail: (_) => {\n            this.imageInfoForTest = null;\n          }\n        });\n      }\n    }\n  }\n</script>\n\n<style>\n  .image {\n    flex: 1;\n  }\n\n  .image-container {\n    flex-direction: row;\n  }\n</style>\n\n```\n:::"},"chooseVideo":{"name":"## uni.chooseVideo(options) @choosevideo","description":"拍摄视频或从手机相册中选视频,返回视频的临时文件路径。","compatibility":"### chooseVideo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ChooseVideoOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| sourceType | Array\\<string\\> | 否 | - | - | album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera'\\] |\n@| success | (callback: [ChooseVideoSuccess](#choosevideosuccess-values)) => void | 否 | - | - | 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### ChooseVideoSuccess 的属性值 @choosevideosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | - | 选定视频的临时文件路径 |\n| duration | number | 是 | - | - | 选定视频的时间长度 |\n| size | number | 是 | - | - | 选定视频的数据量大小 |\n| height | number | 是 | - | - | 返回选定视频的长 |\n| width | number | 是 | - | - | 返回选定视频的宽 |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.chooseVideo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/video.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=chooseVideo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=chooseVideo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=chooseVideo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=chooseVideo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=chooseVideo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=chooseVideo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=chooseVideo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/choose-video/choose-video.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/choose-video/choose-video\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/choose-video/choose-video\n\n>Template\n```vue\n<template>\n  <!-- #ifdef APP -->\n  <scroll-view style=\"flex:1\">\n  <!-- #endif -->\n    <page-head :title=\"title\"></page-head>\n    <view class=\"uni-padding-wrap\">\n      <video class=\"video\" :src=\"src\" :controls=\"true\"></video>\n      <view class=\"uni-title\">\n        <text class=\"uni-subtitle-text\">视频信息</text>\n      </view>\n      <text>{{videoInfo}}</text>\n      <view class=\"uni-btn-v\">\n        <button type=\"primary\" @click=\"chooseVideo\">选取视频</button>\n      </view>\n      <enum-data title=\"视频来源\" :items=\"sourceTypeItemTypes\" @change=\"onSourceTypeChange\"></enum-data>\n      <enum-data title=\"摄像头\" :items=\"cameraItemTypes\" @change=\"onCameraChange\"></enum-data>\n    </view>\n    <input-data title=\"最长拍摄时间,单位秒\" defaultValue=\"60\" type=\"number\" @confirm=\"onMaxDurationConfirm\"></input-data>\n    <!-- #ifdef APP -->\n    <view class=\"uni-padding-wrap\">\n      <boolean-data title=\"是否压缩\" :defaultValue=\"true\" @change=\"onCompressedChange\"></boolean-data>\n    </view>\n    <!-- #endif -->\n  <!-- #ifdef APP -->\n  </scroll-view>\n  <!-- #endif -->\n</template>\n\n\n\n<style>\n  .video {\n    align-self: center;\n    width: 300px;\n    height: 225px;\n  }\n</style>\n\n```\n\n>Script\n```uts\n\n  import { ItemType } from '@/components/enum-data/enum-data';\n  type Camera = \"back\" | \"front\"\n  type Source = \"album\" | \"camera\"\n  export default {\n    data() {\n      return {\n        title: \"chooseVideo\",\n        src: \"\",\n        sourceTypeItemTypes: [{ \"value\": 0, \"name\": \"从相册中选择视频\" }, { \"value\": 1, \"name\": \"拍摄视频\" }, { \"value\": 2, \"name\": \"从相册中选择视频或拍摄视频\" }] as ItemType[],\n        sourceTypeItems: [[\"album\"], [\"camera\"], [\"album\", \"camera\"]] as Source[][],\n        cameraItemTypes: [{ \"value\": 0, \"name\": \"后置摄像头\" }, { \"value\": 1, \"name\": \"前置摄像头\" }] as ItemType[],\n        cameraItems: [\"back\", \"front\"] as Camera[],\n        sourceType: [\"album\", \"camera\"] as Source[],\n        compressed: true,\n        maxDuration: 60,\n        camera: \"back\" as Camera,\n        videoInfo: \"\"\n      }\n    },\n    methods: {\n      chooseVideo() {\n        uni.chooseVideo({\n          sourceType: this.sourceType,\n          // #ifdef APP\n          compressed: this.compressed,\n          // #endif\n          maxDuration: this.maxDuration,\n          camera: this.camera,\n          success: (res) => {\n            console.log(\"chooseVideo success\", JSON.stringify(res));\n            this.src = res.tempFilePath;\n            this.videoInfo = `视频长度: ${res.duration}s\\n视频大小: ${Math.ceil(res.size / 1024)}KB\\n视频宽度: ${res.width}\\n视频高度: ${res.height}\\n`;\n          },\n          fail: (err) => {\n            uni.showModal({\n              title: \"选择视频失败\",\n              content: JSON.stringify(err),\n              showCancel: false\n            });\n          }\n        });\n      },\n      onSourceTypeChange(value : number) {\n        this.sourceType = this.sourceTypeItems[value];\n      },\n      onCompressedChange(value : boolean) {\n        this.compressed = value;\n      },\n      onMaxDurationConfirm(value : number) {\n        this.maxDuration = value;\n      },\n      onCameraChange(value : number) {\n        this.camera = this.cameraItems[value];\n      }\n    }\n  }\n\n```\n\n:::"},"saveVideoToPhotosAlbum":{"name":"## uni.saveVideoToPhotosAlbum(options) @savevideotophotosalbum","description":"保存视频到系统相册","compatibility":"### saveVideoToPhotosAlbum 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SaveVideoToPhotosAlbumOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.VideoURIString](/uts/data-type.md#ide-string) | 是 | - | - | 视频文件路径,可以是临时文件路径也可以是永久文件路径 |\n@| success | (callback: SaveVideoToPhotosAlbumSuccess) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.saveVideoToPhotosAlbum)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/video.html#savevideotophotosalbum)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=saveVideoToPhotosAlbum&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=saveVideoToPhotosAlbum&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=saveVideoToPhotosAlbum&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=saveVideoToPhotosAlbum&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=saveVideoToPhotosAlbum&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=saveVideoToPhotosAlbum)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=saveVideoToPhotosAlbum&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/save-video-to-photos-album/save-video-to-photos-album.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/save-video-to-photos-album/save-video-to-photos-album\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <video class=\"video\" :src=\"src\" :controls=\"true\"></video>\r\n      <button type=\"primary\" class=\"margin-top-10\" @click=\"saveVideo\">将视频保存到手机相册</button>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'saveVideoToPhotosAlbum',\r\n        src: '/static/test-video/10second-demo.mp4',\r\n        // 自动化测试\r\n        success: false\r\n      }\r\n    },\r\n    methods: {\r\n      saveVideo() {\r\n        uni.saveVideoToPhotosAlbum({\r\n          filePath: this.src,\r\n          success: (_) => {\r\n            console.log(\"saveVideoToPhotosAlbum success\");\r\n            uni.showToast({\r\n              position: \"center\",\r\n              icon: \"none\",\r\n              title: \"视频保存成功,请到手机相册查看\"\r\n            });\r\n            this.success = true;\r\n          },\r\n          fail: (err) => {\r\n            uni.showModal({\r\n              title: \"保存视频到相册失败\",\r\n              content: JSON.stringify(err),\r\n              showCancel: false\r\n            });\r\n            this.success = false;\r\n          }\r\n        });\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n  .video {\r\n    align-self: center;\r\n  }\r\n\r\n  .margin-top-10 {\r\n    margin-top: 10px;\r\n  }\r\n</style>\n\n```\n:::"},"getVideoInfo":{"name":"## uni.getVideoInfo(options) @getvideoinfo","description":"获取视频详细信息","compatibility":"### getVideoInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.18 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetVideoInfoOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| src | [string.VideoURIString](/uts/data-type.md#ide-string) | 是 | - | - | 视频文件路径,可以是临时文件路径也可以是永久文件路径 |\n@| success | (callback: [GetVideoInfoSuccess](#getvideoinfosuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### GetVideoInfoSuccess 的属性值 @getvideoinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| duration | number | 是 | - | - | 视频长度 |\n| size | number | 是 | - | - | 视频大小,单位 kB |\n| height | number | 是 | - | - | 视频的长,单位 px |\n| width | number | 是 | - | - | 视频的宽,单位 px |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.getVideoInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/video.html#getvideoinfo)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getVideoInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getVideoInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getVideoInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getVideoInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getVideoInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getVideoInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getVideoInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/get-video-info/get-video-info.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/get-video-info/get-video-info\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-video-info/get-video-info\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-title\">\r\n        <text class=\"uni-subtitle-text\">获取本地相对路径视频信息</text>\r\n      </view>\r\n      <video class=\"video\" :src=\"relativeVideoPath\" :controls=\"true\"></video>\r\n      <text class=\"margin-top-10\">{{relativeVideoInfo}}</text>\r\n    </view>\r\n    <view class=\"uni-padding-wrap\">\r\n      <view class=\"uni-title\">\r\n        <text class=\"uni-subtitle-text\">获取本地绝对路径视频信息</text>\r\n      </view>\r\n      <video class=\"video\" :src=\"absoluteVideoPath\" :controls=\"true\"></video>\r\n      <text class=\"margin-top-10\">{{absoluteVideoInfo}}</text>\r\n      <view class=\"uni-btn-v\">\r\n        <button type=\"primary\" @click=\"chooseVideo\">拍摄视频或从相册中选择视频</button>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .video {\r\n    align-self: center;\r\n  }\r\n\r\n  .margin-top-10 {\r\n    margin-top: 10px;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: \"getVideoInfo\",\r\n        relativeVideoPath: \"/static/test-video/10second-demo.mp4\",\r\n        relativeVideoInfo: \"\",\r\n        absoluteVideoPath: \"\",\r\n        absoluteVideoInfo: \"\",\r\n        // 自动化测试\r\n        videoInfoForTest: null as UTSJSONObject | null\r\n      }\r\n    },\r\n    onReady() {\r\n      uni.getVideoInfo({\r\n        src: this.relativeVideoPath,\r\n        success: (res) => {\r\n          console.log(\"getVideoInfo success\", JSON.stringify(res));\r\n          this.relativeVideoInfo = `视频画面方向: ${res.orientation}\\n视频格式: ${res.type}\\n视频长度: ${res.duration}s\\n视频大小: ${res.size}KB\\n视频宽度: ${res.width}\\n视频高度: ${res.height}\\n视频帧率: ${res.fps}fps\\n视频码率: ${res.bitrate}kbps`;\r\n        },\r\n        fail: (err) => {\r\n          uni.showModal({\r\n            title: \"获取视频信息失败\",\r\n            content: JSON.stringify(err),\r\n            showCancel: false\r\n          });\r\n        }\r\n      });\r\n    },\r\n    methods: {\r\n      chooseVideo() {\r\n        uni.chooseVideo({\r\n          compressed: false,\r\n          success: (res) => {\r\n            this.absoluteVideoPath = res.tempFilePath;\r\n            uni.getVideoInfo({\r\n              src: res.tempFilePath,\r\n              success: (_res) => {\r\n                console.log(\"getVideoInfo success\", JSON.stringify(_res));\r\n                this.absoluteVideoInfo = `视频画面方向: ${_res.orientation}\\n视频格式: ${_res.type}\\n视频长度: ${_res.duration}s\\n视频大小: ${_res.size}KB\\n视频宽度: ${_res.width}\\n视频高度: ${_res.height}\\n视频帧率: ${_res.fps}fps\\n视频码率: ${_res.bitrate}kbps`;\r\n              },\r\n              fail: (err) => {\r\n                uni.showModal({\r\n                  title: \"获取视频信息失败\",\r\n                  content: JSON.stringify(err),\r\n                  showCancel: false\r\n                });\r\n              }\r\n            });\r\n          }\r\n        });\r\n      },\r\n      testGetVideoInfo() {\r\n        uni.getVideoInfo({\r\n          src: '/static/test-video/10second-demo.mp4',\r\n          success: (res) => {\r\n            this.videoInfoForTest = {\r\n              \"orientation\": res.orientation,\r\n              \"type\": res.type,\r\n              \"duration\": Math.trunc(res.duration),\r\n              \"size\": res.size,\r\n              \"width\": res.width,\r\n              \"height\": res.height,\r\n              \"fps\": res.fps,\r\n              \"bitrate\": res.bitrate\r\n            };\r\n          },\r\n          fail: (_) => {\r\n            this.videoInfoForTest = null;\r\n          }\r\n        });\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"compressVideo":{"name":"## uni.compressVideo(options) @compressvideo","description":"压缩视频","compatibility":"### compressVideo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.18 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CompressVideoOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| src | [string.VideoURIString](/uts/data-type.md#ide-string) | 是 | - | - | 视频文件路径,可以是临时文件路径也可以是永久文件路径 |\n@| quality | string | 否 | - | - | 压缩质量<br/> |\n@| resolution | number | 否 | - | - | 相对于原视频的分辨率比例,取值范围(0, 1\\] |\n@| success | (callback: [CompressVideoSuccess](#compressvideosuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (callback: [IMediaError](#imediaerror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (callback: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### CompressVideoSuccess 的属性值 @compressvideosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | - | 压缩后的临时文件地址 |\n| size | number | 是 | - | - | 压缩后的大小,单位 kB |\n\n#### IMediaError 的属性值 @imediaerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1101001 | - | 用户取消 |\n@| 1101002 | - | urls至少包含一张图片地址 |\n@| 1101003 | - | 文件不存在 |\n@| 1101004 | - | 图片加载失败 |\n@| 1101005 | - | 未获取权限 |\n@| 1101006 | - | 图片或视频保存失败 |\n@| 1101007 | - | 图片裁剪失败 |\n@| 1101008 | - | 拍照或录像失败 |\n@| 1101009 | - | 图片压缩失败 |\n@| 1101010 | - | 其他错误 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.compressVideo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/video.html#compressvideo)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=compressVideo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=compressVideo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=compressVideo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=compressVideo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=compressVideo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=compressVideo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=compressVideo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/compress-video/compress-video.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/compress-video/compress-video\n```uvue\n<template>\n  <!-- #ifdef APP -->\n  <scroll-view style=\"flex:1\">\n  <!-- #endif -->\n    <page-head :title=\"title\"></page-head>\n    <view>\n      <view class=\"uni-padding-wrap\">\n        <video class=\"video\" :src=\"beforeCompressPath\" :controls=\"true\"></video>\n        <view class=\"uni-title\">\n          <text class=\"uni-subtitle-text\">压缩前视频信息</text>\n        </view>\n        <text>{{beforeCompressVideoInfo}}</text>\n        <video class=\"video\" :src=\"afterCompressPath\" :controls=\"true\"></video>\n        <view class=\"uni-title\">\n          <text class=\"uni-subtitle-text\">压缩后视频信息</text>\n        </view>\n        <text>{{afterCompressVideoInfo}}</text>\n        <view class=\"uni-btn-v\">\n          <button type=\"primary\" @click=\"chooseVideo\">从相册中选取待压缩的视频</button>\n        </view>\n        <view class=\"uni-btn-v\">\n          <button type=\"primary\" @click=\"compressVideo\">压缩视频</button>\n        </view>\n        <enum-data title=\"压缩质量\" :items=\"qualityItemTypes\" @change=\"onQualityChange\"></enum-data>\n        <view class=\"uni-common-mt\">\n          <text class=\"uni-title uni-title-text\">相对于原视频的分辨率比例,取值范围(0, 1]</text>\n          <slider :min=\"0.1\" :max=\"1\" :step=\"0.1\" :show-value=\"true\" @change=\"onResolutionChange\"></slider>\n        </view>\n      </view>\n    </view>\n  <!-- #ifdef APP -->\n  </scroll-view>\n  <!-- #endif -->\n</template>\n\n<script>\n  import { ItemType } from '@/components/enum-data/enum-data';\n  export default {\n    data() {\n      return {\n        title: \"compressVideo\",\n        beforeCompressVideoInfo: \"\",\n        afterCompressVideoInfo: \"\",\n        beforeCompressPath: \"\",\n        afterCompressPath: \"\",\n        quality: null as string | null,\n        bitrate: null as number | null,\n        fps: null as number | null,\n        resolution: null as number | null,\n        qualityItemTypes: [{ \"value\": 0, \"name\": \"low(低)\" }, { \"value\": 1, \"name\": \"medium(中)\" }, { \"value\": 2, \"name\": \"high(高)\" }] as ItemType[],\n        qualityItems: [\"low\", \"medium\", \"high\"],\n        // 自动化测试\n        videoInfoForTest: null,\n        videoSrcForTest: '/static/test-video/10second-demo.mp4'\n      }\n    },\n    methods: {\n      compressVideo() {\n        if (this.beforeCompressPath == \"\") {\n          uni.showToast({\n            title: \"请先选择视频\",\n            icon: \"error\"\n          });\n          return;\n        }\n        uni.showLoading({\n          title: \"视频压缩中\"\n        });\n        uni.compressVideo({\n          src: this.beforeCompressPath,\n          quality: this.quality,\n          resolution: this.resolution,\n          success: (res) => {\n            console.log(\"compressVideo success\", JSON.stringify(res));\n            this.afterCompressPath = res.tempFilePath;\n            uni.showToast({\n              title: \"压缩成功\",\n              icon: null\n            });\n            uni.getVideoInfo({\n              src: res.tempFilePath,\n              success: (_res) => {\n                this.afterCompressVideoInfo = `视频画面方向: ${_res.orientation}\\n视频格式: ${_res.type}\\n视频长度: ${_res.duration}s\\n视频大小: ${_res.size}KB\\n视频宽度: ${_res.width}\\n视频高度: ${_res.height}\\n视频帧率: ${_res.fps}fps\\n视频码率: ${_res.bitrate}kbps`;\n              }\n            });\n          },\n          fail: (err) => {\n            uni.showModal({\n              title: \"压缩视频失败\",\n              content: JSON.stringify(err),\n              showCancel: false\n            });\n          },\n          complete: (_) => {\n            uni.hideLoading();\n          }\n        });\n      },\n      chooseVideo() {\n        uni.chooseVideo({\n          sourceType: [\"album\"],\n          compressed: false,\n          success: (res) => {\n            this.beforeCompressPath = res.tempFilePath;\n            uni.getVideoInfo({\n              src: res.tempFilePath,\n              success: (_res) => {\n                this.beforeCompressVideoInfo = `视频画面方向: ${_res.orientation}\\n视频格式: ${_res.type}\\n视频长度: ${_res.duration}s\\n视频大小: ${_res.size}KB\\n视频宽度: ${_res.width}\\n视频高度: ${_res.height}\\n视频帧率: ${_res.fps}fps\\n视频码率: ${_res.bitrate}kbps`;\n              }\n            });\n          }\n        });\n      },\n      onQualityChange(value : number) {\n        this.quality = this.qualityItems[value];\n      },\n      onResolutionChange(event : UniSliderChangeEvent) {\n        this.resolution = event.detail.value;\n      },\n      testCompressVideo() {\n        let beforeCompressSize : number, afterComoressSize : number;\n        uni.compressVideo({\n          src: this.videoSrcForTest,\n          quality: 'medium',\n          success: (res) => {\n            uni.getVideoInfo({\n              src: this.videoSrcForTest,\n              success: (_res) => {\n                beforeCompressSize = Math.trunc(_res.size);\n                uni.getVideoInfo({\n                  src: res.tempFilePath,\n                  success: (__res) => {\n                    afterComoressSize = Math.trunc(__res.size);\n                    this.videoInfoForTest = {\n                      \"width\": __res.width,\n                      \"height\": __res.height,\n                      \"isSizeReduce\": afterComoressSize < beforeCompressSize\n                    };\n                  }\n                });\n              }\n            });\n          },\n          fail: (_) => {\n            this.videoInfoForTest = null;\n          }\n        });\n      }\n    }\n  }\n</script>\n\n<style>\n  .video {\n    align-self: center;\n  }\n\n  .image-container {\n    flex-direction: row;\n  }\n</style>\n\n```\n:::"},"createInnerAudioContext":{"name":"## uni.createInnerAudioContext() @createinneraudiocontext","description":"创建并返回 audio 上下文 audioContext 对象\n","compatibility":"### createInnerAudioContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [InnerAudioContext](#inneraudiocontext-values) |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| duration | number | 是 | - | - | 当前音频的长度(单位:s),只有在当前有合法的 src 时返回 |\n@| currentTime | number | 是 | - | - | 当前音频的播放位置(单位:s),只有在当前有合法的 src 时返回 |\n@| paused | boolean | 是 | - | - | 当前是是否暂停或停止状态,true 表示暂停或停止,false 表示正在播放 |\n@| src | string | 是 | - | - | 音频的数据链接,用于直接播放。 |\n@| startTime | number | 是 | - | - | 音频开始播放的位置(单位:s) |\n@| buffered | number | 是 | - | - | 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲 |\n@| autoplay | boolean | 是 | - | - | 是否自动开始播放,默认 false |\n@| loop | boolean | 是 | - | - | 是否循环播放,默认 false |\n@| obeyMuteSwitch | boolean | 是 | - | - | 是否遵循系统静音开关,当此参数为 false 时,即使用户打开了静音开关,也能继续发出声音,默认值 true |\n@| volume | number | 是 | - | - | 音量。范围 0~1。 |\n@| playbackRate | number | 否 | - | - | 播放的倍率。可取值: 0.5/0.8/1.0/1.25/1.5/2.0,默认值为1.0。(仅 App 支持) |\n#### InnerAudioContext 的方法 @inneraudiocontext-values \n\n#### pause(): void; @pause\n暂停\n##### pause 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n\n#### onPause(callback: (result: any) => void): void; @onpause\n音频暂停事件\n##### onPause 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.media.createInnerAudioContext)\n - [参见uni-app相关文档](http://uniapp.dcloud.io/api/media/audio-context.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createInnerAudioContext&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createInnerAudioContext&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createInnerAudioContext&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createInnerAudioContext&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createInnerAudioContext&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createInnerAudioContext)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createInnerAudioContext&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/create-inner-audio-context/create-inner-audio-context.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/create-inner-audio-context/create-inner-audio-context\n\n>Template\n```vue\n<template>\n  <view class=\"uni-padding-wrap\">\n    <page-head title=\"audio\"></page-head>\n    <view class=\"uni-common-mt\">\n      <slider :value=\"position\" :min=\"0\" :max=\"duration\" @changing=\"onchanging\" @change=\"onchange\"></slider>\n    </view>\n    <view class=\"uni-title\">\n      <text class=\"uni-title-text\">属性示例</text>\n    </View>\n    <text class=\"uni-text-box uni-common-mt\">当前音频播放位置(保留小数点后 6 位):{{currentTime}} s</text>\n    <text class=\"uni-text-box\">音频的长度(单位:s):{{duration}} s</text>\n    <text class=\"uni-text-box\">当前是否停止状态:{{isPaused}}</text>\n    <text class=\"uni-text-box\">音频缓冲的时间点:{{buffered}}</text>\n    <text class=\"uni-text-box\">当前音量:{{volume}}</text>\n    <!-- 设置音量无效 -->\n    <!-- <button plain :disabled=\"volume == 1\" @click=\"increaseVolume\">增加音量</button>\n    <button plain :disabled=\"volume == 0\" @click=\"decreaseVolume\">减少音量</button> -->\n\n    <text class=\"uni-subtitle-text uni-title\">开始播放的位置(单位:s)</text>\n    <input :value=\"startTime\" type=\"number\" placeholder=\"开始播放的位置(单位:s)\" class=\"uni-input\"\n      @input=\"startTimeInput\"></input>\n    <boolean-data :defaultValue=\"false\" title=\"是否自动开始播放\" @change=\"setAutoplay\"></boolean-data>\n    <boolean-data :defaultValue=\"false\" title=\"是否循环播放\" @change=\"setLoop\"></boolean-data>\n    <view class=\"uni-title\">\n      <text class=\"uni-title-text\">方法示例</text>\n    </View>\n    <button :disabled=\"isPlaying\" type=\"primary\" @click=\"play\" class=\"uni-btn\">播放</button>\n    <button :disabled=\"!isPlaying\" type=\"primary\" @click=\"pause\" class=\"uni-btn\">暂停</button>\n    <button :disabled=\"!isPlaying && !isPaused\" type=\"primary\" @click=\"stop\" class=\"uni-btn\">停止</button>\n    <button type=\"primary\" @click=\"onchange(20)\" class=\"uni-btn\">跳转到指定位置20</button>\n\n    <view class=\"uni-title\">\n      <text class=\"uni-title-text\">格式/路径示例</text>\n    </View>\n    <navigator url=\"/pages/API/create-inner-audio-context/inner-audio-format\" class=\"uni-btn\">\n      <button type=\"primary\" @click=\"pause\">音频格式示例</button>\n    </navigator>\n    <navigator url=\"/pages/API/create-inner-audio-context/inner-audio-path\" class=\"uni-btn uni-common-mb\">\n      <button type=\"primary\" @click=\"pause\">音频路径示例</button>\n    </navigator>\n  </view>\n</template>\n\n<style>\n  .play-time-area {\n    display: flex;\n    flex-direction: row;\n    margin-top: 20px;\n  }\n\n  .duration {\n    margin-left: auto;\n  }\n\n  .play-button-area {\n    display: flex;\n    flex-direction: row;\n    justify-content: center;\n    margin: 50px 0;\n  }\n\n  .icon-play {\n    width: 60px;\n    height: 60px;\n  }\n</style>\n\n```\n\n>Script\n```uts\n\n  const audioUrl = 'https://web-ext-storage.dcloud.net.cn/uni-app/ForElise.mp3'\n  export default {\n    data() {\n      return {\n        title: \"innerAudioContext\",\n        currentTime: 0,\n        duration: 100,\n        startTime: 0,\n        buffered: 0,\n        volume: 0.5,\n        isCanplay: false,\n        isPlaying: false,\n        isPaused: true,\n        isPlayEnd: false,\n        _isChanging: false,\n        _audioContext: null as InnerAudioContext | null,\n        // 自动化测试\n        onSeekingTest: false,\n        onSeekedTest: false,\n        onWaitingTest: false\n      }\n    },\n    computed: {\n      position() {\n        return this.isPlayEnd ? 0 : this.currentTime;\n      },\n    },\n    onReady() {\n      this._audioContext = uni.createInnerAudioContext();\n      this._audioContext!.src = audioUrl;\n      this.volume = this._audioContext!.volume;\n      this.onCanplay()\n    },\n    onUnload() {\n      if (this._audioContext != null && this.isPlaying) {\n        this.stop();\n        this._audioContext!.destroy()\n      }\n    },\n    methods: {\n      onCanplay() {\n        this._audioContext!.onCanplay(() => {\n          console.log('音频进入可以播放状态事件');\n          this.isCanplay = true;\n          // 当音频可以播放时,获取缓冲信息\n          this.buffered = this._audioContext!.buffered;\n          this.duration = this._audioContext!.duration || 0;\n        });\n      },\n      onchanging() {\n        this._isChanging = true;\n      },\n      onchange(e) {\n        console.log(e, 'e');\n        let pos = typeof e === \"number\" ? e : e.detail.value;\n        this._audioContext!.seek(pos);\n        this.onSeeking()\n        this.onSeeked()\n        this._isChanging = false;\n      },\n      startTimeInput(e : InputEvent) {\n        let startTimeValue = Number(e.detail.value)\n        this._audioContext!.startTime = startTimeValue;\n        this.onchange(startTimeValue)\n      },\n      setAutoplay() {\n        this._audioContext!.autoplay = !this._audioContext!.autoplay;\n        console.log(this._audioContext!.autoplay, 'autoplay');\n      },\n      setLoop() {\n        this._audioContext!.loop = !this._audioContext!.loop;\n        console.log(this._audioContext!.loop, 'loop');\n      },\n      play() {\n        if (!this.isCanplay) {\n          uni.showToast({\n            title: '音频未进入可以播放状态,请稍后再试'\n          });\n          return;\n        }\n        this.isPlaying = true;\n        this._audioContext!.play();\n        this.isPlayEnd = false;\n        if (this._audioContext!.startTime > 0) {\n          this.onchange(this._audioContext!.startTime)\n        }\n        this._audioContext!.onPlay(() => {\n          this.isPaused = false;\n          console.log('开始播放', this.isPaused);\n        });\n        this.onTimeUpdate()\n        this.onWaiting()\n        this.onError()\n        this.onEnded()\n      },\n      onSeeking() {\n        this._audioContext!.onSeeking(() => {\n          console.log('音频进行 seek 操作事件');\n          this.onSeekingTest = true\n        });\n      },\n      onSeeked() {\n        this._audioContext!.onSeeked(() => {\n          console.log('音频完成 seek 操作事件');\n          this.onSeekedTest = true\n        });\n      },\n      onWaiting() {\n        this._audioContext!.onWaiting(() => {\n          console.log('音频加载中事件');\n          this.onWaitingTest = true\n        });\n      },\n      onTimeUpdate() {\n        this._audioContext!.onTimeUpdate(() => {\n          // console.log('onTimeUpdate:音频播放进度更新事件,currentTime',this._audioContext!.currentTime);\n          if (this._isChanging === true) { return; }\n          this.currentTime = this._audioContext!.currentTime || 0;\n          console.log('currentTime', this.currentTime);\n          if (this.currentTime > this.buffered) {\n            console.log('缓冲不足');\n          }\n        });\n      },\n      increaseVolume() {\n        this.volume = Math.min(this.volume + 0.1, 1);\n        this.volume = parseFloat(this.volume.toFixed(1));\n        console.log('增加音量', this.volume);\n      },\n      decreaseVolume() {\n        this.volume = Math.max(this.volume - 0.1, 0);\n        this.volume = parseFloat(this.volume.toFixed(1));\n        console.log('减少音量', this.volume);\n      },\n      onEnded() {\n        this._audioContext!.onEnded(() => {\n          console.log('播放结束');\n          this.currentTime = 0;\n          this.startTime = 0\n          this.isPlaying = false;\n          this.isPaused = true;\n          this.isPlayEnd = true;\n        });\n      },\n      onError() {\n        this._audioContext!.onError((err) => {\n          console.log('err', err);\n          this.isPlaying = false;\n          this.isPaused = true;\n        });\n      },\n      pause() {\n        this._audioContext!.pause();\n        this._audioContext!.onPause(() => {\n          console.log('音频暂停事件');\n          this.isPaused = true;\n        });\n        this.isPlaying = false;\n      },\n      stop() {\n        console.log('stop');\n        this._audioContext!.stop();\n        this._audioContext!.onStop(() => {\n          // 第一次点停止时,不触发\n          this.isPaused = true;\n          console.log('音频停止事件');\n        });\n        this.isPlaying = false;\n        console.log('stop', this.isPaused);\n      }\n    }\n  }\n\n```\n\n:::"},"canvasToTempFilePath":{"name":"## uni.canvasToTempFilePath(options, componentInstance) @canvastotempfilepath","description":"把当前画布指定区域的内容导出生成指定大小的图片\n","compatibility":"### canvasToTempFilePath 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CanvasToTempFilePathOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| x | number | 否 | - | - | 画布x轴起点(默认0) |\n@| y | number | 否 | - | - | 画布y轴起点(默认0) |\n@| width | number | 否 | - | - | 画布宽度(默认为canvas宽度-x) |\n@| height | number | 否 | - | - | 画布高度(默认为canvas高度-y) |\n@| destWidth | number | 否 | - | - | 输出图片宽度(默认为 width * 屏幕像素密度) |\n@| destHeight | number | 否 | - | - | 输出图片高度(默认为 height * 屏幕像素密度) |\n@| canvasId | string | 是 | - | - | 画布标识,传入 \\<canvas/> 的 canvas-id |\n@| fileType | string | 否 | - | - | 目标文件的类型,默认为 'png' |\n@| quality | number | 否 | - | - | 图片的质量,取值范围为 (0, 1],不在范围内时当作1.0处理 |\n@| success | (result: [CanvasToTempFilePathSuccess](#canvastotempfilepathsuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (result: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) |\n| componentInstance | any | 是 | - | - | - | \n\n#### CanvasToTempFilePathSuccess 的属性值 @canvastotempfilepathsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | - | 导出生成的图片路径 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.canvas.canvasToTempFilePath)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/canvas/canvasToTempFilePath.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=canvasToTempFilePath&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=canvasToTempFilePath&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=canvasToTempFilePath&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=canvasToTempFilePath&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=canvasToTempFilePath&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=canvasToTempFilePath)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=canvasToTempFilePath&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"createCanvasContextAsync":{"name":"## uni.createCanvasContextAsync(options) @createcanvascontextasync","description":"获取CanvasContext对象实例\n","compatibility":"### createCanvasContextAsync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | 4.25 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CreateCanvasContextAsyncOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| id | [string.IDString](/uts/data-type.md#ide-string) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.25\",\"4.25\",\"4.25\"]]}' /> | canvas 元素的 id 属性 |\n@| component | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.25\",\"4.25\",\"4.25\"]]}' /> | 组件或页面实例,限定在什么范围内查找id |\n@| success | (context: [CanvasContext](#canvascontext-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.25\",\"4.25\",\"4.25\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (error: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.25\",\"4.25\",\"4.25\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | () => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.25\",\"4.25\",\"4.25\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### CanvasContext 的方法 @canvascontext-values \n\n#### getContext(type: '2d'): CanvasRenderingContext2D \\| null @getcontext\n\n##### getContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| type | string | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [CanvasRenderingContext2D](/api/canvasrenderingcontext2d.md) | 否 |\n \n\n#### toBlob(callback: CanvasContextToBlobCallback, type?: string, quality?: number): void @toblob\n创造 Blob 对象\n##### toBlob 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (blob: Blob) => void | 是 | - | - | - |\n| type | string | 否 | - | - | - |\n| quality | number | 否 | - | - | - | \n\n\n#### toDataURL(): string @todataurl\n返回一个包含图片展示的 data URI\n##### toDataURL 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | 4.25 | 4.25 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n\n#### createImage(): Image @createimage\n返回一个包含图片展示的 data URI\n##### createImage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | 4.25 | 4.25 |\n\n\n##### 返回值  \n\n| 类型 | 描述 |\n| :- | :- |\n| [Image](#image-values) | 重复的图像源,支持代码包路径和本地临时路径 (本地路径) |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| src | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.25\",\"4.25\",\"x\"]]}' /> | 图片url |\n@| classList | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"x\"]]}' /> | 只读属性 获取当前元素的的 class 属性的动态集合。 |\n@| firstChild | [UniElement](/dom/unielement.md) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素的的第一个子元素,如果元素是无子元素,则返回 null。 |\n@| lastChild | [UniElement](/dom/unielement.md) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素的最后一个子元素,如果没有子元素,则返回 null。 |\n@| parentElement | [UniElement](/dom/unielement.md) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素在 DOM 树中的父元素,如果没有父元素(如未添加到DOM树中),则返回null。 |\n@| previousSibling | [UniElement](/dom/unielement.md) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素的前一个同级元素,没有则返回null。 |\n@| nextElementSibling | [UniElement](/dom/unielement.md) | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取在 DOM 树中紧跟在其后面的同级元素,如果指定的元素为最后一个元素,则返回 null。 |\n@| children | Array\\<[UniElement](/dom/unielement.md)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素包含的子元素的集合 |\n@| tagName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素的标签名 |\n@| nodeName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取当前元素的元素名称 |\n@| dataset | Map\\<string, any> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"x\"]]}' /> | 只读属性 获取元素上自定义数据属性(data-*)的集合 |\n@| attributes | Map\\<string, any> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取元素上所有属性元素的集合 |\n@| style | [CSSStyleDeclaration](/dom/cssstyledeclaration.md) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取元素的CSS样式对象 |\n@| scrollWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取可滚动元素内容的总宽度,仅scroll-view、list-view组件支持,其他组件返回视图宽度 |\n@| scrollHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 获取可滚动元素内容的总高度,仅scroll-view、list-view组件支持,其他组件返回视图高度 |\n@| scrollLeft | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 获取或修改元素滚动条到元素左边的距离像素数,仅scroll-view、list-view组件支持。其他组件返回0 |\n@| scrollTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 获取或修改元素滚动条到元素顶部的距离像素数,仅scroll-view、list-view组件支持。其他组件返回0 |\n@| offsetLeft | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 元素的左边界偏移值 单位px |\n@| offsetTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 元素的顶部边界偏移值 单位px |\n@| offsetWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 元素的布局宽度,宽度包含border、padding的数据值 单位px |\n@| offsetHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"4.25\"]]}' /> | 只读属性 元素的布局高度,高度包含border、padding的数据值 单位px |\n@| ext | Map\\<string, any> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\",\"x\"]]}' /> | 只读属性 扩展属性 |\n###### Image 的方法 @image-values \n\n###### onload(): void \\| null @onload\n图片加载完成事件\n###### onload 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.25 | 4.25 | x |\n\n\n\n###### takeSnapshot(options: TakeSnapshotOptions): void @takesnapshot\n对当前组件进行截图,调用此方法会将当前组件(包含子节点)渲染结果导出成图片。\n成功会返回图片对应的临时文件路径,目前默认png格式\n\n###### takeSnapshot 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| x | 3.93 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **TakeSnapshotOptions** | 是 | - | - | 组件截图的参数对象 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| type | string | 否 | \"file\" | - | 截图导出类型,目前仅支持 'file' 保存到临时文件目录 |\n@| format | string | 否 | \"png\" | - | 截图文件格式,目前仅支持 'png' |\n@| success | (res: [TakeSnapshotSuccess](#takesnapshotsuccess-values)) => void | 否 | - | - | 成功回调函数定义 |\n@| fail | (res: [TakeSnapshotFail](#takesnapshotfail-values)) => void | 否 | - | - | 失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | 完成回调函数定义 | \n\n###### TakeSnapshotSuccess 的属性值 @takesnapshotsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | - | 截图保存的临时文件路径 |\n\n###### TakeSnapshotFail 的属性值 @takesnapshotfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n\n\n###### appendChild(aChild: UniElement): void @appendchild\n将一个元素添加到指定父元素的子元素列表的末尾处。如果将被插入的元素已经存在于当前文档的文档树中,那么将会它从原先的位置移动到新的位置。\n###### appendChild 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| aChild | [UniElement](/dom/unielement.md) | 是 | - | - | 插入子元素对象 | \n\n\n###### insertBefore(newChild: UniElement, refChild?: UniElement \\| null): UniElement \\| null @insertbefore\n在参考元素之前插入一个拥有指定父元素的子元素。如果给定的子元素是对文档中现有元素的引用,insertBefore() 会将其从当前位置移动到新位置。\n###### insertBefore 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| newChild | [UniElement](/dom/unielement.md) | 是 | - | - | 插入子元素对象 |\n| refChild | [UniElement](/dom/unielement.md) | 否 | - | - | 已存在父元素的子元素对象 | \n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n###### setAttribute(key: string, value: string): void @setattribute\n设置指定元素上的某个属性值。如果设置的属性已经存在,则更新该属性值;否则使用指定的名称和值添加一个新的属性。\n###### setAttribute 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 属性名称 |\n| value | string | 是 | - | - | 属性值域 | \n\n\n###### getAttribute(key: string): string \\| null @getattribute\n获取元素指定的属性值,如果指定的属性不存在则返回null。\n###### getAttribute 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| string | 否 |\n \n\n###### hasAttribute(key: string): boolean @hasattribute\n返回改元素是否包含有指定的属性,属性存在则返回true,否则返回false。\n###### hasAttribute 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n###### 返回值  \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### removeAttribute(key: string): void @removeattribute\n从元素中删除一个属性,如果指定的属性不存在,则不做任何操作,也不会产生错误。\n###### removeAttribute 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n\n###### getBoundingClientRect(): DOMRect @getboundingclientrect\n获取元素的大小及其相对于窗口的位置信息。\n###### getBoundingClientRect 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| [DOMRect](/dom/domrect.md) |\n \n\n###### getDrawableContext(): DrawableContext \\| null @getdrawablecontext\n获取组件的绘制对象,仅uvue页面中的 view 组件支持,其它组件不支持则返回null。\n###### getDrawableContext 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| x | 3.9 | 4.11 | 4.25 |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [DrawableContext](/dom/drawablecontext.md) | 否 |\n \n\n###### removeChild(aChild: UniElement): UniElement \\| null @removechild\n从元素中删除一个子元素,返回删除的元素。\n###### removeChild 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| aChild | [UniElement](/dom/unielement.md) | 是 | - | - | 被删除子元素对象 | \n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n###### remove(): void @remove\n把元素对象从它所属的 DOM 树中删除。\n###### remove 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n\n\n###### scrollTo(x: number, y: number): void @scrollto\n使界面滚动到给定元素的指定坐标位置 仅scroll-view、list-view组件支持\n###### scrollTo 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| x | number | 是 | - | - | x轴要滚动到坐标位置(单位px) |\n| y | number | 是 | - | - | y轴要滚动到坐标位置(单位px) | \n\n\n###### scrollBy(x: number, y: number): void @scrollby\n使得元素滚动一段特定距离 仅scroll-view、list-view组件支持\n###### scrollBy 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| x | number | 是 | - | - | x轴要滚动的距离(单位px) |\n| y | number | 是 | - | - | y轴要滚动的距离(单位px) | \n\n\n###### querySelector(selector: string.cssSelectorString): UniElement \\| null @queryselector\n返回文档中与指定选择器或选择器组匹配的第一个 Element对象。如果找不到匹配项,则返回null\n###### querySelector 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| selector | [string.cssSelectorString](/uts/data-type.md#ide-string) | 是 | - | - | CSS 选择器字符串 | \n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n###### querySelectorAll(selector: string.cssSelectorString): UniElement[] \\| null @queryselectorall\n返回与指定的选择器组匹配的文档中的元素列表\n###### querySelectorAll 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| selector | [string.cssSelectorString](/uts/data-type.md#ide-string) | 是 | - | - | CSS 选择器字符串 | \n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Array\\<[UniElement](/dom/unielement.md)\\> | 否 |\n \n\n###### focus(): void @focus\n使元素获取焦点 仅input、Textarea组件支持\n###### focus 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n\n\n###### blur(): void @blur\n使元素丢失焦点 仅input、Textarea组件支持\n###### blur 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.0 | 4.0 | 4.11 | 4.25 |\n\n\n\n###### getAndroidView(): View \\| null @getandroidview\n获取元素android原生view 可能返回null\n###### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.25 | x |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| View | 否 |\n \n\n###### getAndroidActivity(): Activity \\| null @getandroidactivity\n获取元素android原生activity 可能返回null\n###### getAndroidActivity 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.25 | x |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Activity | 否 |\n \n\n###### getPage(): UniPage \\| null @getpage\n获取元素所属的页面对象\n###### getPage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniPage](#unipage-values) | 否 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| route | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由地址 |\n@| options | UTSJSONObject | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"},{\"title\":\"iOS uni-app x UTS 插件\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\",\"4.31\"]]}' /> | 页面的路由参数信息 |\n@| vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n@| $vm | ComponentPublicInstance | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.31\",\"4.31\",\"4.31\"]]}' /> | UniPage vue 实例对象 |\n###### UniPage 的方法 @unipage-values \n\n###### getPageStyle(): UTSJSONObject @getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n###### getPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n\n###### setPageStyle(style: UTSJSONObject): void @setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性\n###### setPageStyle 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n###### getParentPage(): UniPage \\| null @getparentpage\n获取所属父页面\n###### getParentPage 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniPage](#unipage-values) | 否 |\n \n\n###### getDialogPages(): UniPage[\\] @getdialogpages\n获取当前页面的 dialog 子页面集合\n###### getDialogPages 兼容性 \n| Web | Android | iOS | iOS uni-app x UTS 插件 |\n| :- | :- | :- | :- |\n| 4.31 | 4.31 | 4.31 | 4.31 |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[UniPage](#unipage-values)\\> |\n \n\n###### getElementById(id: string.IDString \\| string): UniElement \\| null @getelementbyid\n返回一个匹配特定 ID 的元素, 如果不存在,返回 null。\\\n如果需要获取指定的节点类型,需要使用 as 进行类型转换。\\\nID 区分大小写,且应该是唯一的。如果存在多个匹配的元素,则返回第一个匹配的元素。\n\n###### getElementById 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| id | [string.IDString](/uts/data-type.md#ide-string) \\| string | 是 | - | - | - | \n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n###### getAndroidView(): View \\| null @getandroidview\n返回 android 平台页面根 view\n\n###### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | x |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| View | 否 |\n \n\n###### getHTMLElement(): UniElement \\| null @gethtmlelement\n返回页面 HTML Element 对象\n\n###### getHTMLElement 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.31 | x | x |\n\n\n###### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) | 否 |\n \n\n###### ~~$setPageStyle(style: UTSJSONObject): void~~ @$setpagestyle\n设置当前页面样式 \\\n支持 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n###### $setPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| style | UTSJSONObject | 是 | - | - | - | \n\n\n###### ~~$getPageStyle(): UTSJSONObject~~ @$getpagestyle\n获取当前页面样式 \\\n包含 pages.json 页面下的 style 节点属性和根节点 globalStyle 属性  **已废弃,仅为了向下兼容保留**\n###### $getPageStyle 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.13 | 4.13 | 4.13 |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| UTSJSONObject |\n \n \n \n\n#### createPath2D(): Path2D @createpath2d\n返回一个包含图片展示的 data URI\n##### createPath2D 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | 4.25 | 4.25 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [Path2D](/api/path2d.md) |\n \n\n#### requestAnimationFrame(callback: RequestAnimationFrameCallback): number; @requestanimationframe\n在下一次重绘之前,调用用户提供的回调函数\n##### requestAnimationFrame 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | 4.25 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (time: number) => void | 是 | - | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| number |\n \n\n#### cancelAnimationFrame(taskId: number): void; @cancelanimationframe\n取消一个先前通过调用 uni.requestAnimationFrame() 方法添加到计划中的动画帧请求\n##### cancelAnimationFrame 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.25 | 4.25 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| taskId | number | 是 | - | - | - | \n\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.canvas.createCanvasContextAsync)"},"getLocation":{"name":"## uni.getLocation(options) @getlocation","description":"获取当前的地理位置、速度","compatibility":"### getLocation 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetLocationOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| provider | string | 否 | system | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9.0\",\"4.11\"]]}' /> | 定位服务提供商,通过 [uni.getProvider](https://doc.dcloud.net.cn/uni-app-x/api/provider.html) 获取,目前支持系统定位(system)、腾讯定位(tencent)<br/>腾讯定位是4.25版本后支持的;<br/>web端暂不支持provider机制; |\n@| type | string | 否 | wgs84 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标,web端需配置定位 SDK 信息才可支持 gcj02; |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| wgs84 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | wgs84坐标系,系统定位默认取值wgs84,系统定位仅支持wgs84坐标系 |\n@@| gcj02 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | gcj02坐标系,腾讯定位默认取值gcj02,腾讯定位仅支持gcj02坐标系 |\n@| altitude | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 |\n@| geocode | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9.0\",\"4.11\"]]}' /> | 传入 true 会解析地址;<br/>使用系统定位时平台差异:iOS支持逆地理编码,Android不支持; |\n@| highAccuracyExpireTime | number | 否 | 3000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9.0\",\"4.11\"]]}' /> | 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 |\n@| isHighAccuracy | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 开启高精度定位 |\n@| success | (result: [GetLocationSuccess](#getlocationsuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IGetLocationFail](#igetlocationfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### GetLocationSuccess 的属性值 @getlocationsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| latitude | number | 是 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 纬度,浮点数,范围为-90~90,负数表示南纬 |\n| longitude | number | 是 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 经度,范围为-180~180,负数表示西经 |\n| speed | number | 是 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 速度,浮点数,单位m/s |\n| accuracy | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 位置的精确度 |\n| altitude | number | 是 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 高度,单位 m |\n| verticalAccuracy | number | 是 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 垂直精度,单位 m(Android 无法获取,返回 0) |\n| horizontalAccuracy | number | 是 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 水平精度,单位 m |\n| address | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 地址信息 |\n\n#### IGetLocationFail 的属性值 @igetlocationfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1505003 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 系统定位未开启,请在系统设置中开启系统定位 |\n@| 1505004 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 应用定位权限未开启 |\n@| 1505023 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 不支持逆地理编码 |\n@| 1505600 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 超时 |\n@| 1505601 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 不支持的定位类型 |\n@| 1505602 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 捕获定位失败 |\n@| 1505603 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 逆地理编码捕获失败 |\n@| 1505604 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 服务供应商获取失败 |\n@| 1505605 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 未通过配置预校验,通常是腾讯定位 api key 配置错误 |\n@| 1505607 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 腾讯定位只支持GCJ-02 |\n@| 1505700 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 不支持逆地理编码 |\n@| 1505701 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 没有找到具体的定位引擎(GPS_PROVIDER,NETWORK_PROVIDER,PASSIVE_PROVIDER等),请确定系统定位是否开启 |\n@| 1505800 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.25\",\"4.25\"]]}' /> | 应用高精度定位权限未开启 |\n@| ~~1505026~~ | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 捕获定位失败  **从4.25开始已经废弃** |\n@| ~~1505025~~ | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 逆地理编码捕获失败  **从4.25开始已经废弃** |\n@| ~~1505024~~ | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 没有找到具体的定位引擎(GPS_PROVIDER,NETWORK_PROVIDER,PASSIVE_PROVIDER等),请定位开关是否已打开  **从4.25开始已经废弃** |\n@| ~~1505022~~ | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 不支持的定位类型  **从4.25开始已经废弃** |\n@| ~~1505021~~ | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 超时  **从4.25开始已经废弃** |\n@| ~~1505005~~ | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9.0\",\"4.11\"]]}' /> | 缺失高精度权限授权(iOS特有)  **从4.25开始已经废弃** |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.location.getLocation)\n- [参见uni-app相关文档](http://uniapp.dcloud.io/api/location/location?id=getlocation)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getLocation&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getLocation&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getLocation&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getLocation&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getLocation&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getLocation)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getLocation&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-location/get-location\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1;\">\r\n  <!-- #endif -->\r\n    <page-head :title=\"title\"></page-head>\r\n    <view style=\"padding: 4px\">\r\n      <text class=\"hello-text\">\r\n        定位功能默认调用操作系统定位API实现, 也支持腾讯定位。\\n\r\n        部分手机因gms兼容不好可能导致无法使用系统定位, gcj国标、逆地理信息等功能需调用内置腾讯定位。</text>\r\n    </view>\r\n\r\n    <view class=\"uni-padding-wrap uni-common-mt\">\r\n      <!-- #ifdef APP -->\r\n      <view class=\"uni-list-cell-db\">定位服务商provider(如系统定位,腾讯定位等)</view>\r\n      <view class=\"uni-list\" style=\"margin-bottom: 20px\">\r\n        <radio-group @change=\"radioChangePV\">\r\n          <radio class=\"uni-list-cell uni-list-cell-pd\" v-for=\"(item, index) in providerList\" :key=\"item.id\"\r\n            :class=\"index < providerList.length - 1 ? 'uni-list-cell-line' : ''\" :value=\"item.id\"\r\n            :checked=\"index === currentProvider\">\r\n            {{ item.name }}\r\n          </radio>\r\n        </radio-group>\r\n      </view>\r\n      <!-- #endif -->\r\n      <view class=\"uni-list-cell-db\">定位类型</view>\r\n      <view class=\"uni-list\">\r\n        <radio-group @change=\"radioChange\">\r\n          <radio class=\"uni-list-cell uni-list-cell-pd\" v-for=\"(item, index) in items\" :key=\"item.value\"\r\n            :class=\"index < items.length - 1 ? 'uni-list-cell-line' : ''\" :value=\"item.value\"\r\n            :checked=\"index === current\">\r\n            {{ item.name }}\r\n          </radio>\r\n        </radio-group>\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-pd\" style=\"margin-top: 20px\">\r\n        <view class=\"uni-list-cell-db\">高度信息</view>\r\n        <switch :checked=\"altitudeSelect\" @change=\"altitudeChange\" />\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-pd\">\r\n        <view class=\"uni-list-cell-db\">开启高精度定位</view>\r\n        <switch :checked=\"isHighAccuracySelect\" @change=\"highAccuracySelectChange\" />\r\n      </view>\r\n      <view class=\"uni-list-cell uni-list-cell-pd\">\r\n        <view class=\"uni-list-cell-db\">是否解析地址信息</view>\r\n        <switch :checked=\"geocodeSelect\" @change=\"geocodeChange\" />\r\n      </view>\r\n      <text>{{ exeRet }}</text>\r\n      <view class=\"uni-btn-v\">\r\n        <button class=\"uni-btn\" type=\"default\" @tap=\"getLocationTap\">\r\n          获取定位\r\n        </button>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\n```\n\n>Script\n```uts\n\r\n  type GetLocationType = 'wgs84' | 'gcj02'\r\n  export type LocationItem = { id : string, name : string, provider ?: UniProvider }\r\n  export type ItemType = { value : GetLocationType, name : GetLocationType }\r\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'get-location',\r\n        altitudeSelect: false,\r\n        isHighAccuracySelect: false,\r\n        geocodeSelect: false,\r\n        exeRet: '',\r\n        items: [\r\n          {\r\n            value: 'wgs84',\r\n            name: 'wgs84'\r\n          },\r\n          {\r\n            value: 'gcj02',\r\n            name: 'gcj02'\r\n          }\r\n        ] as ItemType[],\r\n        providerList: [] as LocationItem[],\r\n        current: 0,\r\n        currentProvider: 0,\r\n        jest_provider: '',\r\n        jest_type: 'wgs84' as GetLocationType,\r\n        jest_isAltitude: false,\r\n        jest_isGeocode: false,\r\n        jest_isHighAccuracy: false,\r\n        jest_altitude: -1000,\r\n        jest_longitude: 200,\r\n        jest_latitude: 100,\r\n        jest_address: '',\r\n        jest_errCode: 0,\r\n        jest_complete: false\r\n      }\r\n    },\r\n    onLoad: function () {\r\n      // #ifdef APP\r\n      this.getProvider()\r\n      // #endif\r\n    },\r\n    methods: {\r\n      getProvider() {\r\n        // #ifdef APP\r\n\r\n        let provider = uni.getProviderSync({\r\n          service: \"location\",\r\n        } as GetProviderSyncOptions)\r\n        console.log(provider)\r\n        provider.providerObjects.forEach((value : UniProvider) => {\r\n          var currentProvider = value\r\n          if (value.id == 'system') {\r\n            currentProvider = value as UniLocationSystemProvider\r\n          } else if (value.id == 'tencent') {\r\n            currentProvider = value as UniLocationTencentProvider\r\n          }\r\n          this.providerList.push({\r\n            name: currentProvider.description,\r\n            id: currentProvider.id,\r\n            provider: currentProvider\r\n          } as LocationItem);\r\n        })\r\n\r\n        this.providerList.forEach((value, index) => {\r\n          if (value.id == \"system\") {\r\n            this.currentProvider = index\r\n          }\r\n        })\r\n        // #endif\r\n      },\r\n      altitudeChange: function (e : UniSwitchChangeEvent) {\r\n        this.altitudeSelect = e.detail.value\r\n      },\r\n      geocodeChange: function (e : UniSwitchChangeEvent) {\r\n        this.geocodeSelect = e.detail.value\r\n      },\r\n      highAccuracySelectChange: function (e : UniSwitchChangeEvent) {\r\n        this.isHighAccuracySelect = e.detail.value\r\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      radioChangePV(e : UniRadioGroupChangeEvent) {\r\n        for (let i = 0; i < this.providerList.length; i++) {\r\n          if (this.providerList[i].id === e.detail.value) {\r\n            this.currentProvider = i;\r\n            break;\r\n          }\r\n        }\r\n        if (e.detail.value == \"system\") {\r\n          this.current = 0\r\n        } else if (e.detail.value == \"tencent\") {\r\n          this.current = 1\r\n        }\r\n      },\r\n      getLocationTap: function () {\r\n        // #ifdef APP\r\n        if (this.providerList.length == 0) {\r\n          uni.showToast({\r\n            title: '未获取到provider,请确定基座中包含location功能',\r\n            icon: \"error\"\r\n          })\r\n          console.log(\"未获取到provider,请确定基座中包含location功能\")\r\n          return\r\n        }\r\n        // #endif\r\n        uni.showLoading({\r\n          title: '定位中'\r\n        })\r\n        uni.getLocation(({\r\n          // #ifdef APP\r\n          provider: this.providerList[this.currentProvider].id,\r\n          // #endif\r\n          type: this.items[this.current].value,\r\n          altitude: this.altitudeSelect,\r\n          isHighAccuracy: this.isHighAccuracySelect,\r\n          geocode: this.geocodeSelect,\r\n          success: (res : any) => {\r\n            uni.hideLoading()\r\n            this.exeRet = JSON.stringify(res)\r\n          },\r\n          fail: (res : any) => {\r\n            uni.hideLoading()\r\n            this.exeRet = JSON.stringify(res)\r\n          },\r\n          complete: (res : any) => {\r\n            uni.hideLoading()\r\n            this.exeRet = JSON.stringify(res)\r\n          }\r\n        }));\r\n      },\r\n\r\n      // 仅用于自动化测试\r\n      jestGetLocation() {\r\n        this.jest_complete = false\r\n        this.jest_errCode = 0\r\n        uni.getLocation(({\r\n          // #ifdef APP\r\n          provider: this.jest_provider,\r\n          // #endif\r\n          type: this.jest_type,\r\n          altitude: this.jest_isAltitude,\r\n          isHighAccuracy: this.jest_isHighAccuracy,\r\n          geocode: this.jest_isGeocode,\r\n          success: (res) => {\r\n            if (res.address != null) {\r\n              this.jest_address = res.address!\r\n            }\r\n            this.jest_longitude = res.longitude\r\n            this.jest_latitude = res.latitude\r\n            this.jest_altitude = res.altitude\r\n            this.jest_complete = true\r\n          },\r\n          fail: (err) => {\r\n            this.jest_errCode = err.errCode\r\n            this.jest_complete = true\r\n          }\r\n        }));\r\n      }\r\n    }\r\n  }\r\n\n```\n\n:::"},"openLocation":{"name":"## uni.openLocation(options) @openlocation","description":"使用地图查看位置\n","compatibility":"### openLocation 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **OpenLocationOptions** | 是 | - | - | uni.openLocation |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| latitude | number | 是 | - | - | 纬度,范围为-90~90,负数表示南纬 |\n@| longitude | number | 是 | - | - | 经度,范围为-180~180,负数表示西经 |\n@| scale | number | 否 | - | - | 缩放比例,范围5~18,默认为18 |\n@| name | string | 否 | - | - | 位置名称 |\n@| address | string | 否 | - | - | 地址的详细说明 |\n@| success | (res: OpenLocationSuccess) => void | 否 | - | - | uni.openLocation成功回调函数定义 |\n@| fail | (res: [IOpenLocationError](#iopenlocationerror-values)) => void | 否 | - | - | uni.openLocation失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.openLocation完成回调函数定义 | \n\n#### IOpenLocationError 的属性值 @iopenlocationerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | - |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.location.openLocation)\n - [参见uni-app相关文档](https://uniapp.dcloud.io/api/location/open-location.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=openLocation&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=openLocation&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=openLocation&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=openLocation&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=openLocation&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=openLocation)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=openLocation&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/open-location/open-location.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/open-location/open-location\n\n>Template\n```vue\n<template>\n  <view>\n    <page-head :title=\"title\"></page-head>\n    <view class=\"uni-common-mt\">\n      <form @submit=\"openLocation\">\n        <view class=\"uni-list\">\n          <view class=\"uni-list-cell\">\n            <view class=\"uni-list-cell-left\">\n              <view class=\"uni-label\">经度</view>\n            </view>\n            <view class=\"uni-list-cell-db\">\n              <input class=\"uni-input\" type=\"text\" :disabled=\"true\" value=\"116.39747\" name=\"longitude\" />\n            </view>\n          </view>\n          <view class=\"uni-list-cell\">\n            <view class=\"uni-list-cell-left\">\n              <view class=\"uni-label\">纬度</view>\n            </view>\n            <view class=\"uni-list-cell-db\">\n              <input class=\"uni-input\" type=\"text\" :disabled=\"true\" value=\"39.9085\" name=\"latitude\" />\n            </view>\n          </view>\n          <view class=\"uni-list-cell\">\n            <view class=\"uni-list-cell-left\">\n              <view class=\"uni-label\">位置名称</view>\n            </view>\n            <view class=\"uni-list-cell-db\">\n              <input class=\"uni-input\" type=\"text\" :disabled=\"true\" value=\"天安门\" name=\"name\" />\n            </view>\n          </view>\n          <view class=\"uni-list-cell\">\n            <view class=\"uni-list-cell-left\">\n              <view class=\"uni-label\">详细位置</view>\n            </view>\n            <view class=\"uni-list-cell-db\">\n              <input class=\"uni-input\" type=\"text\" :disabled=\"true\" value=\"北京市东城区东长安街\" name=\"address\" />\n            </view>\n          </view>\n        </view>\n        <view class=\"uni-padding-wrap\">\n          <view class=\"tips\">注意:需要正确配置地图服务商的Key才能正常显示位置</view>\n          <view class=\"uni-btn-v uni-common-mt\">\n            <button type=\"primary\" formType=\"submit\">查看位置</button>\n          </view>\n        </view>\n      </form>\n    </view>\n  </view>\n</template>\n\n\n<style>\n  .uni-list-cell-left {\n    padding: 0 30rpx;\n  }\n\n  .tips {\n    font-size: 12px;\n    margin-top: 15px;\n    opacity: .8;\n  }\n</style>\n\n```\n\n>Script\n```uts\n\n  export default {\n    data() {\n      return {\n        title: 'openLocation'\n      }\n    },\n    methods: {\n      openLocation: function (e) {\n        console.log(e)\n        var value = e.detail.value\n        uni.openLocation({\n          longitude: Number(value.longitude),\n          latitude: Number(value.latitude),\n          name: value.name,\n          address: value.address\n        })\n      }\n    }\n  }\n\n```\n\n:::"},"chooseLocation":{"name":"## uni.chooseLocation(options) @chooselocation","description":"打开地图选择位置。","compatibility":"### chooseLocation 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ChooseLocationOptions** | 是 | - | - | uni.chooseLocation |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| latitude | number | 否 | - | - | 目标地纬度 |\n@| longitude | number | 否 | - | - | 目标地经度 |\n@| keyword | string | 否 | - | - | 搜索关键字 |\n@| success | (res: [ChooseLocationSuccess](#chooselocationsuccess-values)) => void | 否 | - | - | uni.chooseLocation成功回调函数定义 |\n@| fail | (res: [IChooseLocationError](#ichooselocationerror-values)) => void | 否 | - | - | uni.chooseLocation失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.chooseLocation完成回调函数定义 | \n\n#### ChooseLocationSuccess 的属性值 @chooselocationsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| name | string | 是 | - | - | 位置名称 |\n| address | string | 是 | - | - | 详细地址 |\n| latitude | number | 是 | - | - | 纬度,浮点数,范围为-90~90,负数表示南纬 |\n| longitude | number | 是 | - | - | 经度,范围为-180~180,负数表示西经 |\n\n#### IChooseLocationError 的属性值 @ichooselocationerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | - |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.location.chooseLocation)\n - [参见uni-app相关文档](http://localhost:8080/api/location/location.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=chooseLocation&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=chooseLocation&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=chooseLocation&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=chooseLocation&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=chooseLocation&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=chooseLocation)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=chooseLocation&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/choose-location/choose-location.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/choose-location/choose-location\n\n>Template\n```vue\n<template>\n  <view>\n    <page-head :title=\"title\"></page-head>\n    <view class=\"uni-padding-wrap\">\n      <view style=\"background:#FFFFFF; padding:40rpx;\">\n        <view class=\"uni-hello-text uni-center\">当前位置信息</view>\n        <block v-if=\"hasLocation === false\">\n          <view class=\"uni-h2 uni-center uni-common-mt\">未选择位置</view>\n        </block>\n        <block v-if=\"hasLocation === true\">\n          <view class=\"uni-hello-text uni-center\" style=\"margin-top:10px;\">\n            {{locationAddress}}\n          </view>\n          <view class=\"uni-h2 uni-center uni-common-mt\">\n            <text>E: {{location.longitude[0]}}°{{location.longitude[1]}}′</text>\n            <text>\\nN: {{location.latitude[0]}}°{{location.latitude[1]}}′</text>\n          </view>\n        </block>\n      </view>\n      <view class=\"uni-btn-v\">\n        <view class=\"tips\">注意:需要正确配置地图服务商的Key才能正常选择位置</view>\n        <button type=\"primary\" @tap=\"chooseLocation\">选择位置</button>\n        <button @tap=\"clear\">清空</button>\n      </view>\n    </view>\n  </view>\n</template>\n\n\n<style>\n  .page-body-info {\n    padding-bottom: 0;\n    height: 440rpx;\n  }\n\n  .tips {\n    font-size: 12px;\n    margin-top: 15px;\n    opacity: .8;\n  }\n</style>\n\n```\n\n>Script\n```uts\n\n  function formatLocation(longitude, latitude) {\n    if (typeof longitude === 'string' && typeof latitude === 'string') {\n      longitude = parseFloat(longitude)\n      latitude = parseFloat(latitude)\n    }\n    longitude = longitude.toFixed(2)\n    latitude = latitude.toFixed(2)\n    return {\n      longitude: longitude.toString().split('.'),\n      latitude: latitude.toString().split('.')\n    }\n  }\n  export default {\n    data() {\n      return {\n        title: 'chooseLocation',\n        hasLocation: false,\n        location: {},\n        locationAddress: ''\n      }\n    },\n    methods: {\n      chooseLocation: function () {\n        uni.chooseLocation({\n          success: (res) => {\n            console.log(res, 123)\n            this.hasLocation = true\n            this.location = formatLocation(res.longitude, res.latitude)\n            this.locationAddress = res.address\n          }\n        })\n      },\n      clear: function () {\n        this.hasLocation = false\n      }\n    }\n  }\n\n```\n\n:::"},"getStorageInfo":{"name":"## uni.getStorageInfo(options) @getstorageinfo","description":"uni.getStorageInfo函数定义\n异步获取当前 storage 的相关信息。\n","compatibility":"### getStorageInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetStorageInfoOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [GetStorageInfoSuccess](#getstorageinfosuccess-values)) => void | 否 | - | - | uni.getStorageInfo成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | uni.getStorageInfo失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.getStorageInfo完成回调函数定义 | \n\n#### GetStorageInfoSuccess 的属性值 @getstorageinfosuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| keys | Array\\<string\\> | 是 | - | - | 当前 storage 中所有的 key |\n| currentSize | number | 是 | - | - | 当前占用的空间大小, 单位:kb |\n| limitSize | number | 是 | - | - | 限制的空间大小, 单位:kb |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageInfo)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfo)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getStorageInfo&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getStorageInfo&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getStorageInfo&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getStorageInfo&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getStorageInfo&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getStorageInfo)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getStorageInfo&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getStorageInfoSync":{"name":"## uni.getStorageInfoSync() @getstorageinfosync","description":"uni.getStorageInfoSync函数定义\n同步获取当前 storage 的相关信息。\n","compatibility":"### getStorageInfoSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 | 描述 |\n| :- | :- |\n| **GetStorageInfoSuccess** | uni.getStorageInfo成功回调参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| keys | Array\\<string\\> | 是 | - | - | 当前 storage 中所有的 key |\n@| currentSize | number | 是 | - | - | 当前占用的空间大小, 单位:kb |\n@| limitSize | number | 是 | - | - | 限制的空间大小, 单位:kb | \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageInfoSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfosync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getStorageInfoSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getStorageInfoSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getStorageInfoSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getStorageInfoSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getStorageInfoSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getStorageInfoSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getStorageInfoSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getStorage":{"name":"## uni.getStorage(options) @getstorage","description":"uni.getStorage函数定义\n从本地存储中异步获取指定 key 对应的内容。\n","compatibility":"### getStorage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetStorageOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| key | string | 是 | - | - | 本地存储中的指定的 key |\n@| success | (res: [GetStorageSuccess](#getstoragesuccess-values)) => void | 否 | - | - | uni.getStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | uni.getStorage失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.getStorage完成回调函数定义 | \n\n#### GetStorageSuccess 的属性值 @getstoragesuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | any | 否 | - | - | key 对应的内容 |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getStorage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getStorage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getStorage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getStorage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getStorage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getStorage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getStorage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"getStorageSync":{"name":"## uni.getStorageSync(key) @getstoragesync","description":"uni.getStorageSync函数定义\n从本地存储中同步获取指定 key 对应的内容。\n","compatibility":"### getStorageSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 本地存储中的指定的 key | \n","returnValue":"### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| any | 否 |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.getStorageSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getStorageSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getStorageSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getStorageSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getStorageSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getStorageSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getStorageSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getStorageSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"setStorage":{"name":"## uni.setStorage(options) @setstorage","description":"uni.setStorage函数定义\n将数据存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。\n","compatibility":"### setStorage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetStorageOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| key | string | 是 | - | - | 本地存储中的指定的 key |\n@| data | any | 是 | - | - | 需要存储的内容,只支持能通过 JSON.stringify 序列化的对象 |\n@| success | (res: SetStorageSuccess) => void | 否 | - | - | uni.setStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | uni.setStorage失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.setStorage完成回调函数定义 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.setStorage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setStorage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setStorage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setStorage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setStorage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setStorage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setStorage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setStorage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"setStorageSync":{"name":"## uni.setStorageSync(key, data) @setstoragesync","description":"uni.setStorageSync函数定义\n将 data 存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。\n","compatibility":"### setStorageSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 本地storage存储中的指定的 key |\n| data | any | 是 | - | - | 需要存储的内容,只支持能通过 JSON.stringify 序列化的对象 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.setStorageSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=setStorageSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=setStorageSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=setStorageSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=setStorageSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=setStorageSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=setStorageSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=setStorageSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"removeStorage":{"name":"## uni.removeStorage(options) @removestorage","description":"uni.removeStorage函数定义\n从本地存储中异步移除指定 key。\n","compatibility":"### removeStorage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **RemoveStorageOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| key | string | 是 | - | - | 本地存储中的指定的 key |\n@| success | (res: RemoveStorageSuccess) => void | 否 | - | - | uni.removeStorage成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | uni.removeStorage失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.removeStorage完成回调函数定义 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.removeStorage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#removestorage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=removeStorage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=removeStorage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=removeStorage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=removeStorage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=removeStorage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=removeStorage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=removeStorage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"removeStorageSync":{"name":"## uni.removeStorageSync(key) @removestoragesync","description":"uni.removeStorageSync函数定义\n从本地存储中同步移除指定 key。\n","compatibility":"### removeStorageSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| key | string | 是 | - | - | 本地存储中的指定的 key | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.removeStorageSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=removeStorageSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=removeStorageSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=removeStorageSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=removeStorageSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=removeStorageSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=removeStorageSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=removeStorageSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"clearStorage":{"name":"## uni.clearStorage(option?) @clearstorage","description":"uni.clearStorage函数定义\n清除本地数据存储。\n","compatibility":"### clearStorage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **ClearStorageOptions** | 否 | - | - | uni.removeStorage参数定义 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: ClearStorageSuccess) => void | 否 | - | - | uni.clearStorage 成功回调函数定义 |\n@| fail | (res: [UniError](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror)) => void | 否 | - | - | uni.clearStorage 失败回调函数定义 |\n@| complete | (res: any) => void | 否 | - | - | uni.clearStorage 完成回调函数定义 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.clearStorage)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=clearStorage&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=clearStorage&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=clearStorage&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=clearStorage&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=clearStorage&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=clearStorage)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=clearStorage&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"clearStorageSync":{"name":"## uni.clearStorageSync() @clearstoragesync","description":"uni.clearStorageSync函数定义\n清除本地数据存储。\n","compatibility":"### clearStorageSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n","param":"","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.storage.storage.clearStorageSync)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=clearStorageSync&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=clearStorageSync&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=clearStorageSync&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=clearStorageSync&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=clearStorageSync&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=clearStorageSync)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=clearStorageSync&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"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\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/storage/storage\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-common-mt\">\r\n        <view class=\"uni-list\">\r\n          <view class=\"uni-list-cell uni-list-cell-line\">\r\n            <view class=\"uni-list-cell-left\">\r\n              <view class=\"uni-label\">key</view>\r\n            </view>\r\n            <view class=\"uni-list-cell-db\">\r\n              <input class=\"uni-input\" type=\"text\" placeholder=\"请输入key\" name=\"key\" :value=\"key\" maxlength=\"-1\"\r\n                @input=\"keyChange\" />\r\n            </view>\r\n          </view>\r\n          <view class=\"uni-list-cell\">\r\n            <view class=\"uni-list-cell-left\">\r\n              <view class=\"uni-label\">value</view>\r\n            </view>\r\n            <view class=\"uni-list-cell-db\">\r\n              <input class=\"uni-input\" type=\"text\" placeholder=\"请输入value\" name=\"data\"\r\n                :value=\"typeof data === 'string' ? data : JSON.stringify(data)\" maxlength=\"-1\" @input=\"dataChange\" />\r\n            </view>\r\n          </view>\r\n        </view>\r\n        <view class=\"uni-padding-wrap\">\r\n          <view class=\"uni-btn-v\">\r\n            <button class=\"uni-btn btn-getStorageInfoASync\" type=\"primary\" @tap=\"getStorageInfo\">\r\n              获取存储概述信息-异步\r\n            </button>\r\n            <button class=\"uni-btn btn-getStorageInfoSync\" @tap=\"getStorageInfoSync\">\r\n              获取存储概述信息-同步\r\n            </button>\r\n          </view>\r\n          <text>{{ storageInfo }}</text>\r\n          <view class=\"uni-flex uni-row\">\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"strMock\">\r\n              填充字符串\r\n            </button>\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"complexMock\">\r\n              填充复杂对象\r\n            </button>\r\n          </view>\r\n          <view class=\"uni-flex uni-row\">\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"numberMock\">\r\n              填充整型\r\n            </button>\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"floatMock\">\r\n              填充浮点型\r\n            </button>\r\n          </view>\r\n          <view class=\"uni-flex uni-row\">\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"jsonLikeMock\">\r\n              填充json字符串\r\n            </button>\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"longLikeMock\">\r\n              填充整数字符串\r\n            </button>\r\n          </view>\r\n          <view class=\"uni-flex uni-row\">\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"floatLikeMock\">\r\n              填充浮点字符串\r\n            </button>\r\n            <button type=\"default\" style=\"width:50%\" @tap=\"negativeLikeMock\">\r\n              填充负数字符串\r\n            </button>\r\n          </view>\r\n          <view class=\"uni-flex uni-row\">\r\n            <button type=\"default\" class=\"uni-btn btn-complexStaticTest\" style=\"width:100%\" @tap=\"complexStaticTest\">\r\n              字面量读写测试\r\n            </button>\r\n          </view>\r\n        </view>\r\n        <view class=\"uni-padding-wrap\">\r\n          <view class=\"uni-btn-v\">\r\n            <button type=\"primary\" class=\"uni-btn btn-setstorageAsync\" @tap=\"setStorage\">\r\n              存储数据-异步\r\n            </button>\r\n            <button class=\"uni-btn btn-getstorageAsync\" @tap=\"getStorage\">读取数据-异步</button>\r\n            <button class=\"uni-btn btn-removeStorageInfoASync\" @tap=\"removeStorage\">移除数据-异步</button>\r\n            <button class=\"uni-btn btn-clearStorageInfoASync\" @tap=\"clearStorage\">清理数据-异步</button>\r\n          </view>\r\n\r\n          <view class=\"uni-btn-v\">\r\n            <button type=\"primary\" class=\"uni-btn btn-setstorageSync\" @tap=\"setStorageSync\">\r\n              存储数据-同步\r\n            </button>\r\n            <button class=\"uni-btn btn-getstorageSync\" @tap=\"getStorageSync\">读取数据-同步</button>\r\n            <button class=\"uni-btn btn-removeStorageInfoSync\" @tap=\"removeStorageSync\">\r\n              移除数据-同步\r\n            </button>\r\n            <button class=\"uni-btn btn-clearStorageInfoSync\" @tap=\"clearStorageSync\">\r\n              清理数据-同步\r\n            </button>\r\n          </view>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'get/set/clearStorage',\r\n        key: '',\r\n        data: '' as any,\r\n        apiGetData: '' as any | null,\r\n        storageInfo: '',\r\n        staticComplexRet: false\r\n      }\r\n    },\r\n    methods: {\r\n      getStorageInfo() {\r\n        uni.getStorageInfo({\r\n          success: (res) => {\r\n            this.apiGetData = res\r\n            this.storageInfo = JSON.stringify(res)\r\n          },\r\n        })\r\n      },\r\n      getStorageInfoSync() {\r\n        try {\r\n          const res = uni.getStorageInfoSync()\r\n          this.apiGetData = res\r\n          this.storageInfo = JSON.stringify(res)\r\n        } catch (e) {\r\n          // error\r\n          console.log(e)\r\n        }\r\n      },\r\n      jsonLikeMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = JSON.stringify({\r\n          name: \"james\",\r\n          age: 12,\r\n          from: \"american\"\r\n        });\r\n\r\n      },\r\n      longLikeMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = \"1234567890\"\r\n      },\r\n      floatLikeMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = \"321456.1234567890\"\r\n      },\r\n      negativeLikeMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = \"-321456\"\r\n      },\r\n      strMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = '测试字符串数据,长度为16个字符'\r\n      },\r\n      complexStaticTest() {\r\n        uni.setStorageSync(\"key_complexStaticMock\", {\r\n          name: \"张三\",\r\n          age: 12\r\n        })\r\n        let savedData = uni.getStorageSync(\"key_complexStaticMock\")\r\n        this.staticComplexRet = false\r\n        if (savedData instanceof UTSJSONObject) {\r\n          if ((savedData as UTSJSONObject).getNumber('age') == 12) {\r\n            this.staticComplexRet = true\r\n            uni.showToast({\r\n              icon: 'success',\r\n              title: '测试通过'\r\n            })\r\n          }\r\n        }\r\n      },\r\n      complexMock() {\r\n        this.key = 'key_' + Math.random()\r\n        let jsonObj = {\r\n          name: '张三',\r\n          age: 12,\r\n          classMate: [\r\n            {\r\n              id: 1001,\r\n              name: '李四',\r\n            },\r\n            {\r\n              id: 1002,\r\n              name: 'jack ma',\r\n            },\r\n          ],\r\n        }\r\n        this.data = jsonObj\r\n      },\r\n      numberMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = 10011\r\n      },\r\n      floatMock() {\r\n        this.key = 'key_' + Math.random()\r\n        this.data = 3.1415926535893384626\r\n      },\r\n\r\n      keyChange: function (e : InputEvent) {\r\n        this.key = e.detail.value\r\n      },\r\n      dataChange: function (e : InputEvent) {\r\n        this.data = e.detail.value\r\n      },\r\n      getStorage: function () {\r\n        var key = this.key\r\n        if (key.length == 0) {\r\n          uni.showModal({\r\n            title: '读取数据失败',\r\n            content: 'key 不能为空',\r\n            showCancel: false,\r\n          })\r\n        } else {\r\n          let that = this\r\n          uni.getStorage({\r\n            key: key,\r\n            success: (res) => {\r\n\r\n              that.apiGetData = res.data\r\n              let desc : string = typeof this.apiGetData\r\n              if (\"object\" == desc) {\r\n                desc = desc + \": \" + JSON.stringify(this.apiGetData)\r\n              } else {\r\n                desc = desc + \": \" + this.apiGetData\r\n              }\r\n\r\n              uni.showModal({\r\n                title: '读取数据成功',\r\n                content: desc,\r\n                showCancel: false,\r\n              })\r\n            },\r\n            fail: () => {\r\n              uni.showModal({\r\n                title: '读取数据失败',\r\n                content: '找不到 key 对应的数据',\r\n                showCancel: false,\r\n              })\r\n            },\r\n          })\r\n        }\r\n      },\r\n      getStorageSync: function () {\r\n        var key = this.key\r\n        if (key.length == 0) {\r\n          uni.showModal({\r\n            title: '读取数据失败',\r\n            content: 'key 不能为空',\r\n            showCancel: false,\r\n          })\r\n        } else {\r\n          this.apiGetData = uni.getStorageSync(key)\r\n\r\n          let desc : string = typeof this.apiGetData\r\n          if (\"object\" == desc) {\r\n            desc = desc + \": \" + JSON.stringify(this.apiGetData)\r\n          } else {\r\n            desc = desc + \": \" + this.apiGetData\r\n          }\r\n\r\n          uni.showModal({\r\n            title: '读取数据成功',\r\n            content: desc,\r\n            showCancel: false,\r\n          })\r\n        }\r\n      },\r\n      setStorage: function () {\r\n        var key = this.key\r\n        var data = this.data\r\n        if (key.length == 0) {\r\n          uni.showModal({\r\n            title: '保存数据失败',\r\n            content: 'key 不能为空',\r\n            showCancel: false,\r\n          })\r\n        } else {\r\n          uni.setStorage({\r\n            key: key,\r\n            data: data,\r\n            success: () => {\r\n              uni.showModal({\r\n                title: '存储数据成功',\r\n                showCancel: false,\r\n              })\r\n            },\r\n            fail: () => {\r\n              uni.showModal({\r\n                title: '储存数据失败!',\r\n                showCancel: false,\r\n              })\r\n            },\r\n          })\r\n        }\r\n      },\r\n      setStorageSync: function () {\r\n        var key = this.key\r\n        var data = this.data\r\n        if (key.length == 0) {\r\n          uni.showModal({\r\n            title: '保存数据失败',\r\n            content: 'key 不能为空',\r\n            showCancel: false,\r\n          })\r\n        } else {\r\n          uni.setStorageSync(key, data)\r\n          uni.showModal({\r\n            title: '存储数据成功',\r\n            showCancel: false,\r\n          })\r\n        }\r\n      },\r\n      removeStorage: function () {\r\n        uni.removeStorage({\r\n          key: this.key,\r\n          success: () => {\r\n            uni.showModal({\r\n              title: '移除数据成功',\r\n              showCancel: false,\r\n            })\r\n          },\r\n          fail: () => {\r\n            uni.showModal({\r\n              title: '移除数据失败',\r\n              showCancel: false,\r\n            })\r\n          },\r\n        })\r\n      },\r\n      removeStorageSync: function () {\r\n        uni.removeStorageSync(this.key)\r\n        uni.showModal({\r\n          title: '移除数据成功',\r\n          showCancel: false,\r\n        })\r\n      },\r\n      clearStorage: function () {\r\n        this.key = ''\r\n        this.data = ''\r\n        uni.clearStorage({\r\n          success: function (_) {\r\n            uni.showModal({\r\n              title: '清除数据成功',\r\n              showCancel: false,\r\n            })\r\n          },\r\n          fail: function (_) {\r\n            uni.showModal({\r\n              title: '清除数据失败',\r\n              showCancel: false,\r\n            })\r\n          },\r\n        })\r\n      },\r\n      clearStorageSync: function () {\r\n        this.key = ''\r\n        this.data = ''\r\n        uni.clearStorageSync()\r\n        uni.showModal({\r\n          title: '清除数据成功',\r\n          content: ' ',\r\n          showCancel: false,\r\n        })\r\n      },\r\n    },\r\n  }\r\n\n```\n\n:::"},"getFileSystemManager":{"name":"## uni.getFileSystemManager() @getfilesystemmanager","description":"获取文件管理器","compatibility":"### getFileSystemManager 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [FileSystemManager](#filesystemmanager-values) |\n\n#### FileSystemManager 的方法 @filesystemmanager-values \n\n#### readFile(options : ReadFileOptions) : void; @readfile\n读取本地文件内容\n##### readFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ReadFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| encoding | string | 否 | - | - | base64 / utf-8,指定读取文件的字符编码,4.31及以后版本如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| base64 | - | - |\n@@| utf-8 | - | - |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 文件路径,支持相对地址和绝对地址,app-android平台支持代码包文件目录 |\n@| success | (res: [ReadFileSuccessResult](#readfilesuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 通用的错误返回结果回调 |\n@| complete | (res: any) => void | 否 | - | - | 通用的结束返回结果回调 | \n\n###### ReadFileSuccessResult 的属性值 @readfilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | any | 是 | - | - | - |\n\n###### IFileSystemManagerFail 的属性值 @ifilesystemmanagerfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1200002 | - | 类型错误。仅支持 base64 / utf-8 |\n@| 1300002 | - | 未找到文件 |\n@| 1300009 | - | 文件描述符错误 |\n@| 1300013 | - | 无权限 |\n@| 1300021 | - | 是目录 |\n@| 1300022 | - | 参数无效 |\n@| 1300066 | - | 目录非空 |\n@| 1300201 | - | 系统错误 |\n@| 1300202 | - | 超出文件存储限制的最大尺寸 |\n@| 1301003 | - | 对目录的非法操作 |\n@| 1301005 | - | 文件已存在 |\n@| 1301111 | - | brotli解压失败 |\n@| 1302003 | - | 标志无效 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### readFileSync(filePath : string, encoding ?: string) : any; @readfilesync\nFileSystemManager.readFile 的同步版本参数\n##### readFileSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| filePath | string | 是 | - | - | 文件路径,支持相对地址和绝对地址,app-android平台支持代码包文件目录 |\n| encoding | string | 否 | - | - | base64 / utf-8,指定读取文件的字符编码,4.31及以后版本如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| any |\n \n\n#### writeFile(options : WriteFileOptions) : void; @writefile\n写文件\n##### writeFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **WriteFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 文件路径,只支持绝对地址 |\n@| encoding | string | 否 | - | - | 指定写入文件的字符编码<br/>支持:ascii base64 utf-8 ,只在 data 类型是 String 时有效 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ascii | - | - |\n@@| base64 | - | - |\n@@| utf-8 | - | - |\n@| data | any | 是 | - | - | string/ArrayBuffer,要写入的文本或二进制数据,4.31及以后版本支持ArrayBuffer |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void | 否 | - | - | 通用的正确返回结果回调 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### FileManagerSuccessResult 的属性值 @filemanagersuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | - |\n\n\n#### read(option : ReadOption) : void; @read\n读文件\n##### read 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **ReadOption** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| arrayBuffer | ArrayBuffer | 是 | - | - | 数据写入的缓冲区,必须是 ArrayBuffer 实例 |\n@| fd | string | 是 | - | - |  文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 否 | - | - | 要从文件中读取的字节数,默认0 |\n@| offset | number | 否 | - | - | 缓冲区中的写入偏移量,默认0 |\n@| position | number | 否 | - | - | 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| success | (result: [ReadSuccessCallbackResult](#readsuccesscallbackresult-values)) => void | 否 | - | - | 接口调用成功的回调函数 | \n\n###### ReadSuccessCallbackResult 的属性值 @readsuccesscallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| arrayBuffer | ArrayBuffer | 是 | - | - | 被写入的缓存区的对象,即接口入参的 arrayBuffer |\n| bytesRead | number | 是 | - | - | 实际读取的字节数 |\n| errMsg | string | 是 | - | - | - |\n\n\n#### readSync(option : ReadSyncOption) : ReadResult; @readsync\n读文件\n##### readSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.26 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **ReadSyncOption** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| arrayBuffer | ArrayBuffer | 是 | - | - | 数据写入的缓冲区,必须是 ArrayBuffer 实例 |\n@| fd | string | 是 | - | - | 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 |\n@| length | number | 否 | - | - | 要从文件中读取的字节数,默认0 |\n@| offset | number | 否 | - | - | 缓冲区中的写入偏移量,默认0 |\n@| position | number | 否 | - | - | 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| **ReadResult** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| arrayBuffer | ArrayBuffer | 是 | - | - | 被写入的缓存区的对象,即接口入参的 arrayBuffer |\n@| bytesRead | number | 是 | - | - | 实际读取的字节数 | \n\n#### writeFileSync(filePath : string, data : any, encoding ?: string) : void; @writefilesync\nFileSystemManager.writeFile 的同步版本\n##### writeFileSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| filePath | string | 是 | - | - | 文件路径,只支持绝对地址 |\n| data | any | 是 | - | - | 要写入的文本或二进制数据,4.31及以后版本支持ArrayBuffer |\n| encoding | string | 否 | - | - | 指定写入文件的字符编码,支持:ascii base64 utf-8,只在 data 类型是 String 时有效 | \n\n\n#### unlink(options : UnLinkOptions) : void; @unlink\n删除文件\n##### unlink 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### unlinkSync(filePath : string) : void; @unlinksync\nFileSystemManager.unlink 的同步版本\n##### unlinkSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| filePath | string | 是 | - | - | 文件路径,只支持绝对地址 | \n\n\n#### mkdir(options : MkDirOptions) : void; @mkdir\n创建目录\n##### mkdir 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### mkdirSync(dirPath : string, recursive : boolean) : void; @mkdirsync\nFileSystemManager.mkdir 的同步版本\n##### mkdirSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| dirPath | string | 是 | - | - | 创建的目录路径 (本地路径) |\n| recursive | boolean | 是 | - | - | 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 | \n\n\n#### rmdir(options : RmDirOptions) : void; @rmdir\n删除目录\n##### rmdir 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### rmdirSync(dirPath : string, recursive : boolean) : void; @rmdirsync\nFileSystemManager.rmdir 的同步版本\n##### rmdirSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| dirPath | string | 是 | - | - | 要删除的目录路径 (本地路径) |\n| recursive | boolean | 是 | - | - | 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 | \n\n\n#### readdir(options : ReadDirOptions) : void; @readdir\n读取目录内文件列表\n##### readdir 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ReadDirOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| dirPath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要读取的目录路径 (本地路径) |\n@| success | (res: [ReadDirSuccessResult](#readdirsuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### ReadDirSuccessResult 的属性值 @readdirsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| files | Array\\<string\\> | 是 | - | - | - |\n\n\n#### readdirSync(dirPath : string) : string[] \\| null; @readdirsync\nFileSystemManager.readdir 的同步版本\n##### readdirSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| dirPath | string | 是 | - | - | 要读取的目录路径 (本地路径) | \n\n##### 返回值  \n\n| 类型 | 必备 |\n| :- | :- |\n| Array\\<string\\> | 否 |\n \n\n#### access(options : AccessOptions) : void; @access\n判断文件/目录是否存在\n##### access 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### accessSync(path : string) : void; @accesssync\nFileSystemManager.access 的同步版本\n##### accessSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| path | string | 是 | - | - | 要判断是否存在的文件/目录路径 (本地路径) | \n\n\n#### rename(options : RenameOptions) : void; @rename\n重命名文件。可以把文件从 oldPath 移动到 newPath\n##### rename 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### renameSync(oldPath : string, newPath : string) : void; @renamesync\nFileSystemManager.rename 的同步版本\n##### renameSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| oldPath | string | 是 | - | - | 源文件路径,支持本地路径 |\n| newPath | string | 是 | - | - | 新文件路径,支持本地路径 | \n\n\n#### copyFile(options : CopyFileOptions) : void; @copyfile\n复制文件\n##### copyFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### copyFileSync(srcPath : string, destPath : string) : void; @copyfilesync\nFileSystemManager.copyFile 的同步版本\n##### copyFileSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| srcPath | string | 是 | - | - | 源文件路径,支持本地路径 |\n| destPath | string | 是 | - | - | 新文件路径,支持本地路径 | \n\n\n#### getFileInfo(options : GetFileInfoOptions) : void; @getfileinfo\n获取该本地临时文件 或 本地缓存文件 信息\n##### getFileInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetFileInfoOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要读取的文件路径 (本地路径) |\n@| digestAlgorithm | string | 否 | - | - | md5 / sha1 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| md5 | - | - |\n@@| sha1 | - | - |\n@| success | (res: [GetFileInfoSuccessResult](#getfileinfosuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### GetFileInfoSuccessResult 的属性值 @getfileinfosuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| digest | string | 是 | - | - | - |\n| size | number | 是 | - | - | - |\n| errMsg | string | 是 | - | - | - |\n\n\n#### stat(options : StatOptions) : void; @stat\n获取文件 Stats 对象\n##### stat 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **StatOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| path | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 文件/目录路径 (本地路径) |\n@| recursive | boolean | 是 | - | - | 是否递归获取目录下的每个文件的 Stats 信息 |\n@| success | (res: [StatSuccessResult](#statsuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \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<br/>注意android中,文件类型只包含是否是目录与文件,<br/>另外在android中这里的权限指的是当前进程对文件或者文件夹是否有读,写,执行的权限,<br/>这里没有与 POSIX stat.st_mode对应的组,其他人等相关权限的数据返回,只有所有者的相关权限 |\n@@| size | number | 是 | - | - | 文件大小,单位:B,对应 POSIX stat.st_size |\n@@| lastAccessedTime | number | 是 | - | - | 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime<br/>注意:android中由于系统限制无法获取该数据 |\n@@| lastModifiedTime | number | 是 | - | - | 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime |\n\n###### Stats 的方法 @stats-values \n\n###### isDirectory() : boolean; @isdirectory\n判断当前文件是否一个目录\n###### isDirectory 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### isFile() : boolean; @isfile\n判断当前文件是否一个普通文件\n###### isFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n###### 返回值  \n\n| 类型 |\n| :- |\n| boolean |\n \n\n\n#### statSync(path : string, recursive : boolean) : FileStats[]; @statsync\nFileSystemManager.stat 的同步版本\n##### statSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| path | string | 是 | - | - | 文件/目录路径 (本地路径) |\n| recursive | boolean | 是 | - | - | 是否递归获取目录下的每个文件的 Stats 信息 | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<[FileStats](#filestats-values)\\> |\n \n\n#### appendFile(options : AppendFileOptions) : void; @appendfile\n在文件结尾追加内容\n##### appendFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **AppendFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要追加内容的文件路径 (本地路径) |\n@| encoding | string | 否 | - | - | 指定写入文件的字符编码<br/>支持:ascii base64 utf-8<br/>只在 data 类型是 String 时有效 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ascii | - | - |\n@@| base64 | - | - |\n@@| utf-8 | - | - |\n@| data | any | 是 | - | - | string/ArrayBuffer 要追加的文本或二进制数据,4.31及以后版本支持ArrayBuffer |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### appendFileSync(filePath : string, data : any, encoding ?: string) : void; @appendfilesync\nFileSystemManager.appendFile 的同步版本\n##### appendFileSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| filePath | string | 是 | - | - | 要追加内容的文件路径 (本地路径) |\n| data | any | 是 | - | - | 要追加的文本或二进制数据,4.31及以后版本支持ArrayBuffer |\n| encoding | string | 否 | - | - | 指定写入文件的字符编码支持:ascii base64 utf-8,只在 data 类型是 String 时有效 | \n\n\n#### saveFile(options : SaveFileOptions) : void; @savefile\n保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。\n##### saveFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SaveFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| tempFilePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 临时存储文件路径 (本地路径) |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 否 | - | - | 要存储的文件路径 (本地路径) |\n@| success | (res: [SaveFileSuccessResult](#savefilesuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### SaveFileSuccessResult 的属性值 @savefilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| savedFilePath | string | 是 | - | - | 存储后的文件路径 (本地路径) |\n\n\n#### saveFileSync(tempFilePath : string, filePath : string \\| null) : string; @savefilesync\nFileSystemManager.saveFile 的同步版本\n##### saveFileSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| tempFilePath | string | 是 | - | - | 临时存储文件路径 (本地路径) |\n| filePath | string | 否 | - | - | 要存储的文件路径 (本地路径) | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n\n#### removeSavedFile(options : RemoveSavedFileOptions) : void; @removesavedfile\n删除该小程序下已保存的本地缓存文件\n##### removeSavedFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\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 | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### unzip(options : UnzipFileOptions) : void; @unzip\n解压文件\n##### unzip 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **UnzipFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| zipFilePath | string | 是 | - | - | 源文件路径,支持本地路径, 只可以是 zip 压缩文件 |\n@| targetPath | string | 是 | - | - | 目标目录路径, 支持本地路径 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### getSavedFileList(options : GetSavedFileListOptions) : void; @getsavedfilelist\n获取该已保存的本地缓存文件列表\n##### getSavedFileList 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetSavedFileListOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (res: [GetSavedFileListResult](#getsavedfilelistresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### GetSavedFileListResult 的属性值 @getsavedfilelistresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| fileList | Array\\<string\\> | 是 | - | - | - |\n\n\n#### truncate(options : TruncateFileOptions) : void; @truncate\n对文件内容进行截断操作\n##### truncate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\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 个字节会保留在文件中,其余内容会被删除;<br/>如果 length 大于文件长度,不做处理 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### truncateSync(filePath : string, length ?: number) : void; @truncatesync\n对文件内容进行截断操作 (truncate 的同步版本)\n##### truncateSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| filePath | string | 是 | - | - | 要截断的文件路径 (本地路径) |\n| length | number | 否 | - | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,不做处理 | \n\n\n#### readCompressedFile(options : ReadCompressedFileOptions) : void; @readcompressedfile\n读取指定压缩类型的本地文件内容\n##### readCompressedFile 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ReadCompressedFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要读取的文件的路径 (本地用户文件或代码包文件),app-android平台支持代码包文件目录 |\n@| compressionAlgorithm | string | 是 | - | - | 文件压缩类型,目前仅支持 'br'。 |\n@| success | (res: [ReadCompressedFileResult](#readcompressedfileresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### ReadCompressedFileResult 的属性值 @readcompressedfileresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | string | 是 | - | - | - |\n\n\n#### readCompressedFileSync(filePath : string, compressionAlgorithm : string) : string @readcompressedfilesync\n同步读取指定压缩类型的本地文件内容\n##### readCompressedFileSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| filePath | string | 是 | - | - | 要读取的文件的路径 (本地用户文件或代码包文件),app-android平台支持代码包文件目录 |\n| compressionAlgorithm | string | 是 | - | - | 文件压缩类型,目前仅支持 'br'。 | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n\n#### open(options : OpenFileOptions) : void; @open\n打开文件,返回文件描述符\n##### open 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **OpenFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要追加内容的文件路径 (本地路径) |\n@| flag | string | 是 | - | - | 文件系统标志,默认值: 'r' |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| a | - | - |\n@@| ax | - | - |\n@@| a+ | - | - |\n@@| ax+ | - | - |\n@@| r | - | - |\n@@| r+ | - | - |\n@@| w | - | - |\n@@| wx | - | - |\n@@| w+ | - | - |\n@@| wx | - | - |\n@@| wx+ | - | - |\n@| success | (res: [OpenFileSuccessResult](#openfilesuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### OpenFileSuccessResult 的属性值 @openfilesuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| fd | string | 是 | - | - | - |\n\n\n#### openSync(options : OpenFileSyncOptions) : string; @opensync\n同步打开文件,返回文件描述符\n##### openSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **OpenFileSyncOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要追加内容的文件路径 (本地路径) |\n@| flag | string | 是 | - | - | 文件系统标志,默认值: 'r' |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| a | - | - |\n@@| ax | - | - |\n@@| a+ | - | - |\n@@| ax+ | - | - |\n@@| r | - | - |\n@@| r+ | - | - |\n@@| w | - | - |\n@@| wx | - | - |\n@@| w+ | - | - |\n@@| wx | - | - |\n@@| wx+ | - | - | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n\n#### write(options : WriteOptions) : void; @write\n写入文件\n##### write 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **WriteOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| data | any | 是 | - | - | 写入的内容,类型为 String 或 ArrayBuffer,4.31及以后版本支持ArrayBuffer |\n@| offset | number | 否 | - | - | 4.31及以后版本新增,只在 data 类型是 ArrayBuffer 时有效,决定 ArrayBuffer 中要被写入的部位,即 ArrayBuffer 中的索引,默认0 |\n@| length | number | 否 | - | - | 4.31及以后版本新增,只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 ArrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 |\n@| position | number | 否 | - | - | 4.31及以后版本新增,指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 |\n@| encoding | string | 否 | - | - | 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8<br/>支持:ascii base64 utf-8 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ascii | - | - |\n@@| base64 | - | - |\n@@| utf-8 | - | - |\n@| success | (res: [WriteResult](#writeresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### WriteResult 的属性值 @writeresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| bytesWritten | number | 是 | - | - | 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) |\n| errMsg | string | 是 | - | - | - |\n\n\n#### writeSync(options : WriteSyncOptions) : WriteResult; @writesync\n同步写入文件\n##### writeSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **WriteSyncOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| data | any | 是 | - | - | 写入的内容,类型为 String 或 ArrayBuffer,4.31及以后版本支持ArrayBuffer |\n@| encoding | string | 否 | - | - | 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8<br/>支持:ascii base64 utf-8 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ascii | - | - |\n@@| base64 | - | - |\n@@| utf-8 | - | - |\n@| length | number | 否 | - | - | 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 ,4.31及以后版本新增 |\n@| offset | number | 否 | - | - | 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0,4.31及以后版本新增 |\n@| position | number | 否 | - | - | 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。4.31及以后版本新增 | \n\n##### 返回值  \n\n| 类型 |\n| :- |\n| [WriteResult](#writeresult-values) |\n \n\n#### close(options : CloseOptions) : void; @close\n关闭文件\n##### close 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CloseOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### closeSync(options : CloseSyncOptions) : void; @closesync\n同步关闭文件\n##### closeSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CloseSyncOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 需要被关闭的文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 | \n\n\n#### fstat(options : FStatOptions) : void; @fstat\n获取文件的状态信息\n##### fstat 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **FStatOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| success | (res: [FStatSuccessResult](#fstatsuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### FStatSuccessResult 的属性值 @fstatsuccessresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| stats | [Stats](#stats-values) | 是 | - | - | Stats 对象,包含了文件的状态信息 |\n\n\n#### fstatSync(options : FStatSyncOptions) : Stats; @fstatsync\n同步获取文件的状态信息\n##### fstatSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\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) | Stats 对象,包含了文件的状态信息 |\n \n\n#### ftruncate(options : FTruncateFileOptions) : void; @ftruncate\n对文件内容进行截断操作\n##### ftruncate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **FTruncateFileOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 是 | - | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;<br/>如果 length 大于文件长度,不做处理 |\n@| success | (res: [FileManagerSuccessResult](#filemanagersuccessresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### ftruncateSync(options : FTruncateFileSyncOptions) : void; @ftruncatesync\n同步对文件内容进行截断操作\n##### ftruncateSync 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **FTruncateFileSyncOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| fd | string | 是 | - | - | 文件描述符。fd 通过 FileSystemManager.open 或 FileSystemManager.openSync 接口获得 |\n@| length | number | 是 | - | - | 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;<br/>如果 length 大于文件长度,不做处理 | \n\n\n#### readZipEntry(options : ReadZipEntryOptions) : void; @readzipentry\n读取压缩包内的文件\n##### readZipEntry 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.13 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **ReadZipEntryOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| filePath | [string.URIString](/uts/data-type.md#ide-string) | 是 | - | - | 要读取的压缩包的路径 (本地路径),app-android平台支持代码包文件目录 |\n@| encoding | string | 否 | - | - | 统一指定读取文件的字符编码,只在 entries 值为\"all\"时有效。<br/>4.31及以后版本如果 entries 值为 null 且不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| ascii | - | - |\n@@| base64 | - | - |\n@@| utf-8 | - | - |\n@| entries | Array\\<**EntryItem**\\> | 否 | - | - | 要读取的压缩包内的文件列表(当不传入时表示读取压缩包内所有文件) |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| path | string | 是 | - | - | 压缩包内文件路径 |\n@@| encoding | string | 否 | - | - | 指定写入文件的字符编码<br/>支持:ascii base64 utf-8;4.31及以后版本如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容 |\n@@@| 合法值 | 兼容性 | 描述 |\n@@@| :- |  :-: | :- |\n@@@| ascii | - | - |\n@@@| base64 | - | - |\n@@@| utf-8 | - | - |\n@| success | (res: [EntriesResult](#entriesresult-values)) => void | 否 | - | - | 接口调用的回调函数 |\n@| fail | (res: [IFileSystemManagerFail](#ifilesystemmanagerfail-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (res: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### EntriesResult 的属性值 @entriesresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| result | Map\\<string, ZipFileItem> | 是 | - | - | 文件路径 |\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.file.getFileSystemManager)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getFileSystemManager&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getFileSystemManager&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getFileSystemManager&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getFileSystemManager&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getFileSystemManager&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getFileSystemManager)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getFileSystemManager&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","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 >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-file-system-manager/get-file-system-manager\n```uvue\n<template>\r\n\t<!-- #ifdef APP -->\r\n\t<text>显示简易操作日志,详细日志需真机运行查看</text><button size=\"mini\" @click=\"log=''\">清空日志</button>\r\n\t<text style=\"margin: 2px; padding: 2px; border: 1px solid #000000;\">{{ log }}</text>\r\n\t<scroll-view style=\"flex: 1;\">\r\n\t<!-- #endif -->\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"statFileInfoTest\"\r\n\t\t\tid=\"btn-stat-file\">递归获取目录files的Stats对象{{statFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"mkdirTest\" id=\"btn-mkdir\">创建文件夹{{mkdirFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"writeFileTest\" id=\"btn-write-file\">覆盖写入文件{{writeFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readDirTest\" id=\"btn-read-dir\">读取文件夹{{readDir}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readFileTest\" id=\"btn-read-file\">读取文件{{readFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"copyFileTest\"\r\n\t\t\tid=\"btn-copy-file\">复制文件{{copyFromFile}}到{{copyToFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"renameFileTest\"\r\n\t\t\tid=\"btn-rename-file\">重命名文件{{renameFromFile}}到{{renameToFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"accessFileTest\"\r\n\t\t\tid=\"btn-access-file\">判断文件{{accessFile}}是否存在</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"getFileInfoTest\"\r\n\t\t\tid=\"btn-get-file-info\">获取文件信息{{getFileInfoFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"unlinkTest\" id=\"btn-unlink-file\">删除文件{{unlinkFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"copyStaticToFilesTest\"\r\n\t\t\tid=\"btn-copyStatic-file\">从static目录复制文件到a目录</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"unlinkAllFileTest\"\r\n\t\t\tid=\"btn-clear-file\">删除文件夹{{rmDirFile}}下的所有文件</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"rmdirTest\" id=\"btn-remove-dir\">删除文件夹{{rmDirFile}}</button>\r\n\r\n\r\n\t\t<!-- #ifdef APP-ANDROID -->\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"statFileInfoSyncTest\"\r\n\t\t\tid=\"btn-stat-file-sync\">同步递归获取目录files的Stats对象{{statFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"appendFileTest\"\r\n\t\t\tid=\"btn-append-file\">在文件{{readFile}}结尾追加内容</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"appendFileSyncTest\"\r\n\t\t\tid=\"btn-append-file-sync\">同步在文件{{readFile}}结尾追加内容</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"writeFileSyncTest\"\r\n\t\t\tid=\"btn-write-file-sync\">同步覆盖写入文件{{writeFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readFileSyncTest\"\r\n\t\t\tid=\"btn-read-file-sync\">同步读取文件{{readFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"unlinkSyncTest\"\r\n\t\t\tid=\"btn-unlink-file-sync\">同步删除文件{{unlinkFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"mkdirSyncTest\" id=\"btn-mkdir-sync\">同步创建文件夹{{mkdirFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"rmdirSyncTest\"\r\n\t\t\tid=\"btn-remove-dir-sync\">同步删除文件夹{{rmDirFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readDirSyncTest\"\r\n\t\t\tid=\"btn-read-dir-sync\">同步读取文件夹{{readDir}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"accessFileSyncTest\"\r\n\t\t\tid=\"btn-access-file-sync\">同步判断文件{{accessFile}}是否存在</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"renameFileSync\"\r\n\t\t\tid=\"btn-rename-file-sync\">同步重命名文件{{renameFromFile}}到{{renameToFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"copyFileSyncTest\"\r\n\t\t\tid=\"btn-copy-file-sync\">同步复制文件{{copyFromFile}}到{{copyToFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"saveFileTest\" id=\"btn-save-file\">保存临时文件到本地</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"saveFileSyncTest\" id=\"btn-save-file-sync\">同步保存临时文件到本地</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"removeSavedFileTest\"\r\n\t\t\tid=\"btn-remove-saved-file\">删除已保存的本地文件</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"unzipFileTest\" id=\"btn-unzip-file-sync\">解压文件</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"getSavedFileListTest\"\r\n\t\t\tid=\"btn-getsaved-filelist\">获取该已保存的本地缓存文件列表</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"truncateFileTest\"\r\n\t\t\tid=\"btn-truncate-file\">对文件{{writeFile}}内容进行截断操作</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"truncateFileSyncTest\"\r\n\t\t\tid=\"btn-truncate-file-sync\">同步对文件{{writeFile}}内容进行截断操作</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readCompressedFileTest\"\r\n\t\t\tid=\"btn-compressed-file\">读取指定压缩类型的本地文件内容</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readCompressedFileSyncTest\"\r\n\t\t\tid=\"btn-compressed-file-sync\">同步读取指定压缩类型的本地文件内容</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"openFileTest\" id=\"btn-open-file\">打开文件{{readFile}},返回描述符</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"openFileSyncTest('r',true)\"\r\n\t\t\tid=\"btn-open-file-sync\">同步打开文件{{readFile}},返回描述符</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"closeTest\" id=\"btn-close-file\">通过文件描述符关闭文件{{readFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"closeSyncTest\"\r\n\t\t\tid=\"btn-close-file-sync\">通过文件描述符同步关闭文件{{readFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"writeTest\" id=\"btn-write\">通过文件描述符写入文件{{readFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"writeSyncTest\"\r\n\t\t\tid=\"btn-write-sync\">同步通过文件描述符写入文件{{readFile}}</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"fstatTest\" id=\"btn-fstat-file\">通过文件描述符获取{{statFile}}的状态信息</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"fstatSyncTest\"\r\n\t\t\tid=\"btn-fstat-file-sync\">同步通过文件描述符获取{{statFile}}的状态信息</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"ftruncateFileTest\"\r\n\t\t\tid=\"btn-ftruncate-file\">通过文件描述符对文件{{writeFile}}内容进行截断</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"ftruncateFileSyncTest\"\r\n\t\t\tid=\"btn-ftruncate-file-sync\">同步通过文件描述符对文件{{writeFile}}内容进行截断</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"readZipEntry\" id=\"btn-readzip-entry\">读取压缩包内的文件</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"testWriteReadFileBuffer\" id=\"btn-writereadfile-buffer\">写入/读取\r\n\t\t\tArrayBuffer</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"testWriteReadFileSyncBuffer\"\r\n\t\t\tid=\"btn-writereadfilesync-buffer\">同步写入/读取\r\n\t\t\tArrayBuffer</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"testWriteReadBuffer\" id=\"btn-writeread-buffer\">通过文件描述符写入/读取\r\n\t\t\tArrayBuffer</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"testWriteReadSyncBuffer\"\r\n\t\t\tid=\"btn-writereadsync-buffer\">通过文件描述符同步写入/读取\r\n\t\t\tArrayBuffer</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"testAppendFileBuffer\" id=\"btn-appendfile-buffer\">在文件末尾追加\r\n\t\t\tArrayBuffer</button>\r\n\t\t<button class=\"btnstyle\" type=\"primary\" @tap=\"testAppendFileBufferSync\" id=\"btn-appendfilesync-buffer\">同步在文件末尾追加\r\n\t\t\tArrayBuffer</button>\r\n\r\n\t\t<view style=\"height: 4px;\"></view>\r\n\t\t<!-- #endif -->\r\n\t<!-- #ifdef APP -->\r\n\t</scroll-view>\r\n\t<!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n\texport default {\r\n\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\tlog: \"\",\r\n\t\t\t\t/**\r\n\t\t\t\t * 自动化测试需要关闭log\r\n\t\t\t\t */\r\n\t\t\t\tlogAble: true,\r\n\t\t\t\tfileListSuccess: [] as string[],\r\n\t\t\t\tfileListComplete: [] as string[],\r\n\t\t\t\taccessFileRet: '',\r\n\t\t\t\tlastFailError: new UniError(\"uni-file-manager\", 1300000, \"mock error\"),\r\n\t\t\t\tlastCompleteError: new UniError(\"uni-file-manager\", 1300000, \"mock error\"),\r\n\t\t\t\treadDir: 'a',\r\n\t\t\t\treadFileRet: \"\",\r\n\t\t\t\twriteFileContent: \"中文 en.\\r\\n\\t换行\",\r\n\t\t\t\tappendFileContent: \"append content\",\r\n\t\t\t\tgetFileInfoAlgorithm: \"md5\",\r\n\t\t\t\tgetFileInfoSize: -1,\r\n\t\t\t\tgetFileInfoDigest: \"\",\r\n\t\t\t\tunlinkFile: 'a/1.txt',\r\n\t\t\t\taccessFile: 'a/1.txt',\r\n\t\t\t\twriteFile: 'a/1.txt',\r\n\t\t\t\twriteData: 'insert data哈哈哈',\r\n\t\t\t\tbrFile: 'a/1.txt.br',\r\n\t\t\t\ttemFile: 'a/1.txt',\r\n\t\t\t\tcopyFromFile: 'a/1.txt',\r\n\t\t\t\tcopyToFile: 'a/2.txt',\r\n\t\t\t\trenameFromFile: 'a/2.txt',\r\n\t\t\t\trenameToFile: 'a/3.txt',\r\n\t\t\t\tgetFileInfoFile: 'a/1.txt',\r\n\t\t\t\tstatFile: '',\r\n\t\t\t\trmDirFile: 'a',\r\n\t\t\t\tmkdirFile: 'a',\r\n\t\t\t\treadFile: 'a/1.txt',\r\n\t\t\t\trecursiveVal: true,\r\n\t\t\t\tdone: false,\r\n\t\t\t\twriteFileEncoding: \"utf-8\",\r\n\t\t\t\treadFileEncoding: \"utf-8\",\r\n\t\t\t\tstatsRet: [] as Array<FileStats>,\r\n\t\t\t\tunzipFile: 'zip/1.zip',\r\n\t\t\t\ttargetZip: \"unzip\",\r\n\t\t\t\trenameFileRet: '',\r\n\t\t\t\tsaveFileRet: '',\r\n\t\t\t\tremoveSavedFileRet: '',\r\n\t\t\t\tfd: '',\r\n\t\t\t\tcloseFileRet: '',\r\n\t\t\t\tbytesWritten: 0,\r\n\t\t\t\tfstat: null as Stats | null,\r\n\t\t\t\tftruncateRet: '',\r\n\t\t\t\treadZipFile: 'to.zip',\r\n\t\t\t\tgetSavedFileListRet: '',\r\n\t\t\t\tarrayBufferRes: 0,\r\n\t\t\t\t/**\r\n\t\t\t\t * 待测试的全局环境变量\r\n\t\t\t\t */\r\n\t\t\t\tbasePath: uni.env.USER_DATA_PATH,\r\n\t\t\t\tcopyToBasePath: uni.env.USER_DATA_PATH,\r\n\t\t\t\tglobalTempPath: uni.env.CACHE_PATH,\r\n\t\t\t\tglobalRootPath: uni.env.SANDBOX_PATH,\r\n\t\t\t\tglobalUserDataPath: uni.env.USER_DATA_PATH\r\n\t\t\t}\r\n\t\t},\r\n\t\tonLoad() {\r\n\t\t},\r\n\r\n\t\tmethods: {\r\n\t\t\tstatFileInfoTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.stat({\r\n\t\t\t\t\t// path: `${this.basePath}${this.statFile}`, //USER_DATA_PATH\r\n\t\t\t\t\tpath: `${this.globalTempPath}${this.statFile}`, //CACHE_PATH\r\n\t\t\t\t\trecursive: this.recursiveVal,\r\n\t\t\t\t\tsuccess: (res : StatSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'statFileInfoTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('statFileInfoTest success', res)\r\n\t\t\t\t\t\tthis.statsRet = res.stats\r\n\t\t\t\t\t\tconsole.log('this.statsRet', this.statsRet)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'statFileInfoTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('statFileInfoTest fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"statFileInfoTest complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as StatOptions)\r\n\t\t\t},\r\n\r\n\t\t\tgetFileInfoTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.getFileInfo({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.getFileInfoFile}`,\r\n\t\t\t\t\tdigestAlgorithm: this.getFileInfoAlgorithm,\r\n\t\t\t\t\tsuccess: (res : GetFileInfoSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'getFileInfoTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t\tthis.getFileInfoSize = res.size\r\n\t\t\t\t\t\tthis.getFileInfoDigest = res.digest\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'getFileInfoTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as GetFileInfoOptions)\r\n\t\t\t},\r\n\r\n\t\t\tcopyFileTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.copyFile({\r\n\t\t\t\t\tsrcPath: `${this.basePath}${this.copyFromFile}`,\r\n\t\t\t\t\tdestPath: `${this.copyToBasePath}${this.copyToFile}`,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'copyFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'copyFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as CopyFileOptions)\r\n\t\t\t},\r\n\r\n\t\t\trenameFileTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.rename({\r\n\t\t\t\t\toldPath: `${this.basePath}${this.renameFromFile}`,\r\n\t\t\t\t\tnewPath: `${this.basePath}${this.renameToFile}`,\r\n\t\t\t\t\tsuccess: (res) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'renameFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'renameFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as RenameOptions)\r\n\t\t\t},\r\n\r\n\t\t\treadDirTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.readdir({\r\n\t\t\t\t\tdirPath: `${this.basePath}${this.readDir}`,\r\n\t\t\t\t\tsuccess: (res : ReadDirSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readDirTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t\tthis.fileListSuccess = res.files\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readDirTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.fileListComplete = (res as ReadDirSuccessResult).files\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as ReadDirOptions)\r\n\t\t\t},\r\n\r\n\t\t\twriteFileTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.writeFile({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.writeFile}`,\r\n\t\t\t\t\tdata: this.writeFileContent,\r\n\t\t\t\t\tencoding: this.writeFileEncoding,\r\n\t\t\t\t\tsuccess: (res) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'writeFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'writeFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail')\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tconsole.log(\"complete\")\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t} as WriteFileOptions)\r\n\t\t\t},\r\n\r\n\t\t\treadFileTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.readFile({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.readFile}`,\r\n\t\t\t\t\tencoding: this.readFileEncoding,\r\n\t\t\t\t\tsuccess: (res : ReadFileSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t\tthis.readFileRet = res.data.toString()\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as ReadFileOptions)\r\n\t\t\t},\r\n\r\n\t\t\trmdirTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.rmdir({\r\n\t\t\t\t\tdirPath: `${this.basePath}${this.rmDirFile}`,\r\n\t\t\t\t\trecursive: this.recursiveVal,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'rmdirTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'rmdirTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as RmDirOptions)\r\n\t\t\t},\r\n\r\n\t\t\tmkdirTest: function () {\r\n\t\t\t\t// 准备测试数据\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.mkdir({\r\n\t\t\t\t\tdirPath: `${this.basePath}${this.mkdirFile}`,\r\n\t\t\t\t\trecursive: this.recursiveVal,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'mkdirTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'mkdirTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t}\r\n\t\t\t\t} as MkDirOptions)\r\n\r\n\t\t\t},\r\n\t\t\taccessFileTest: function () {\r\n\t\t\t\tthis.accessFileRet = ''\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.access({\r\n\t\t\t\t\tpath: `${this.basePath}${this.accessFile}`,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'accessFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t\tthis.accessFileRet = res.errMsg\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'accessFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as AccessOptions)\r\n\r\n\t\t\t},\r\n\t\t\tunlinkTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.unlink({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.unlinkFile}`,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'unlinkTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'unlinkTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as UnLinkOptions)\r\n\t\t\t},\r\n\t\t\tunlinkAllFileTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.readdir({\r\n\t\t\t\t\tdirPath: `${this.basePath}${this.rmDirFile}`,\r\n\t\t\t\t\tsuccess: (res : ReadDirSuccessResult) => {\r\n\t\t\t\t\t\tconsole.log(\"success to readdir\", res)\r\n\t\t\t\t\t\tres.files.forEach(element => {\r\n\t\t\t\t\t\t\tconsole.log(element)\r\n\t\t\t\t\t\t\tlet filePath : string\r\n\t\t\t\t\t\t\tif (this.rmDirFile.length <= 0) {\r\n\t\t\t\t\t\t\t\tfilePath = `${this.basePath}${element}`\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tfilePath = `${this.basePath}${this.rmDirFile}/${element}`\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tfileManager.unlink({\r\n\t\t\t\t\t\t\t\tfilePath: filePath,\r\n\t\t\t\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\t\t\tthis.log += 'unlinkAllFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tconsole.log('success unlink', res)\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\t\t\tthis.log += 'unlinkAllFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tconsole.log('fail unlink', res)\r\n\t\t\t\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tconsole.log(\"complete unlink\", res)\r\n\t\t\t\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} as UnLinkOptions)\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'unlinkAllFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail to readdir', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete readdir\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.fileListComplete = (res as ReadDirSuccessResult).files\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as ReadDirOptions)\r\n\t\t\t},\r\n\t\t\tcopyStaticToFilesTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\r\n\t\t\t\tfileManager.copyFile({\r\n\t\t\t\t\tsrcPath: \"/static/list-mock/mock.json\",\r\n\t\t\t\t\tdestPath: `${this.copyToBasePath}/a/mock.json`,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'copyFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'copyFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as CopyFileOptions)\r\n\t\t\t},\r\n\t\t\t//start\r\n\t\t\tappendFileTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.appendFile({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.writeFile}`,\r\n\t\t\t\t\tdata: this.appendFileContent,\r\n\t\t\t\t\tencoding: this.writeFileEncoding,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'appendFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'appendFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail')\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tconsole.log(\"complete\")\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t} as AppendFileOptions)\r\n\t\t\t},\r\n\t\t\twriteFileSyncTest: function (_ : any) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\t\tfileManager.writeFileSync(`${this.basePath}${this.writeFile}`, this.writeFileContent, this.writeFileEncoding)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'writeFileSyncTest success:' + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'writeFileSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\treadFileSyncTest: function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\t\tlet data = fileManager.readFileSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.readFile}`,\r\n\t\t\t\t\t\tthis.readFileEncoding)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'readFileSyncTest result:' + data + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.readFileRet = data.toString()\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'readFileSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tunlinkSyncTest: function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\t\tfileManager.unlinkSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.unlinkFile}`)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'unlinkSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tmkdirSyncTest: function () {\r\n\t\t\t\t// 准备测试数据\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\t\tfileManager.mkdirSync(`${this.basePath}${this.mkdirFile}`, this.recursiveVal)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'mkdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\trmdirSyncTest: function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\t\tfileManager.rmdirSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.rmDirFile}`,\r\n\t\t\t\t\t\tthis.recursiveVal)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'rmdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\treadDirSyncTest: function () {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\t\tlet res = fileManager.readdirSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.readDir}`)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'readDirTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (res != null) {\r\n\t\t\t\t\t\tthis.fileListSuccess = res\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'rmdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\taccessFileSyncTest: function () {\r\n\t\t\t\tthis.accessFileRet = ''\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.accessSync(`${this.basePath}${this.accessFile}`)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.accessFileRet = 'access:ok'\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'rmdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\trenameFileSync: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.renameSync(`${this.basePath}${this.renameFromFile}`,\r\n\t\t\t\t\t\t`${this.basePath}${this.renameToFile}`)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.renameFileRet = \"rename:ok\"\r\n\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'rmdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconsole.log('renameSync:' + e)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcopyFileSyncTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.copyFileSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.copyFromFile}`,\r\n\t\t\t\t\t\t`${this.copyToBasePath}${this.copyToFile}`)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'rmdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tappendFileSyncTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.appendFileSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.writeFile}`,\r\n\t\t\t\t\t\tthis.appendFileContent,\r\n\t\t\t\t\t\tthis.writeFileEncoding)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'rmdirSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tsaveFileTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.saveFile({\r\n\t\t\t\t\ttempFilePath: `${this.globalTempPath}${this.temFile}`,\r\n\t\t\t\t\t// filePath:`${this.basePath}local/`,\r\n\t\t\t\t\tsuccess: (res : SaveFileSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'saveFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t\tthis.saveFileRet = res.savedFilePath\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'saveFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('saveFileTest fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as SaveFileOptions)\r\n\t\t\t},\r\n\t\t\tsaveFileSyncTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.saveFileSync(\r\n\t\t\t\t\t\t`${this.globalTempPath}${this.temFile}`, `${this.basePath}/`)\r\n\t\t\t\t\t// filePath:`${this.basePath}local/`,)\r\n\t\t\t\t\tthis.done = true\r\n\r\n\t\t\t\t\t//todo 后面打开\r\n\t\t\t\t\t// this.saveFileRet=res\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.log('saveFileSyncTest:' + e)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tunzipFileTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.mkdirSync(`${this.basePath}${this.targetZip}`, true)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\t\t\t\tfileManager.unzip({\r\n\t\t\t\t\tzipFilePath: '/static/filemanager/to.zip',\r\n\t\t\t\t\ttargetPath: `${this.basePath}${this.targetZip}`,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'unzipFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('success', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'unzipFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as UnzipFileOptions)\r\n\t\t\t},\r\n\r\n\t\t\tgetSavedFileListTest: function () {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.getSavedFileList({\r\n\t\t\t\t\tsuccess: (res : GetSavedFileListResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'getSavedFileListTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"getSavedFileListTest success\", res)\r\n\t\t\t\t\t\tthis.fileListSuccess = res.fileList\r\n\t\t\t\t\t\tthis.getSavedFileListRet = \"getSavedFileList:ok\"\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'getSavedFileListTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('getSavedFileListTest fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t\tthis.getSavedFileListRet = JSON.stringify(res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tthis.fileListComplete = (res as GetSavedFileListResult).fileList\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as GetSavedFileListOptions)\r\n\t\t\t},\r\n\t\t\ttruncateFileTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.truncate({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.writeFile}`,\r\n\t\t\t\t\tlength: 7,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'truncateFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'truncateFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as TruncateFileOptions)\r\n\t\t\t},\r\n\t\t\ttruncateFileSyncTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.truncateSync(\r\n\t\t\t\t\t\t`${this.basePath}${this.writeFile}`,\r\n\t\t\t\t\t\t4)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.log(e)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\treadCompressedFileTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.readCompressedFile({\r\n\t\t\t\t\tfilePath: '/static/filemanager/1.txt.br',\r\n\t\t\t\t\tcompressionAlgorithm: \"br\",\r\n\t\t\t\t\tsuccess: (res : ReadCompressedFileResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readCompressedFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readCompressedFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as ReadCompressedFileOptions)\r\n\t\t\t},\r\n\t\t\treadCompressedFileSyncTest() {\r\n\t\t\t\tconsole.log('readCompressedFileSyncTest')\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet data = fileManager.readCompressedFileSync(\r\n\t\t\t\t\t\t'/static/filemanager/1.txt.br',\r\n\t\t\t\t\t\t\"br\")\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += data\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'readCompressedFileSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\tremoveSavedFileTest() {\r\n\t\t\t\tconsole.log(\"removeSavedFileTest enter\")\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.removeSavedFile({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.writeFile}`,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'removeSavedFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.removeSavedFileRet = res.errMsg\r\n\t\t\t\t\t\tconsole.log(\"removeSavedFileTest success\", res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'removeSavedFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('removeSavedFileTest fail', res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as RemoveSavedFileOptions)\r\n\t\t\t},\r\n\r\n\t\t\tstatFileInfoSyncTest: function (_ : any) {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet res = fileManager.statSync(\r\n\t\t\t\t\t\t// path: `${this.basePath}${this.statFile}`, //USER_DATA_PATH\r\n\t\t\t\t\t\t`${this.globalTempPath}${this.statFile}`, //CACHE_PATH\r\n\t\t\t\t\t\tthis.recursiveVal)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'statFileInfoSyncTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.statsRet = res\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'statFileInfoSyncTest fail:' + e + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\topenFileTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.open({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.readFile}`,\r\n\t\t\t\t\tflag: \"a\",\r\n\t\t\t\t\tsuccess: (res : OpenFileSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'openFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t\tthis.fd = res.fd\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'openFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as OpenFileOptions)\r\n\t\t\t},\r\n\t\t\topenFileSyncTest(param : string, isTest : boolean) : string {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet fd = fileManager.openSync({\r\n\t\t\t\t\t\tfilePath: `${this.basePath}${this.readFile}`,\r\n\t\t\t\t\t\tflag: param,\r\n\t\t\t\t\t} as OpenFileSyncOptions)\r\n\t\t\t\t\tif (this.logAble && isTest) {\r\n\t\t\t\t\t\tthis.log += 'openFileSyncTest success:' + fd + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (isTest) {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tthis.fd = fd\r\n\t\t\t\t\treturn fd\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'openFileSyncTest fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconsole.log('fail', e)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t\treturn \"\"\r\n\t\t\t},\r\n\t\t\tcloseSyncTest() {\r\n\t\t\t\tconsole.log('closeSyncTest')\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconsole.log('closeSync')\r\n\t\t\t\t\tfileManager.closeSync({\r\n\t\t\t\t\t\tfd: this.openFileSyncTest('r', false)\r\n\t\t\t\t\t} as CloseSyncOptions)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'closeSyncTest success:' + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.closeFileRet = \"close:ok\"\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'closeSyncTest fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconsole.log('fail', e)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tcloseTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.close({\r\n\t\t\t\t\tfd: this.openFileSyncTest('r', false),\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'closeTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.closeFileRet = res.errMsg\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'closeTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} as CloseOptions)\r\n\t\t\t},\r\n\t\t\twriteTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.mkdirSync(`${this.basePath}${this.mkdirFile}`, true)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\r\n\t\t\t\tfileManager.write({\r\n\t\t\t\t\tfd: this.openFileSyncTest('w+', false),\r\n\t\t\t\t\tdata: this.writeData,\r\n\t\t\t\t\tencoding: \"utf-8\",\r\n\t\t\t\t\tsuccess: (res : WriteResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'writeTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t\tthis.bytesWritten = res.bytesWritten\r\n\t\t\t\t\t\tthis.lastFailError = new UniError('uni-fileSystemManager', 0, 'writeTest success:' + JSON.stringify(res))\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'writeTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, 'writeTest:' + res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} as WriteOptions)\r\n\t\t\t},\r\n\t\t\twriteSyncTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.mkdirSync(`${this.basePath}${this.mkdirFile}`, true)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\t\t\t\tfileManager.open({\r\n\t\t\t\t\tfilePath: `${this.basePath}${this.readFile}`,\r\n\t\t\t\t\tflag: \"r+\",\r\n\t\t\t\t\tsuccess: (res : OpenFileSuccessResult) => {\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t\tif (res.fd.length <= 0) {\r\n\t\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\t\treturn\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\tlet ret = fileManager.writeSync({\r\n\t\t\t\t\t\t\t\tfd: res.fd,\r\n\t\t\t\t\t\t\t\tdata: this.writeData,\r\n\t\t\t\t\t\t\t\tencoding: \"utf-8\"\r\n\t\t\t\t\t\t\t} as WriteSyncOptions)\r\n\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\tthis.log += 'writeSyncTest success:' + JSON.stringify(ret) + '\\n\\n'\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tconsole.log(\"success\", ret)\r\n\t\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\t\tthis.bytesWritten = ret.bytesWritten\r\n\t\t\t\t\t\t} catch (e) {\r\n\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\tthis.log += 'writeSyncTest fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tconsole.log('fail', e)\r\n\t\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'openFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\t\t\t\t} as OpenFileOptions)\r\n\r\n\t\t\t},\r\n\t\t\tfstatTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.fstat({\r\n\t\t\t\t\tfd: this.openFileSyncTest('r', false),\r\n\t\t\t\t\tsuccess: (res : FStatSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'fstatTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t\tthis.fstat = res.stats\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'fstatTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} as FStatOptions)\r\n\t\t\t},\r\n\t\t\tfstatSyncTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet stat =\r\n\t\t\t\t\t\tfileManager.fstatSync({\r\n\t\t\t\t\t\t\tfd: this.openFileSyncTest('r', false),\r\n\t\t\t\t\t\t} as FStatSyncOptions)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'fstatSyncTest success:' + JSON.stringify(stat) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.fstat = stat\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'fstatSyncTest fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tftruncateFileTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.ftruncate({\r\n\t\t\t\t\tfd: this.openFileSyncTest('r+', false),\r\n\t\t\t\t\tlength: 6,\r\n\t\t\t\t\tsuccess: (res : FileManagerSuccessResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'ftruncateFileTest success:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.ftruncateRet = res.errMsg\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'ftruncateFileTest fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as FTruncateFileOptions)\r\n\t\t\t},\r\n\t\t\tftruncateFileSyncTest() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.ftruncateSync({\r\n\t\t\t\t\t\tfd: this.openFileSyncTest('r+', false),\r\n\t\t\t\t\t\tlength: 4\r\n\t\t\t\t\t} as FTruncateFileSyncOptions)\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'ftruncateFileSyncTest success:' + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.ftruncateRet = 'ftruncate:ok'\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'ftruncateFileSyncTest fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\treadZipEntry() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\tfileManager.readZipEntry({\r\n\t\t\t\t\tfilePath: '/static/filemanager/to.zip',\r\n\t\t\t\t\tencoding: 'utf-8',\r\n\t\t\t\t\tsuccess: (res : EntriesResult) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readZipEntry success:size=' + res.result.size + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'readZipEntry fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log('fail', res)\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t} as ReadZipEntryOptions)\r\n\t\t\t},\r\n\t\t\ttestWriteReadFileBuffer() {\r\n\t\t\t\tconst fs = uni.getFileSystemManager()\r\n\t\t\t\tlet buffer = new ArrayBuffer(16)\r\n\t\t\t\tlet float64 = new Float64Array(buffer)\r\n\t\t\t\tfloat64[1] = 1.2222222\r\n\t\t\t\tlet that = this\r\n\t\t\t\tfs.writeFile({\r\n\t\t\t\t\tfilePath: `${uni.env.USER_DATA_PATH}/hello.txt`,\r\n\t\t\t\t\t// data: 'test some',\r\n\t\t\t\t\tdata: buffer,\r\n\t\t\t\t\t// encoding: 'ascii',\r\n\t\t\t\t\tsuccess(res) {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'testWriteReadFileBuffer :' + res.errMsg + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\t\t// that.testAppendFile()\r\n\t\t\t\t\t\tthat.testReadFileBuffer()\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail(res) {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'testWriteReadFileBuffer fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\r\n\t\t\t\t\t\tconsole.error(res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t} as WriteFileOptions)\r\n\t\t\t},\r\n\t\t\ttestReadFileBuffer() {\r\n\t\t\t\tconst fs = uni.getFileSystemManager()\r\n\t\t\t\tfs.readFile({\r\n\t\t\t\t\tfilePath: `${uni.env.USER_DATA_PATH}/hello.txt`,\r\n\r\n\t\t\t\t\tsuccess(res) {\r\n\r\n\t\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\t\t// let uint8Array = new Uint8Array(res.data as ArrayBuffer)\r\n\t\t\t\t\t\t// for (let i = 0; i < uint8Array.length; i++) {\r\n\t\t\t\t\t\t// \tconsole.log(`Byte ${i}: ${uint8Array[i]}`);\r\n\t\t\t\t\t\t// }\r\n\t\t\t\t\t\tlet float64 = new Float64Array(res.data as ArrayBuffer)\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tfor (let i = 0; i < float64.length; i++) {\r\n\t\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\t\tthis.log += 'testReadFileBuffer success :' + `Byte ${i}: ${float64[i]}` + '\\n\\n'\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.arrayBufferRes = float64[1] //1.2222222\r\n\t\t\t\t\t\tconsole.log(this.arrayBufferRes)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail(res) {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'testReadFileBuffer fail:' + JSON.stringify(res) + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tthis.lastFailError = new UniError(res.errSubject, res.errCode, res.errMsg)\r\n\t\t\t\t\t\tconsole.error(res)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} as ReadFileOptions)\r\n\t\t\t},\r\n\t\t\ttestWriteReadFileSyncBuffer() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fs = uni.getFileSystemManager()\r\n\t\t\t\t\tlet buffer = new ArrayBuffer(16)\r\n\t\t\t\t\t// let int8 = new Int8Array(buffer)\r\n\t\t\t\t\t// int8[1] = 20\r\n\t\t\t\t\tlet float64 = new Float64Array(buffer)\r\n\t\t\t\t\tfloat64[1] = 1.333\r\n\t\t\t\t\tfs.writeFileSync(`${uni.env.USER_DATA_PATH}/hello.txt`, buffer, 'utf-8')\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'testWriteReadFileSyncBuffer success' + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.testReadFileSyncBuffer()\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'testWriteReadFileSyncBuffer fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\t\t\ttestReadFileSyncBuffer() {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tconst fs = uni.getFileSystemManager()\r\n\t\t\t\t\tlet res = fs.readFileSync(`${uni.env.USER_DATA_PATH}/hello.txt`, null)\r\n\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\tlet float64 = new Float64Array(res as ArrayBuffer)\r\n\t\t\t\t\tfor (let i = 0; i < float64.length; i++) {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'testReadFileSyncBuffer success:' + `Byte ${i}: ${float64[i]}` + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(`Byte ${i}: ${float64[i]}`);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.arrayBufferRes = float64[1] // 1.333\r\n\t\t\t\t\tconsole.log(this.arrayBufferRes)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'testReadFileSyncBuffer fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t}\r\n\r\n\t\t\t},\r\n\r\n\t\t\ttestWriteReadBuffer() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.mkdirSync(`${this.basePath}${this.mkdirFile}`, true)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlet buffer = new ArrayBuffer(24)\r\n\t\t\t\tlet float64 = new Float64Array(buffer)\r\n\t\t\t\tfloat64[1] = 1.24\r\n\t\t\t\tfloat64[2] = 1.33\r\n\r\n\t\t\t\tlet that = this\r\n\t\t\t\tfileManager.write({\r\n\t\t\t\t\tfd: this.openFileSyncTest('w+', false),\r\n\t\t\t\t\tlength: 16,\r\n\t\t\t\t\toffset: 8,\r\n\t\t\t\t\tdata: buffer,\r\n\t\t\t\t\tposition: 10,\r\n\t\t\t\t\tsuccess: (res : WriteResult) => {\r\n\t\t\t\t\t\tconsole.log(\"success\", res)\r\n\r\n\t\t\t\t\t\tconst ab = new ArrayBuffer(24)\r\n\t\t\t\t\t\tfileManager.read({\r\n\t\t\t\t\t\t\tarrayBuffer: ab,\r\n\t\t\t\t\t\t\tfd: this.openFileSyncTest('a+', false),\r\n\t\t\t\t\t\t\tlength: 8,\r\n\t\t\t\t\t\t\tposition: 10,\r\n\t\t\t\t\t\t\tsuccess(res : ReadSuccessCallbackResult) {\r\n\t\t\t\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\t\t\t\tlet value = new Float64Array(res.arrayBuffer)\r\n\t\t\t\t\t\t\t\tfor (let i = 0; i < value.length; i++) {\r\n\t\t\t\t\t\t\t\t\tconsole.log(`Byte ${i}: ${value[i]}`);\r\n\t\t\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\t\t\tthis.log += 'testWriteReadBuffer success:' + `Byte ${i}: ${value[i]}` + '\\n\\n'\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tthis.arrayBufferRes = value[0] //1.24\r\n\t\t\t\t\t\t\t\tconsole.log(this.arrayBufferRes)\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\tfail(res) {\r\n\t\t\t\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\tcomplete: (res : any) => {\r\n\t\t\t\t\t\t\t\tconsole.log(\"complete\", res)\r\n\t\t\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} as ReadOption)\r\n\t\t\t\t\t},\r\n\t\t\t\t\tfail: (res : IUniError) => {\r\n\t\t\t\t\t\tthis.done = true\r\n\t\t\t\t\t\tif (res instanceof UniError) {\r\n\t\t\t\t\t\t\tthis.lastCompleteError = res\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: (_) => {\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t} as WriteOptions)\r\n\t\t\t},\r\n\t\t\ttestWriteReadSyncBuffer() {\r\n\t\t\t\tconst fileManager = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfileManager.mkdirSync(`${this.basePath}${this.mkdirFile}`, true)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t}\r\n\t\t\t\ttry {\r\n\r\n\t\t\t\t\tlet buffer = new ArrayBuffer(24)\r\n\t\t\t\t\tlet float64 = new Float64Array(buffer)\r\n\t\t\t\t\tfloat64[1] = 1.11\r\n\t\t\t\t\tfloat64[2] = 1.33\r\n\t\t\t\t\tlet ret = fileManager.writeSync({\r\n\t\t\t\t\t\tfd: this.openFileSyncTest('w+', false),\r\n\t\t\t\t\t\t// data: this.writeData,\r\n\t\t\t\t\t\tdata: buffer,\r\n\t\t\t\t\t\tlength: 16,\r\n\t\t\t\t\t\toffset: 8,\r\n\t\t\t\t\t\tposition: 10,\r\n\t\t\t\t\t\tencoding: \"utf-8\"\r\n\t\t\t\t\t} as WriteSyncOptions)\r\n\t\t\t\t\tconsole.log(\"success\", ret)\r\n\r\n\t\t\t\t\tconst ab = new ArrayBuffer(24)\r\n\t\t\t\t\tlet res = fileManager.readSync({\r\n\t\t\t\t\t\tarrayBuffer: ab,\r\n\t\t\t\t\t\tfd: this.openFileSyncTest('a+', false),\r\n\t\t\t\t\t\tlength: 8,\r\n\t\t\t\t\t\toffset: 8,\r\n\t\t\t\t\t\tposition: 10\r\n\t\t\t\t\t} as ReadSyncOption)\r\n\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\tlet value = new Float64Array(res.arrayBuffer)\r\n\t\t\t\t\tfor (let i = 0; i < value.length; i++) {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'testWriteReadSyncBuffer success :' + `Byte ${i}: ${value[i]}` + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tthis.arrayBufferRes = float64[1] //1.11\r\n\t\t\t\t\tconsole.log(this.arrayBufferRes)\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tif (e instanceof UniError) {\r\n\t\t\t\t\t\tthis.lastCompleteError = e\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\r\n\t\t\ttestAppendFileBufferSync() {\r\n\t\t\t\t// 同步接口\r\n\t\t\t\tconst fs = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet buffer = new ArrayBuffer(24)\r\n\t\t\t\t\tlet float64 = new Float64Array(buffer)\r\n\t\t\t\t\tfloat64[1] = 1.2222222\r\n\t\t\t\t\tfloat64[2] = 1.33\r\n\t\t\t\t\tlet ret = fs.writeSync({\r\n\t\t\t\t\t\tfd: fs.openSync({ filePath: `${uni.env.USER_DATA_PATH}/hello.txt`, flag: 'w+' } as OpenFileSyncOptions),\r\n\t\t\t\t\t\tdata: buffer,\r\n\t\t\t\t\t\tlength: 16,\r\n\t\t\t\t\t\toffset: 8,\r\n\t\t\t\t\t\tposition: 10\r\n\t\t\t\t\t} as WriteSyncOptions)\r\n\t\t\t\t\tconsole.log(ret)\r\n\r\n\r\n\t\t\t\t\tbuffer = new ArrayBuffer(16)\r\n\t\t\t\t\tfloat64 = new Float64Array(buffer)\r\n\t\t\t\t\tfloat64[0] = 20\r\n\t\t\t\t\tfs.appendFileSync(`${uni.env.USER_DATA_PATH}/hello.txt`, buffer, null)\r\n\t\t\t\t\tconst ab = new ArrayBuffer(32)\r\n\t\t\t\t\t// 打开文件\r\n\t\t\t\t\t// 读取文件到 ArrayBuffer 中\r\n\t\t\t\t\tlet readResult = fs.readSync({\r\n\t\t\t\t\t\tfd: fs.openSync({\r\n\t\t\t\t\t\t\tfilePath: `${uni.env.USER_DATA_PATH}/hello.txt`,\r\n\t\t\t\t\t\t\tflag: 'a+',\r\n\t\t\t\t\t\t} as OpenFileSyncOptions),\r\n\t\t\t\t\t\tarrayBuffer: ab,\r\n\t\t\t\t\t\tlength: 24,\r\n\t\t\t\t\t\tposition: 10,\r\n\t\t\t\t\t\toffset: 8\r\n\t\t\t\t\t} as ReadSyncOption)\r\n\t\t\t\t\tconsole.log(readResult)\r\n\t\t\t\t\tfloat64 = new Float64Array(readResult.arrayBuffer)\r\n\r\n\t\t\t\t\tfor (let i = 0; i < float64.length; i++) {\r\n\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\tthis.log += 'testAppendFileBufferSync success :' + `Byte ${i}: ${float64[i]}` + '\\n\\n'\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tconsole.log(`Byte ${i}: ${float64[i]}`);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.arrayBufferRes = float64[3] //20\r\n\t\t\t\t\tconsole.log(this.arrayBufferRes)\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'testAppendFileBufferSync fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\ttestAppendFileBuffer() {\r\n\t\t\t\t// 同步接口\r\n\t\t\t\tconst fs = uni.getFileSystemManager()\r\n\t\t\t\ttry {\r\n\t\t\t\t\tlet buffer = new ArrayBuffer(24)\r\n\t\t\t\t\tlet float64 = new Float64Array(buffer)\r\n\t\t\t\t\tfloat64[1] = 1.2222222\r\n\t\t\t\t\tfloat64[2] = 1.33\r\n\t\t\t\t\tlet ret = fs.writeSync({\r\n\t\t\t\t\t\tfd: fs.openSync({ filePath: `${uni.env.USER_DATA_PATH}/hello.txt`, flag: 'w+' } as OpenFileSyncOptions),\r\n\t\t\t\t\t\tdata: buffer,\r\n\t\t\t\t\t\tlength: 16,\r\n\t\t\t\t\t\toffset: 8,\r\n\t\t\t\t\t\tposition: 10\r\n\t\t\t\t\t} as WriteSyncOptions)\r\n\t\t\t\t\tconsole.log(ret)\r\n\r\n\t\t\t\t\tbuffer = new ArrayBuffer(16)\r\n\t\t\t\t\tfloat64 = new Float64Array(buffer)\r\n\t\t\t\t\tfloat64[0] = 21\r\n\t\t\t\t\tfs.appendFile({\r\n\t\t\t\t\t\tfilePath: `${uni.env.USER_DATA_PATH}/hello.txt`,\r\n\t\t\t\t\t\tdata: buffer,\r\n\t\t\t\t\t\tsuccess(res) {\r\n\t\t\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\t\t\tconst ab = new ArrayBuffer(32)\r\n\t\t\t\t\t\t\t// 打开文件\r\n\t\t\t\t\t\t\t// 读取文件到 ArrayBuffer 中\r\n\t\t\t\t\t\t\tlet readResult = fs.readSync({\r\n\t\t\t\t\t\t\t\tfd: fs.openSync({\r\n\t\t\t\t\t\t\t\t\tfilePath: `${uni.env.USER_DATA_PATH}/hello.txt`,\r\n\t\t\t\t\t\t\t\t\tflag: 'a+',\r\n\t\t\t\t\t\t\t\t} as OpenFileSyncOptions),\r\n\t\t\t\t\t\t\t\tarrayBuffer: ab,\r\n\t\t\t\t\t\t\t\tlength: 24,\r\n\t\t\t\t\t\t\t\tposition: 10,\r\n\t\t\t\t\t\t\t\toffset: 8\r\n\t\t\t\t\t\t\t} as ReadSyncOption)\r\n\t\t\t\t\t\t\tconsole.log(readResult)\r\n\t\t\t\t\t\t\tfloat64 = new Float64Array(readResult.arrayBuffer)\r\n\r\n\t\t\t\t\t\t\tfor (let i = 0; i < float64.length; i++) {\r\n\t\t\t\t\t\t\t\tconsole.log(`Byte ${i}: ${float64[i]}`);\r\n\t\t\t\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\t\t\t\tthis.log += 'testAppendFileBuffer success :' + `Byte ${i}: ${float64[i]}` + '\\n\\n'\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tthis.arrayBufferRes = float64[3] //21\r\n\t\t\t\t\t\t\tconsole.log(this.arrayBufferRes)\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tfail(res) {\r\n\t\t\t\t\t\t\tconsole.log(res)\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\tcomplete: (_) => {\r\n\t\t\t\t\t\t  this.done =true\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} as AppendFileOptions)\r\n\r\n\t\t\t\t} catch (e) {\r\n\t\t\t\t\tthis.done = true\r\n\t\t\t\t\tif (this.logAble) {\r\n\t\t\t\t\t\tthis.log += 'testAppendFileBufferSync fail:' + JSON.stringify(e) + '\\n\\n'\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconsole.error(e)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t},\r\n\r\n\t}\r\n</script>\r\n\r\n<style>\r\n\t.btnstyle {\r\n\t\tmargin: 4px;\r\n\t}\r\n</style>\r\n\n```\n:::"},"getUniverifyManager":{"name":"## uni.getUniverifyManager() @getuniverifymanager","description":"获取一键登录管理对象","compatibility":"### getUniverifyManager 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.99 | 4.18 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [UniverifyManager](#univerifymanager-values) |\n\n#### UniverifyManager 的方法 @univerifymanager-values \n\n#### preLogin(options : PreLoginOptions) : void @prelogin\n预登录\n##### preLogin 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.99 | 4.18 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **PreLoginOptions** | 是 | - | - | 预登录参数 |\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 | number | 是 | - | - | 1000 当前应用appid尚未开通uni一键登录<br/>1001 应用所有者账号信息异常,请检查账号一键登录服务是否正常<br/>1002 应用所有者账号信息异常,请检查账号余额是否充足<br/>1004 uni一键登录应用不存在<br/>4001 参数异常<br/>30004 其他错误<br/>30005 预登录失败<br/>30006 一键登录失败 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 1000 | - | - |\n@| 1001 | - | - |\n@| 1002 | - | - |\n@| 1004 | - | - |\n@| 4001 | - | - |\n@| 30004 | - | - |\n@| 30005 | - | - |\n@| 30006 | - | - |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### login(options : LoginOptions) : void @login\n登录\n##### login 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.99 | 4.18 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **LoginOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [LoginSuccess](#loginsuccess-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (result: [IUniError](#iunierror-values)) => void | 否 | - | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### LoginSuccess 的属性值 @loginsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | 描述信息 |\n| authResult | any | 是 | - | - | 登录服务商提供的登录信息,服务商不同返回的结果不完全相同 |\n| code | string | 是 | - | - | 小程序用户临时登录凭证 |\n| anonymousCode | string | 否 | - | - | 头条小程序当前设备标识 |\n| authCode | string | 否 | - | - | 支付宝小程序授权码 |\n| authErrorScope | any | 否 | - | - | 支付宝小程序登录失败的授权类型,key是授权失败的 scope,value 是对应的错误码 |\n| authSucessScope | Array\\<string\\> | 否 | - | - | 支付宝小程序登录成功的授权 scope |\n| appleInfo | **AppleLoginAppleInfo** | 否 | - | - | 苹果登录成功返回的信息 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| authorizationCode | string | 否 | - | - | 应用程序用来与服务器交互的令牌 |\n@| fullName | any | 否 | - | - | 返回身份的全名 |\n@| identityToken | string | 否 | - | - | 一个JSON Web令牌(JWT),可以安全地将用户信息传递给应用程序 |\n@| realUserStatus | number | 否 | - | - | 指示用户是否为真人 |\n@| user | string | 否 | - | - | 验证用户的标识符 |\n\n###### IUniError 的属性值 @iunierror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 统一错误码 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### close() : void @close\n关闭登录页\n##### close 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.99 | 4.18 |\n\n\n\n#### isPreLoginValid() : boolean @ispreloginvalid\n预登录是否有效\n##### isPreLoginValid 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.99 | 4.18 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| boolean |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.loginVerify.getUniverifyManager)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/univerify.html#univerifymanager)","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 >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/get-univerify-manager/get-univerify-manager\n```uvue\n<template>\r\n  <view>\r\n    <page-head :title=\"title\"></page-head>\r\n    <view class=\"uni-padding-wrap uni-common-mt\">\r\n      <view class=\"uni-btn-v uni-common-mt\">\r\n        <button type=\"primary\" @click=\"verify(false)\">一键登录(半屏)</button>\r\n      </view>\r\n      <view class=\"uni-btn-v uni-common-mt\">\r\n        <button type=\"primary\" @click=\"verify(true)\">一键登录(全屏)</button>\r\n      </view>\r\n    </view>\r\n  </view>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: '一键登录',\r\n        univerifyManager: null as UniverifyManager | null\r\n      }\r\n    },\r\n    onLoad() {\r\n      this.univerifyManager = uni.getUniverifyManager();\r\n      // 预登录\r\n      this.univerifyManager?.preLogin({\r\n        success: () => {\r\n          console.log(\"pre login success\");\r\n        },\r\n        fail: (err : PreLoginFail) => {\r\n          console.error(\"pre login fail => \" + JSON.stringify(err));\r\n          uni.showModal({\r\n            title: '预登录失败',\r\n            content: JSON.parseObject(err.cause?.cause?.message ?? \"\")?.getString(\"errorDesc\") ?? err.errMsg,\r\n            showCancel: false\r\n          });\r\n        }\r\n      } as PreLoginOptions);\r\n    },\r\n    methods: {\r\n      verify(fullScreen : boolean) {\r\n        // 校验预登录是否有效\r\n        const isPreLoginValid = this.univerifyManager?.isPreLoginValid() ?? false;\r\n        if (isPreLoginValid) {\r\n          // 预登录有效,执行登录\r\n          this.login(fullScreen);\r\n        } else {\r\n          // 预登录无效,执行预登录\r\n          this.univerifyManager?.preLogin({\r\n            success: () => {\r\n              console.log(\"pre login success\");\r\n              this.login(fullScreen);\r\n            },\r\n            fail: (err : PreLoginFail) => {\r\n              console.error(\"pre login fail => \" + JSON.stringify(err));\r\n              uni.showModal({\r\n                title: '预登录失败',\r\n                content: JSON.parseObject(err.cause?.cause?.message ?? \"\")?.getString(\"errorDesc\") ?? err.errMsg,\r\n                showCancel: false\r\n              });\r\n            }\r\n          } as PreLoginOptions);\r\n        }\r\n      },\r\n      login(fullScreen : boolean) {\r\n        this.univerifyManager?.login({\r\n          // 登录页样式\r\n          univerifyStyle: {\r\n            fullScreen: fullScreen,\r\n            backgroundColor: \"#FFFFFF\",\r\n            loginBtnText: \"一键登录\",\r\n            logoPath: \"/static/logo.png\"\r\n          } as UniverifyStyle,\r\n          success: (res : LoginSuccess) => {\r\n            console.log(\"login success => \" + JSON.stringify(res));\r\n            // 云函数取号\r\n            uniCloud.callFunction({\r\n              name: 'univerify',\r\n              data: {\r\n                access_token: res.accessToken, // 客户端一键登录接口返回的access_token\r\n                openid: res.openId // 客户端一键登录接口返回的openid\r\n              }\r\n            }).then(res => {\r\n              // 关闭登录页\r\n              this.univerifyManager?.close();\r\n              setTimeout(() => {\r\n                uni.showModal({\r\n                  title: '取号成功',\r\n                  content: res.result.getJSON(\"res\")?.getString(\"phoneNumber\"),\r\n                  showCancel: false\r\n                });\r\n              }, 100);\r\n            }).catch(err => {\r\n              console.error(JSON.stringify(err));\r\n              // 关闭登录页\r\n              this.univerifyManager?.close();\r\n              setTimeout(() => {\r\n                uni.showModal({\r\n                  title: '取号失败',\r\n                  content: (err as Error).message,\r\n                  showCancel: false\r\n                });\r\n              }, 100);\r\n            });\r\n          },\r\n          fail: (err : LoginFail) => {\r\n            console.error(\"login fail => \" + err);\r\n            uni.showModal({\r\n              title: '登录失败',\r\n              content: JSON.parseObject(err.cause?.cause?.message ?? \"\")?.getString(\"errorDesc\") ?? err.errMsg,\r\n              showCancel: false\r\n            });\r\n          }\r\n        } as LoginOptions);\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n\n```\n:::"},"getFacialRecognitionMetaInfo":{"name":"## uni.getFacialRecognitionMetaInfo() @getfacialrecognitionmetainfo","description":"获取阿里云实人认证meta info","compatibility":"### getFacialRecognitionMetaInfo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9 | 4.11 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| string |\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.loginVerify.facialRecognitionMetaInfo.getFacialRecognitionMetaInfo)"},"startFacialRecognitionVerify":{"name":"## uni.startFacialRecognitionVerify(faceStyle) @startfacialrecognitionverify","description":"启动人脸识别","compatibility":"### startFacialRecognitionVerify 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| faceStyle | **StartFacialRecognitionVerifyOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| certifyId | string | 是 | - | - | certifyId 调用实人认证的id |\n@| progressBarColor | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 活体检测页面的进度条颜色。<br/> |\n@| screenOrientation | string | 否 | \"port\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 认证时屏幕方向 |\n@@| 合法值 | 兼容性 | 描述 |\n@@| :- |  :-: | :- |\n@@| land | - | 横屏 |\n@@| port | - | 竖屏 |\n@| success | (res: [StartFacialRecognitionVerifySuccess](#startfacialrecognitionverifysuccess-values)) => void | 否 | - | - | 成功回调 |\n@| fail | (res: [IFacialRecognitionVerifyError](#ifacialrecognitionverifyerror-values)) => void | 否 | - | - | 失败回调 |\n@| complete | (res: any) => void | 否 | - | - | 完成回调 | \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 | 否 | - | - | 源错误模块名称 |\n@| message | string | 是 | - | - | 源错误描述信息 |\n@| code | number | 是 | - | - | 源错误的错误码 |\n@| name | string | 是 | - | - | - |\n@| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - |  |\n\n#### IFacialRecognitionVerifyError 的属性值 @ifacialrecognitionverifyerror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 10001 | - | certifyId 不能为空 |\n@| 10002 | - | 当前设备不支持 |\n@| 10010 | - | 刷脸异常 |\n@| 10011 | - | 验证中断 |\n@| 10012 | - | 网络异常 |\n@| 10013 | - | 刷脸验证失败 |\n@| 10020 | - | 设备设置时间异常 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.loginVerify.facialRecognitionMetaInfo.startFacialRecognitionVerify)"},"facialRecognitionMetaInfo":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/facial-recognition-meta-info/facial-recognition-meta-info.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/facial-recognition-meta-info/facial-recognition-meta-info\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view class=\"page-scroll-view\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <input class=\"uni-input\" type=\"text\" v-model=\"realName\" name=\"real-name\" placeholder=\"姓名\" maxlength=\"-1\" />\r\n        </view>\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <input class=\"uni-input\" type=\"text\" v-model=\"idCard\" name=\"id-card\" placeholder=\"身份证号\" maxlength=\"-1\" />\r\n        </view>\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @click=\"facialRecognition\">开始人脸识别</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: '实人认证',\r\n        realName: '',\r\n        idCard: ''\r\n      }\r\n    },\r\n    onReady() {\r\n    },\r\n    methods: {\r\n      facialRecognition() {\r\n        const realName = this.realName.trim()\r\n        const idCard = this.idCard.trim()\r\n        if (realName == '' || idCard == '') {\r\n          uni.showModal({\r\n            title: '错误',\r\n            content: '姓名和身份证号不可为空',\r\n            showCancel: false\r\n          })\r\n          return\r\n        }\r\n        const testFacialCo = uniCloud.importObject('facial-recognition-co')\r\n        let metaInfo = uni.getFacialRecognitionMetaInfo();\r\n        testFacialCo.getCertifyId({\r\n          realName,\r\n          idCard,\r\n          metaInfo\r\n        })\r\n          .then((res : UTSJSONObject) : Promise<string> => {\r\n            const certifyId = res['certifyId'] as string\r\n            return new Promise((\r\n              resolve : (res : string) => void,\r\n              reject : (err : Error) => void\r\n            ) => {\r\n              uni.startFacialRecognitionVerify({\r\n                certifyId,\r\n                success() {\r\n                  resolve(certifyId)\r\n                },\r\n                fail(err) {\r\n                  reject(new Error(err.errMsg))\r\n                }\r\n              })\r\n            })\r\n          })\r\n          .then((certifyId : string) : Promise<UTSJSONObject> => {\r\n            return testFacialCo.getAuthResult(certifyId)\r\n          })\r\n          .then((res : UTSJSONObject) => {\r\n            console.log('res', res)\r\n          })\r\n          .catch((err : any | null) => {\r\n            console.error('error', err)\r\n          })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n</style>\n\n```\n:::"},"createRewardedVideoAd":{"name":"## uni.createRewardedVideoAd(option) @createrewardedvideoad","description":"创建激励视频广告对象","compatibility":"### createRewardedVideoAd 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | **CreateRewardedVideoAdOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| adpid | string | 是 | - | - | 广告位 id |\n@| urlCallback | **UrlCallbackOptions** | 否 | - | - | 服务器回调透传参数 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| userId | string | 否 | - | - | 透传到服务器端的userId |\n@@| extra | string | 否 | - | - | 透传到服务器端的extra,不推荐设置过于复杂的字符串 | \n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [RewardedVideoAd](#rewardedvideoad-values) |\n\n#### RewardedVideoAd 的方法 @rewardedvideoad-values \n\n#### show() : Promise\\<any> @show\n广告加载成功之后,调用此方法展示广告\n##### show 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Promise\\<any> |\n \n\n#### load() : Promise\\<any> @load\n加载广告\n##### load 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Promise\\<any> |\n \n\n#### destroy() : void @destroy\n销毁广告\n##### destroy 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n\n\n#### onLoad(callback : AdCallBackEvent) : void @onload\n绑定广告 load 事件的监听器\n##### onLoad 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### offLoad(callback : AdCallBackEvent) : void @offload\n解除绑定 load 事件的监听器\n##### offLoad 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### onError(callback : AdErrorCallBackEvent) : void @onerror\n绑定 error 事件的监听器\n##### onError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | - | \n\n##### IUniAdError 的属性值 @iuniaderror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码<br/>- -5001 广告位标识adpid为空,请传入有效的adpid<br/>- -5002 无效的广告位标识adpid,请使用正确的adpid<br/>- -5003 广告位未开通广告,请在广告平台申请并确保已审核通过<br/>- -5004 无广告模块,打包时请配置要使用的广告模块<br/>- -5005 广告加载失败,请稍后重试<br/>- -5006 广告已经展示过了,请重新加载<br/>- -5007 广告不可用或已过期,请重新请求<br/>- -5008 广告不可用或已过期,请重新请求<br/>- -5009 广告类型不符,请检查后再试<br/>- -5011 打包或开通的渠道,不支持此类型广告<br/>- -5013 广告播放失败,请重新加载 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### offError(callback : AdErrorCallBackEvent) : void @offerror\n解除绑定 error 事件的监听器\n##### offError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | - | \n\n\n#### onClose(callback : AdCloseCallBackEvent) : void @onclose\n绑定 close 事件的监听器\n##### onClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\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#### offClose(callback : AdCloseCallBackEvent) : void @offclose\n解除绑定 close 事件的监听器\n##### offClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [VideoAdClose](#videoadclose-values)) => void | 是 | - | - | - | \n\n\n#### onAdClicked(callback : AdCallBackEvent) : void; @onadclicked\n绑定广告可点击屏幕区域事件的监听器\n##### onAdClicked 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### onVerify(callback : AdVerifyCallBackEvent) : void; @onverify\n绑定 verify 事件的监听器\n##### onVerify 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.22 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: UTSJSONObject) => void | 是 | - | - | - | \n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ad.createRewardedVideoAd)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createRewardedVideoAd&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createRewardedVideoAd&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createRewardedVideoAd&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createRewardedVideoAd&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createRewardedVideoAd&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createRewardedVideoAd)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createRewardedVideoAd&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/create-rewarded-video-ad/create-rewarded-video-ad.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/create-rewarded-video-ad/create-rewarded-video-ad\n```uvue\n<template>\r\n  <page-head title=\"激励视频广告\"></page-head>\r\n  <button :type=\"btnType\" style=\"margin: 10px;\" :disabled=\"btnDisable\" @click=\"showAd()\">{{btnText}}</button>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        btnText: \"\",\r\n        btnType: \"primary\",\r\n        btnDisable: false,\r\n        rewardAd: null as RewardedVideoAd | null,\r\n        isAdLoadSuccess: false\r\n      }\r\n    },\r\n    onReady() {\r\n      this.loadAd()\r\n    },\r\n    methods: {\r\n      loadAd() {\r\n        if (this.btnDisable)\r\n          return\r\n        this.btnDisable = true\r\n        this.btnText = \"正在加载广告\"\r\n        this.btnType = \"primary\"\r\n        if (this.rewardAd == null) {\r\n          this.rewardAd = uni.createRewardedVideoAd({\r\n            adpid: \"1507000689\" //此处为测试广告位,实际开发中请在uni-ad后台申请自己的广告位后替换\r\n          })\r\n          this.rewardAd!.onError((_) => {\r\n            this.btnType = \"warn\"\r\n            this.btnText = \"广告加载失败,点击重试\"\r\n            this.btnDisable = false\r\n          })\r\n          this.rewardAd!.onLoad((_) => {\r\n            this.btnType = \"primary\"\r\n            this.btnText = \"广告加载成功,点击观看\"\r\n            this.btnDisable = false\r\n            this.isAdLoadSuccess = true\r\n          })\r\n          this.rewardAd!.onClose((e) => {\r\n            // 测试广告位无法通过服务器回调。实际开发中,使用自己的广告位后,需参考uni-ad文档编写服务器回调的代码,在服务端发放奖励\r\n            this.isAdLoadSuccess = false\r\n            uni.showToast({\r\n              title: \"激励视频\" + (e.isEnded ? \"\" : \"未\") + \"播放完毕\",\r\n              position: \"bottom\"\r\n            })\r\n            this.loadAd()\r\n          })\r\n        }\r\n        this.rewardAd!.load()\r\n      },\r\n      showAd() {\r\n        if (this.isAdLoadSuccess) {\r\n          this.rewardAd!.show()\r\n        } else {\r\n          this.loadAd()\r\n        }\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n\n```\n:::"},"createInterstitialAd":{"name":"## uni.createInterstitialAd(option) @createinterstitialad","description":"创建插屏广告对象","compatibility":"### createInterstitialAd 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| option | (option: [CreateInterstitialAdOptions](#createinterstitialadoptions-values)) => [InterstitialAd](#interstitialad-values) | 是 | - | - | - | \n\n### CreateInterstitialAdOptions 的属性值 @createinterstitialadoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| adpid | string | 是 | - | - | 广告位 id |\n\n### InterstitialAd 的方法 @interstitialad-values \n\n### show() : Promise\\<any> @show\n广告加载成功之后,调用此方法展示广告\n#### show 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n\n#### 返回值  \n\n| 类型 |\n| :- |\n| Promise\\<any> |\n \n\n### load() : Promise\\<any> @load\n加载广告\n#### load 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n\n#### 返回值  \n\n| 类型 |\n| :- |\n| Promise\\<any> |\n \n\n### destroy() : void @destroy\n销毁广告\n#### destroy 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n\n\n### onLoad(callback : AdCallBackEvent) : void @onload\n绑定广告 load 事件的监听器\n#### onLoad 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n### offLoad(callback : AdCallBackEvent) : void @offload\n解除绑定 load 事件的监听器\n#### offLoad 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n### onError(callback : AdErrorCallBackEvent) : void @onerror\n绑定 error 事件的监听器\n#### onError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | - | \n\n\n### offError(callback : AdErrorCallBackEvent) : void @offerror\n解除绑定 error 事件的监听器\n#### offError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | - | \n\n\n### onClose(callback : AdCallBackEvent) : void @onclose\n绑定 close 事件的监听器\n#### onClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n### offClose(callback : AdCallBackEvent) : void @offclose\n解除绑定 close 事件的监听器\n#### offClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n### onAdClicked(callback : AdCallBackEvent) : void; @onadclicked\n绑定广告可点击屏幕区域事件的监听器\n#### onAdClicked 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n#### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [InterstitialAd](#interstitialad-values) |\n\n#### InterstitialAd 的方法 @interstitialad-values \n\n#### show() : Promise\\<any> @show\n广告加载成功之后,调用此方法展示广告\n##### show 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Promise\\<any> |\n \n\n#### load() : Promise\\<any> @load\n加载广告\n##### load 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Promise\\<any> |\n \n\n#### destroy() : void @destroy\n销毁广告\n##### destroy 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n\n\n#### onLoad(callback : AdCallBackEvent) : void @onload\n绑定广告 load 事件的监听器\n##### onLoad 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### offLoad(callback : AdCallBackEvent) : void @offload\n解除绑定 load 事件的监听器\n##### offLoad 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### onError(callback : AdErrorCallBackEvent) : void @onerror\n绑定 error 事件的监听器\n##### onError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | - | \n\n##### IUniAdError 的属性值 @iuniaderror-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码<br/>- -5001 广告位标识adpid为空,请传入有效的adpid<br/>- -5002 无效的广告位标识adpid,请使用正确的adpid<br/>- -5003 广告位未开通广告,请在广告平台申请并确保已审核通过<br/>- -5004 无广告模块,打包时请配置要使用的广告模块<br/>- -5005 广告加载失败,请稍后重试<br/>- -5006 广告已经展示过了,请重新加载<br/>- -5007 广告不可用或已过期,请重新请求<br/>- -5008 广告不可用或已过期,请重新请求<br/>- -5009 广告类型不符,请检查后再试<br/>- -5011 打包或开通的渠道,不支持此类型广告<br/>- -5013 广告播放失败,请重新加载 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### offError(callback : AdErrorCallBackEvent) : void @offerror\n解除绑定 error 事件的监听器\n##### offError 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [IUniAdError](#iuniaderror-values)) => void | 是 | - | - | - | \n\n\n#### onClose(callback : AdCallBackEvent) : void @onclose\n绑定 close 事件的监听器\n##### onClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### offClose(callback : AdCallBackEvent) : void @offclose\n解除绑定 close 事件的监听器\n##### offClose 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n\n#### onAdClicked(callback : AdCallBackEvent) : void; @onadclicked\n绑定广告可点击屏幕区域事件的监听器\n##### onAdClicked 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: any) => void | 是 | - | - | - | \n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.ad.createInterstitialAd)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createInterstitialAd&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createInterstitialAd&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createInterstitialAd&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createInterstitialAd&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createInterstitialAd&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createInterstitialAd)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createInterstitialAd&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/create-interstitial-ad/create-interstitial-ad.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/create-interstitial-ad/create-interstitial-ad\n```uvue\n<template>\r\n  <page-head title=\"插屏广告\"></page-head>\r\n  <button :type=\"btnType\" style=\"margin: 10px;\" :disabled=\"btnDisable\" @click=\"showAd()\">{{btnText}}</button>\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        btnText: \"\",\r\n        btnType: \"primary\",\r\n        btnDisable: false,\r\n        interstitialAd: null as InterstitialAd | null,\r\n        isAdLoadSuccess: false\r\n      }\r\n    },\r\n    onReady() {\r\n      this.loadAd()\r\n    },\r\n    methods: {\r\n      loadAd() {\r\n        if (this.btnDisable)\r\n          return\r\n        this.btnDisable = true\r\n        this.btnText = \"正在加载广告\"\r\n        this.btnType = \"primary\"\r\n        if (this.interstitialAd == null) {\r\n          this.interstitialAd = uni.createInterstitialAd({\r\n            adpid: \"1111111113\" //此处为测试广告位,实际开发中请在uni-ad后台申请自己的广告位后替换\r\n          })\r\n          this.interstitialAd!.onError((_) => {\r\n            this.btnType = \"warn\"\r\n            this.btnText = \"广告加载失败,点击重试\"\r\n            this.btnDisable = false\r\n          })\r\n          this.interstitialAd!.onLoad((_) => {\r\n            this.btnType = \"primary\"\r\n            this.btnText = \"广告加载成功,点击观看\"\r\n            this.btnDisable = false\r\n            this.isAdLoadSuccess = true\r\n          })\r\n          this.interstitialAd!.onClose((e) => {\r\n            this.isAdLoadSuccess = false\r\n            this.loadAd()\r\n          })\r\n        }\r\n        this.interstitialAd!.load()\r\n      },\r\n      showAd() {\r\n        if (this.isAdLoadSuccess) {\r\n          this.interstitialAd!.show()\r\n        } else {\r\n          this.loadAd()\r\n        }\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n\n```\n:::"},"requestPayment":{"name":"## uni.requestPayment(options) @requestpayment","description":"请求支付","compatibility":"### requestPayment 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.02 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **RequestPaymentOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| provider | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 支付服务提供商,通过 [uni.getProvider](https://doc.dcloud.net.cn/uni-app-x/api/provider.html) 获取,目前支持支付宝支付(alipay),微信支付(wxpay) |\n@| orderInfo | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 订单数据 |\n@| success | (result: [RequestPaymentSuccess](#requestpaymentsuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IRequestPaymentFail](#irequestpaymentfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### RequestPaymentSuccess 的属性值 @requestpaymentsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| data | any | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 返回数据 |\n\n#### IRequestPaymentFail 的属性值 @irequestpaymentfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 700000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 其它支付错误。 |\n@| 700600 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 正在处理中,支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态 |\n@| 700601 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 用户中途取消。 |\n@| 700602 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 网络连接出错。 |\n@| 700603 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 支付结果未知(有可能已经支付成功),请查询商家订单列表中订单的支付状态。 |\n@| 700604 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 微信没有安装。 |\n@| 700605 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 服务供应商获取失败。 |\n@| 700607 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.31\",\"4.31\"]]}' /> | 支付未完成。 |\n@| 700608 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.31\",\"4.31\"]]}' /> | 服务商返回参数错误。 |\n@| 700800 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 没有配置对应的URL Scheme。 |\n@| 700801 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 没有配置对应的Universal Link。 |\n@| 701100 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 订单支付失败。 |\n@| 701110 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.02\",\"4.18\"]]}' /> | 重复请求。 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.payment.requestPayment)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/plugins/payment.html#requestpayment)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=requestPayment&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=requestPayment&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=requestPayment&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=requestPayment&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=requestPayment&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=requestPayment)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=requestPayment&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/request-payment/request-payment.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/request-payment/request-payment\n```uvue\n<template>\r\n  <page-head title=\"发起支付\"></page-head>\r\n\r\n  <template v-if=\"providerList.length > 0\">\r\n    <button style=\"margin-top: 20px;\" type=\"primary\" v-for=\"(item,index) in providerList\" :key=\"index\"\r\n      @click=\"requestPayment(item)\">{{item.name}}</button>\r\n  </template>\r\n</template>\r\n\r\n<script>\r\n  export type PayItem = { id : string, name : string, provider ?: UniProvider }\r\n  export default {\r\n    data() {\r\n      return {\r\n        btnText: \"支付宝支付\",\r\n        btnType: \"primary\",\r\n        orderInfo: \"\",\r\n        errorCode: 0,\r\n        errorMsg: \"\",\r\n        complete: false,\r\n        providerList: [] as PayItem[]\r\n      }\r\n    },\r\n    onLoad: function () {\r\n      let provider = uni.getProviderSync({\r\n        service: \"payment\",\r\n      } as GetProviderSyncOptions)\r\n      console.log(provider)\r\n      provider.providerObjects.forEach((value : UniProvider) => {\r\n        switch (value.id) {\r\n          case 'alipay':\r\n            var aliPayProvider = value as UniPaymentAlipayProvider\r\n            console.log('alipay', aliPayProvider)\r\n            this.providerList.push({\r\n              name: aliPayProvider.description,\r\n              id: aliPayProvider.id,\r\n              provider: aliPayProvider\r\n            } as PayItem);\r\n            break;\r\n          case 'wxpay':\r\n            var wxPayProvider = value as UniPaymentWxpayProvider\r\n            console.log('wxpay', wxPayProvider)\r\n            this.providerList.push({\r\n              name: wxPayProvider.description,\r\n              id: wxPayProvider.id,\r\n              provider: wxPayProvider\r\n            } as PayItem);\r\n            break;\r\n          default:\r\n            break;\r\n        }\r\n      })\r\n    },\r\n    methods: {\r\n      requestPayment(e : PayItem) {\r\n        const provider = e.id\r\n        if (provider == \"alipay\") {\r\n          this.payAli(provider)\r\n        } else if (provider == \"wxpay\") {\r\n          // #ifdef APP-ANDROID\r\n          if (e.provider != null && e.provider instanceof UniPaymentWxpayProvider && !((e.provider as UniPaymentWxpayProvider).isWeChatInstalled)) {\r\n            uni.showToast({\r\n              title: \"微信没有安装\",\r\n              icon: 'error'\r\n            })\r\n          } else {\r\n            this.payWX(provider)\r\n          }\r\n          // #endif\r\n          // #ifdef APP-IOS\r\n          if (e.provider != null && ((e.provider as UniPaymentWxpayProvider).isWeChatInstalled == undefined || ((e.provider as UniPaymentWxpayProvider).isWeChatInstalled != null && (e.provider as UniPaymentWxpayProvider).isWeChatInstalled == false))) {\r\n            uni.showToast({\r\n              title: \"微信没有安装\",\r\n              icon: 'error'\r\n            })\r\n          } else {\r\n            this.payWX(provider)\r\n          }\r\n          // #endif\r\n        }\r\n      },\r\n      payAli(id:string) {\r\n        uni.showLoading({\r\n          title: \"请求中...\"\r\n        })\r\n        uni.request({\r\n          url: 'https://demo.dcloud.net.cn/payment/alipay/?total=0.01',\r\n          method: 'GET',\r\n          timeout: 6000,\r\n          success: (res) => {\r\n            this.orderInfo = JSON.stringify(res.data);\r\n            console.log(\"====\" + this.orderInfo)\r\n            uni.hideLoading()\r\n            uni.requestPayment({\r\n              provider: id,\r\n              orderInfo: res.data as string,\r\n              fail: (res) => {\r\n                console.log(JSON.stringify(res))\r\n                this.errorCode = res.errCode\r\n                uni.showToast({\r\n                  icon: 'error',\r\n                  title: 'errorCode:' + this.errorCode\r\n                });\r\n              },\r\n              success: (res) => {\r\n                console.log(JSON.stringify(res))\r\n                uni.showToast({\r\n                  icon: 'success',\r\n                  title: '支付成功'\r\n                });\r\n              }\r\n            })\r\n          },\r\n          fail: (e) => {\r\n            console.log(e)\r\n            uni.hideLoading()\r\n          },\r\n        });\r\n      },\r\n      payWX(id:string) {\r\n        uni.showLoading({\r\n          title: \"请求中...\"\r\n        })\r\n        let url = 'https://demo.dcloud.net.cn/payment/wxpayv3.__UNI__uniappx/?total=0.01'\r\n        const res = uni.getAppBaseInfo();\r\n        let packageName : string | null\r\n\r\n        // #ifdef APP-ANDROID\r\n        packageName = res.packageName\r\n        // #endif\r\n\r\n        // #ifdef APP-IOS\r\n        packageName = res.bundleId\r\n        // #endif\r\n\r\n        if (packageName == 'io.dcloud.hellouniappx') {//hello uniappx\r\n          url = 'https://demo.dcloud.net.cn/payment/wxpayv3.__UNI__HelloUniAppX/?total=0.01'\r\n        }\r\n        uni.request({\r\n          url: url,\r\n          method: 'GET',\r\n          timeout: 6000,\r\n          header: {\r\n            \"Content-Type\": \"application/json\"\r\n          } as UTSJSONObject,\r\n          success: (res) => {\r\n            console.log(res.data)\r\n            uni.hideLoading()\r\n            uni.requestPayment({\r\n              provider: id,\r\n              orderInfo: JSON.stringify(res.data),\r\n              fail: (res) => {\r\n                console.log(JSON.stringify(res))\r\n                this.errorCode = res.errCode\r\n                uni.showToast({\r\n                  duration: 5000,\r\n                  icon: 'error',\r\n                  title: 'errorCode:' + this.errorCode,\r\n                });\r\n              },\r\n              success: (res) => {\r\n                console.log(JSON.stringify(res))\r\n                uni.showToast({\r\n                  duration: 5000,\r\n                  icon: 'success',\r\n                  title: '支付成功'\r\n                });\r\n              }\r\n            })\r\n          },\r\n          fail: (res) => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n          },\r\n        });\r\n      },\r\n\r\n      //自动化测试使用\r\n      jest_pay() {\r\n        uni.requestPayment({\r\n          provider: \"alipay\",\r\n          orderInfo: this.orderInfo,\r\n          fail: (res : RequestPaymentFail) => {\r\n            this.errorCode = res.errCode\r\n            this.complete = true\r\n          },\r\n          success: (res : RequestPaymentSuccess) => {\r\n            console.log(JSON.stringify(res))\r\n            this.complete = true\r\n          }\r\n        } as RequestPaymentOptions)\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n\n```\n:::"},"requestVirtualPayment":{"name":"## uni.requestVirtualPayment(options) @requestvirtualpayment","description":"请求支付","compatibility":"### requestVirtualPayment 兼容性 \n| Web | Android | iOS 系统版本 | iOS |\n| :- | :- | :- | :- |\n| x | x | 15.0 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **RequestVirtualPaymentOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| apple | **AppleIAPOptions** | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 苹果IAP的参数 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| productId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 产品id,在苹果开发者中心配置 |\n@@| appAccountToken | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 透传参数,一般用于标记订单和用户的关系,可以用来验证和关联用户账户和购买记录 |\n@@| quantity | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 购买数量,默认是1,最小值是1,最大值是10 |\n@@| promotionalOffer | **AppleIAPPromotionalOffer** | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 促销优惠参数说明 |\n@@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@@| :- | :- | :- | :- |  :-: | :- |\n@@@| offerIdentifier | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 促销id |\n@@@| keyIdentifier | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 密钥 |\n@@@| nonce | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 唯一id (必须小写 24小时有效) |\n@@@| signature | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 签名 |\n@@@| timestamp | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 创建证书的时间戳(毫秒 24小时有效) |\n@| success | (result: [RequestVirtualPaymentSuccess](#requestvirtualpaymentsuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IRequestVirtualPaymentFail](#irequestvirtualpaymentfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n#### RequestVirtualPaymentSuccess 的属性值 @requestvirtualpaymentsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| apple | **AppleIAPTransactionOptions** | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 支付成功返回结果 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| productId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 产品id,和苹果开发者中心配置的一样 |\n@| appAccountToken | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 透传参数,一般用于标记订单和用户的关系,可以用来验证和关联用户账户和购买记录 |\n@| quantity | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 购买数量 |\n@| transactionDate | Date | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 交易日期,示例 2022-01-01 08:00:00 |\n@| transactionIdentifier | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 交易唯一标识 |\n@| originalTransactionDate | Date | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 原始交易日期,示例 2022-01-01 08:00:00 |\n@| originalTransactionIdentifier | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 原始交易唯一标识 |\n@| jsonRepresentation | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 支付票据 |\n\n#### IRequestVirtualPaymentFail 的属性值 @irequestvirtualpaymentfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 700000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 其他未知错误。 |\n@| 700600 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 正在处理中,支付结果未知 |\n@| 700601 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 用户中途取消。 |\n@| 700602 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 网络连接出错。 |\n@| 700604 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 不允许App内购买项目, 请授权应用内购买权限。 |\n@| 700605 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 产品无效。 |\n@| 700606 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 促销信息错误。 |\n@| 700607 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 缺少支付参数。 |\n@| 700800 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 只支持iOS15以上的版本。 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.payment.virtualPayment.requestVirtualPayment)"},"getVirtualPaymentManager":{"name":"## uni.getVirtualPaymentManager() @getvirtualpaymentmanager","description":"获取各平台虚拟支付的管理类,用于操作各平台专有的API。","compatibility":"### getVirtualPaymentManager 兼容性 \n| Web | Android | iOS 系统版本 | iOS |\n| :- | :- | :- | :- |\n| x | x | 15.0 | 4.25 |\n","param":"","returnValue":"### 返回值  \n\n| 类型 | 描述 |\n| :- | :- |\n| () => [VirtualPaymentManager](#virtualpaymentmanager-values) | virtual-payment的管理类 |\n\n#### VirtualPaymentManager 的方法 @virtualpaymentmanager-values \n\n#### restoreTransactions(options : AppleIAPRestoreOptions) : void; @restoretransactions\n恢复苹果服务器已支付的交易列表\n##### restoreTransactions 兼容性 \n| Web | Android | iOS 系统版本 | iOS |\n| :- | :- | :- | :- |\n| x | x | 15.0 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **AppleIAPRestoreOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [AppleIAPRestoreSuccess](#appleiaprestoresuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IAppleIAPRestoreFail](#iappleiaprestorefail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### AppleIAPRestoreSuccess 的属性值 @appleiaprestoresuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| transactions | Array\\<**AppleIAPTransactionOptions**\\> | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 返回的交易列表 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| productId | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 产品id,和苹果开发者中心配置的一样 |\n@| appAccountToken | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 透传参数,一般用于标记订单和用户的关系,可以用来验证和关联用户账户和购买记录 |\n@| quantity | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 购买数量 |\n@| transactionDate | Date | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 交易日期,示例 2022-01-01 08:00:00 |\n@| transactionIdentifier | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 交易唯一标识 |\n@| originalTransactionDate | Date | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 原始交易日期,示例 2022-01-01 08:00:00 |\n@| originalTransactionIdentifier | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 原始交易唯一标识 |\n@| jsonRepresentation | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 支付票据 |\n\n###### IAppleIAPRestoreFail 的属性值 @iappleiaprestorefail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 700600 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | apple restore 请求失败。 |\n@| 700601 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 用户中途取消。 |\n@| 700602 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 网络连接出错。 |\n@| 700800 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 只支持iOS15以上的版本。 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### getUnfinishedTransactions(options : AppleIAPUnfinishedTransactionOptions) : void; @getunfinishedtransactions\n获取苹果服务器已支付且未关闭的交易列表\n##### getUnfinishedTransactions 兼容性 \n| Web | Android | iOS 系统版本 | iOS |\n| :- | :- | :- | :- |\n| x | x | 15.0 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **AppleIAPUnfinishedTransactionOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [AppleIAPUnfinishedTransactionSuccess](#appleiapunfinishedtransactionsuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IAppleIAPUnfinishedTransactionFail](#iappleiapunfinishedtransactionfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### AppleIAPUnfinishedTransactionSuccess 的属性值 @appleiapunfinishedtransactionsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| transactions | Array\\<[AppleIAPTransactionOptions](#appleiaptransactionoptions-values)\\> | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 返回的交易列表 |\n\n###### IAppleIAPUnfinishedTransactionFail 的属性值 @iappleiapunfinishedtransactionfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | - | 错误码<br/>- 700800  只支持iOS15以上的版本。 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n\n#### finishTransaction(options : AppleIAPFinishTransactionOptions) : void; @finishtransaction\n关闭苹果服务器订单\n##### finishTransaction 兼容性 \n| Web | Android | iOS 系统版本 | iOS |\n| :- | :- | :- | :- |\n| x | x | 15.0 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **AppleIAPFinishTransactionOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| transaction | [AppleIAPTransactionOptions](#appleiaptransactionoptions-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 交易对象 |\n@| success | (result: [AppleIAPFinishTransactionSuccess](#appleiapfinishtransactionsuccess-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用成功的回调函数 |\n@| fail | (result: [IAppleIAPFinishTransactionFail](#iappleiapfinishtransactionfail-values)) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### AppleIAPFinishTransactionSuccess 的属性值 @appleiapfinishtransactionsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| state | boolean | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 关单状态 |\n\n###### IAppleIAPFinishTransactionFail 的属性值 @iappleiapfinishtransactionfail-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errCode | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 错误码 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| 700600 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 没有该交易。 |\n@| 700800 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS 系统版本\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"15.0\",\"4.25\"]]}' /> | 只支持iOS15以上的版本。 |\n| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n| data | any | 否 | - | - | 错误信息中包含的数据 |\n| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n| errMsg | string | 是 | - | - | - |\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.payment.virtualPayment.getVirtualPaymentManager)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=getVirtualPaymentManager&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=getVirtualPaymentManager&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=getVirtualPaymentManager&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=getVirtualPaymentManager&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=getVirtualPaymentManager&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=getVirtualPaymentManager)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=getVirtualPaymentManager&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"virtualPayment":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/virtual-payment/virtual-payment.uvue) \n >\n> 该 API 不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n\n::: preview\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/virtual-payment/virtual-payment\n```uvue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1;\">\r\n  <!-- #endif -->\r\n    <page-head title=\"苹果虚拟支付\"></page-head>\r\n    <view style=\"padding-left: 20px; padding-right: 20px;\">\r\n      <text>\r\n        requestVirtualPayment api 适用于消耗性类型、非消耗性类型、自动续期订阅类型、非自动续期订阅类型产品的购买。\\n\\n\r\n        1. 消耗性类型:该类型的产品可以设置购买数量,默认是1,最大值是10; \\n\r\n        2. 非消耗性类型、自动续期订阅类型、非自动续期订阅类型: 这些类型的产品购买数量设置无效,数量只能是1; \\n\r\n        3. 非消耗性类型:该类型产品一个appleId只能购买一次,可以在任何登陆该appleId账号的设备上restore获取。\r\n      </text>\r\n      <button style=\"margin-top: 20px;\" type=\"primary\" v-for=\"(item,index) in productList\" :key=\"index\"\r\n        @click=\"requestVirtualPayment(item)\">{{item.name}}</button>\r\n\r\n      <text>\r\n        \\nrestoreTransactions api 适用于非消耗性类型、自动续期订阅类型、非自动续期订阅类型产品的购买。\\n\\n\r\n        1. 非消耗性类型: 返回每个已购买的非消耗性类型产品的购买记录;\\n\r\n        2. 自动续期订阅类型: 返回每个已购买的自动续期订阅类型产品的最新购买记录,沙盒账号最多可自动续订 12 次;\\n\r\n        3. 非自动续期订阅类型: 返回每个已购买的非自动续期订阅类型产品的最新购买记录, 该类型订阅可以连续多次购买,开发者需要自己的后台计算产品过期的时间。\\n\r\n        Note: 不能用来恢复消耗性类型的购买记录。\r\n      </text>\r\n      <button style=\"margin-top: 20px;\" type=\"primary\" @click=\"restoreTransactions\">恢复购买订单列表</button>\r\n\r\n      <text>\r\n        \\ngetUnfinishedTransactions api 适用于获取未完成的各种类型产品的购买记录(用来防止丢单)。\\n\\n\r\n        1. 比如用户点击购买已经付款成功,但因网络、手机没电关机等特殊情况,Apple IAP\r\n        没有返回客户端对应的购买凭证,从而导致无法finish该交易导致的丢单,可以在需要的地方调用该api获得此类未finished的交易记录; \\n\r\n        2. 针对消耗性类型产品交易,只能通过该api获取未finished的交易,防止丢单;\\n\r\n        3. 对于其他类型产品未finished交易, 不仅可以通过该api获取,也可以通过restoreTransactions api (也可获取已经finished的交易)获取;\r\n      </text>\r\n      <button style=\"margin-top: 20px; margin-bottom: 50px;\" type=\"primary\"\r\n        @click=\"getUnfinishedTransactions\">获取未结束的订单列表</button>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n<script>\r\n  export type PayItem = { id : string, name : string, quantity ?: number }\r\n  export default {\r\n    data() {\r\n      return {\r\n        productList: [] as PayItem[],\r\n        virtualPaymentManager: Object\r\n      }\r\n    },\r\n    onLoad: function () {\r\n      this.virtualPaymentManager = uni.getVirtualPaymentManager()\r\n      this.initProductList()\r\n    },\r\n    methods: {\r\n      initProductList() {\r\n        this.productList.push({\r\n          name: '消耗性产品:个人赞助1元',\r\n          id: this.isDebug() ? \"uniappx.consumable.sponsor_1\" : \"uniappx.consumable.sponsor1\",\r\n          quantity: 1\r\n        } as PayItem);\r\n\r\n        this.productList.push({\r\n          name: '消耗性产品:金牌赞助5元, 数量=2',\r\n          id: this.isDebug() ? \"uniappx.consumable.sponsor_50\" : \"uniappx.consumable.sponsor50\",\r\n          quantity: 2\r\n        } as PayItem);\r\n\r\n        this.productList.push({\r\n          name: '非消耗性产品: 赞助特效1元',\r\n          id: this.isDebug() ? \"uniappx.nonconsumable.sponsorskin_1\" : \"uniappx.nonconsumable.sponsorskin1\"\r\n        } as PayItem);\r\n\n        // this.productList.push({\n        //   name: '自动续期订阅产品:每月定期赞助1元',\n        //   id: this.isDebug() ? \"uniappx.autorenewable.monthly_1\" : \"uniappx.autorenewable.monthly1\"\n        // } as PayItem);\n\r\n        this.productList.push({\r\n          name: '非自动续期订阅产品:月赞助1元',\r\n          id: this.isDebug() ? \"uniappx.nonrenewable.monthly_1\" : \"uniappx.nonrenewable.monthly1\"\r\n        } as PayItem);\r\n\r\n        // this.productList.push({\r\n        //   name: '测试不存在的产品',\r\n        //   id: \"uniappx.nonrenewable.none\"\r\n        // } as PayItem);\r\n      },\r\n      getPackageName() : string {\r\n        const res = uni.getAppBaseInfo();\r\n        let packageName : string = \"\"\r\n\r\n        // #ifdef APP-ANDROID\r\n        packageName = res.packageName\r\n        // #endif\r\n\r\n        // #ifdef APP-IOS\r\n        packageName = res.bundleId\r\n        // #endif\r\n\r\n        return packageName\r\n      },\r\n      isDebug() : boolean {\r\n        if (this.getPackageName() == 'io.dcloud.uniappx') {\r\n          return true\r\n        }\r\n        return false\r\n      },\r\n      isProd() : boolean {\r\n        if (this.getPackageName() == 'io.dcloud.hellouniappx') {\r\n          return true\r\n        }\r\n        return false\r\n      },\r\n      isCustom() : boolean {\r\n        if (this.isDebug() == false && this.isProd() == false) {\r\n          return true\r\n        }\r\n        return false\r\n      },\r\n      requestVirtualPayment(e : PayItem) {\r\n        uni.showLoading({\r\n          title: \"\",\r\n          mask: true\r\n        });\r\n\r\n        uni.requestVirtualPayment({\r\n          //需要将orderId转换为如下符合UUID规则的字符串,然后赋值给参数appAccountToken, 传入不符合UUID规则的字符串无效\r\n          apple: {\r\n            productId: e.id,\r\n            appAccountToken: \"123eaaaa-e89b-12d3-a456-42661417400b\",\r\n            quantity: e.quantity ?? 1,\r\n          },\r\n          success: (res) => {\r\n            uni.hideLoading()\r\n            console.log(\"购买成功:该productId= \" + res.apple?.productId)\r\n            //TODO: 开发者server验证逻辑\r\n\r\n            //经过开发者server验证成功后请结束该交易\r\n            uni.showToast({\r\n              title: \"购买成功:\" + res.apple?.productId,\r\n              icon: 'success'\r\n            })\r\n\r\n            this.virtualPaymentManager.finishTransaction({\r\n              transaction: res.apple,\r\n              success: (r) => {\r\n                console.log(\"关单成功, 该productId= \" + res.apple?.productId)\r\n              },\r\n              fail: (e) => {\r\n                console.log(\"关单失败, 该productId= \" + res.apple?.productId)\r\n              }\r\n            })\r\n          },\r\n          fail: (e) => {\r\n            uni.hideLoading()\r\n            console.log(\"购买失败:errSubject= \" + e.errSubject + \", errCode= \" + e.errCode + \", errMsg= \" + e.errMsg)\r\n            uni.showToast({\r\n              title: \"购买失败错误码:\" + e.errCode,\r\n              icon: 'error'\r\n            })\r\n          }\r\n        })\r\n      },\r\n      restoreTransactions() {\r\n        uni.showLoading({\r\n          title: \"\",\r\n          mask: true\r\n        });\r\n\r\n        this.virtualPaymentManager.restoreTransactions({\r\n          success: (res) => {\r\n            uni.hideLoading()\r\n            console.log(\"restore成功的交易个数:\" + res.transactions.length)\r\n            res.transactions.forEach(transaction => {\r\n\r\n              //TODO: 开发者server验证逻辑\r\n\r\n              console.log(\"restore成功的交易productId= \" + transaction.productId)\r\n            })\r\n            uni.showToast({\r\n              title: \"restore成功的交易个数:\" + res.transactions.length,\r\n              icon: 'success'\r\n            })\r\n          },\r\n          fail: (e) => {\r\n            uni.hideLoading()\r\n            console.log(\"restore失败:errSubject= \" + e.errSubject + \", errCode= \" + e.errCode + \", errMsg= \" + e.errMsg)\r\n            uni.showToast({\r\n              title: \"restore失败错误码:\" + e.errCode,\r\n              icon: 'error'\r\n            })\r\n          }\r\n        })\r\n      },\r\n      getUnfinishedTransactions() {\r\n        uni.showLoading({\r\n          title: \"\",\r\n          mask: true\r\n        });\r\n\r\n        this.virtualPaymentManager.getUnfinishedTransactions({\r\n          success: (res) => {\r\n            uni.hideLoading()\r\n            console.log(\"获取未结束的订单列表个数:\" + res.transactions.length)\r\n            uni.showToast({\r\n              title: \"获取未结束的订单列表个数:\" + res.transactions.length,\r\n              icon: 'success'\r\n            })\r\n\r\n            res.transactions.forEach(transaction => {\r\n\r\n              console.log(\"getUnfinishedTransactions成功的交易productId= \" + transaction.productId)\r\n              //TODO: 开发者server验证逻辑\r\n\r\n              //经过开发者server验证成功后请结束该交易\r\n              this.virtualPaymentManager.finishTransaction({\r\n                transaction: transaction,\r\n                success: (r) => {\r\n                  console.log(\"关单成功, 该productId= \" + transaction.productId)\r\n                },\r\n                fail: (e) => {\r\n                  console.log(\"关单失败, 该productId= \" + transaction.productId)\r\n                }\r\n              })\r\n            })\r\n          },\r\n          fail: (e) => {\r\n            uni.hideLoading()\r\n            console.log(\"获取未结束的订单列表失败:errSubject= \" + e.errSubject + \", errCode= \" + e.errCode + \", errMsg= \" + e.errMsg)\r\n            uni.showToast({\r\n              title: \"获取未结束的订单列表失败错误码\" + e.errCode,\r\n              icon: 'error'\r\n            })\r\n          }\r\n        })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n\n```\n:::"},"getPushClientId":{"name":"## uni.getPushClientId(options) @getpushclientid","description":"获取客户端唯一的推送标识","compatibility":"### getPushClientId 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.27 | 3.98 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **GetPushClientIdOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [GetPushClientIdSuccess](#getpushclientidsuccess-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#### GetPushClientIdSuccess 的属性值 @getpushclientidsuccess-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| cid | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.27\",\"3.98\",\"4.18\"]]}' /> | 个推客户端推送id,对应uni-id-device表的push_clientid<br/> |\n| errMsg | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.27\",\"3.98\",\"4.18\"]]}' /> | 错误描述<br/> |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getPushClientId)\n- [参见uni-app相关文档](http://uniapp.dcloud.io/api/plugins/push.html#getpushclientid)"},"onPushMessage":{"name":"## uni.onPushMessage(callback) @onpushmessage","description":"启动监听推送消息事件","compatibility":"### onPushMessage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.27 | 3.98 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnPushMessageCallbackResult](#onpushmessagecallbackresult-values)) => void | 是 | - | - |  | \n\n### OnPushMessageCallbackResult 的属性值 @onpushmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| type | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.27\",\"3.98\",\"4.18\"]]}' /> | 事件类型<br/>- click 从系统推送服务点击消息启动应用事件<br/>- receive 应用从推送服务器接收到推送消息事件 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| click | - | - |\n@| receive | - | - |\n| data | UTSJSONObject | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.27\",\"3.98\",\"4.18\"]]}' /> | 消息内容<br/> |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.onPushMessage)\n- [参见uni-app相关文档](http://uniapp.dcloud.io/api/plugins/push.html#onpushmessage)"},"offPushMessage":{"name":"## uni.offPushMessage(callback) @offpushmessage","description":"关闭推送消息监听事件,iOS端调用会关闭所有监听。","compatibility":"### offPushMessage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.27 | 3.98 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| callback | (result: [OnPushMessageCallbackResult](#onpushmessagecallbackresult-values)) => void | 是 | - | - |  | \n\n### OnPushMessageCallbackResult 的属性值 @onpushmessagecallbackresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| type | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.27\",\"3.98\",\"4.18\"]]}' /> | 事件类型<br/>- click 从系统推送服务点击消息启动应用事件<br/>- receive 应用从推送服务器接收到推送消息事件 |\n@| 合法值 | 兼容性 | 描述 |\n@| :- |  :-: | :- |\n@| click | - | - |\n@| receive | - | - |\n| data | UTSJSONObject | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.27\",\"3.98\",\"4.18\"]]}' /> | 消息内容<br/> |\n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.offPushMessage)\n- [参见uni-app相关文档](http://uniapp.dcloud.io/api/plugins/push.html#offpushmessage)"},"createPushMessage":{"name":"## uni.createPushMessage(options) @createpushmessage","description":"创建本地通知栏消息","compatibility":"### createPushMessage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.98 | 4.18 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **CreatePushMessageOptions** | 是 | - | - |  |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| cover | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.18\"]]}' /> | 是否覆盖上一次提示的消息 |\n@| delay | number | 否 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.18\"]]}' /> | 提示消息延迟显示的时间,单位为s |\n@| icon | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"x\"]]}' /> | 推送消息的图标 |\n@| sound | string | 否 | \"system\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.18\"]]}' /> | 推送消息的提示音<br/>- system: 使用系统通知提示音(默认值)<br/>- none: 不使用提示音 |\n@| title | string | 否 | App的名称 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.18\"]]}' /> | 推送消息的标题 |\n@| content | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.18\"]]}' /> | 消息显示的内容,在系统通知中心中显示的文本内容<br/> |\n@| payload | any | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.18\"]]}' /> | 消息承载的数据,可根据业务逻辑自定义数据格式,在点击通知消息时`onPushMessage`回调中会返回此字段的数据。 |\n@| when | number | 否 | 当前时间 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"x\"]]}' /> | 消息上显示的提示时间,需要传入时间戳。 |\n@| channelId | string | 否 | \"DcloudChannelID\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"x\"]]}' /> | 渠道id,Android特有字段,[通知渠道介绍](https://developer.android.com/develop/ui/views/notifications/channels?hl=zh-cn),<br/>创建通知渠道请使用`getPushChannelManager`获取PushChannelManager对象,调用`setPushChannel`方法配置渠道。 |\n@| category | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"x\"]]}' /> | 通知类别,Android特有字段,[通知渠道介绍](https://developer.android.com/develop/ui/views/notifications/channels?hl=zh-cn),<br/>标识通知的类别,应用场景为对于离线推送厂商配置的支持,比如[华为消息分类](https://developer.huawei.com/consumer/cn/doc/HMSCore-Guides/message-classification-0000001149358835#section5101818813) |\n@| success | (result: CreatePushMessageSuccess) => 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","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getChannelManager)\n- [参见uni-app相关文档](http://uniapp.dcloud.io/api/plugins/push.html#createpushmessage)"},"getPushChannelManager":{"name":"## uni.getPushChannelManager() @getpushchannelmanager","description":"获取通知渠道管理器,Android 8系统以上才可以设置通知渠道,Android 8系统以下返回null,[通知渠道介绍](https://developer.android.com/develop/ui/views/notifications/channels?hl=zh-cn),iOS不支持。","compatibility":"### getPushChannelManager 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.25 | x |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [ChannelManager](#channelmanager-values) |\n\n#### ChannelManager 的方法 @channelmanager-values \n\n#### setPushChannel(options : SetPushChannelOptions) : void; @setpushchannel\n设置推送渠道\n\n##### setPushChannel 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.98 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetPushChannelOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| soundName | string | 否 | null | - | 添加的声音文件,注意raw目录下必须要有 ,不传此字段将使用默认铃音。 |\n@| channelId | string | 是 | - | - | 通知渠道id |\n@| channelDesc | string | 是 | - | - | 通知渠道描述 |\n@| enableLights | boolean | 否 | false | - | 呼吸灯闪烁 |\n@| enableVibration | boolean | 否 | false | - | 震动 |\n@| importance | number | 否 | 3 | - | 通知的重要性级别,可选范围IMPORTANCE_LOW:2、IMPORTANCE_DEFAULT:3、IMPORTANCE_HIGH:4 。 |\n@| lockscreenVisibility | number | 否 | -1000 | - | 锁屏可见性,可选范围VISIBILITY_PRIVATE:0、VISIBILITY_PUBLIC:1、VISIBILITY_SECRET:-1、VISIBILITY_NO_OVERRIDE:-1000。 | \n\n\n#### getAllChannels() : Array\\<string>; @getallchannels\n获取当前应用注册的所有的通知渠道。\n\n##### getAllChannels 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.98 | x |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<string\\> |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.createPushMessage)"},"setAppBadgeNumber":{"name":"## uni.setAppBadgeNumber(num, options?) @setappbadgenumber","description":"设置应用图标上显示的角标数字,注意:不同手机厂商的角标显示规则不同,有部分设备的rom版本不支持显示角标,另有部分rom需要在应用的通知管理里开启`桌面角标`配置,才可以设置角标成功。","compatibility":"### setAppBadgeNumber 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.25 | 4.25 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| num | number | 是 | - | - | 要显示的角标数字值,参数为0则表示清除角标数字。 |\n| options | **BadgeOptions** | 否 | - | - | 小米手机显示角标需要在系统消息中心显示一条通知,此参数用于设置通知的标题(title)和内容(content)。 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| title | string | 否 | 应用的名称 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 消息的标题 |\n@| content | string | 否 | '您有x条未读消息',其中x为设置的角标数字值。 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | 消息的内容 | \n","returnValue":"","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.getPushChannelManager)"},"getChannelManager":{"name":"## uni.~~getChannelManager()~~ @getchannelmanager","description":"获取通知渠道管理器,Android 8系统以上才可以设置通知渠道,Android 8系统以下返回null,[通知渠道介绍](https://developer.android.com/develop/ui/views/notifications/channels?hl=zh-cn) ,iOS不支持。  **已废弃,仅为了向下兼容保留,建议使用`getPushChannelManager`。**","compatibility":"### getChannelManager 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.98 | x |\n","param":"","returnValue":"### 返回值  \n\n| 类型 |\n| :- |\n| [ChannelManager](#channelmanager-values) |\n\n#### ChannelManager 的方法 @channelmanager-values \n\n#### setPushChannel(options : SetPushChannelOptions) : void; @setpushchannel\n设置推送渠道\n\n##### setPushChannel 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.98 | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **SetPushChannelOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| soundName | string | 否 | null | - | 添加的声音文件,注意raw目录下必须要有 ,不传此字段将使用默认铃音。 |\n@| channelId | string | 是 | - | - | 通知渠道id |\n@| channelDesc | string | 是 | - | - | 通知渠道描述 |\n@| enableLights | boolean | 否 | false | - | 呼吸灯闪烁 |\n@| enableVibration | boolean | 否 | false | - | 震动 |\n@| importance | number | 否 | 3 | - | 通知的重要性级别,可选范围IMPORTANCE_LOW:2、IMPORTANCE_DEFAULT:3、IMPORTANCE_HIGH:4 。 |\n@| lockscreenVisibility | number | 否 | -1000 | - | 锁屏可见性,可选范围VISIBILITY_PRIVATE:0、VISIBILITY_PUBLIC:1、VISIBILITY_SECRET:-1、VISIBILITY_NO_OVERRIDE:-1000。 | \n\n\n#### getAllChannels() : Array\\<string>; @getallchannels\n获取当前应用注册的所有的通知渠道。\n\n##### getAllChannels 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.98 | x |\n\n\n##### 返回值  \n\n| 类型 |\n| :- |\n| Array\\<string\\> |\n \n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.push.uni-push.setAppBadgeNumber)"},"uni-push":{"example":"## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha//pages/API/uni-push/uni-push.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/API/uni-push/uni-push\n\n> appRedirect https://hellouniappx.dcloud.net.cn/appredirect.html?path=pages/API/uni-push/uni-push\n\n>Template\n```vue\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n    <!-- #ifdef APP-ANDROID -->\r\n    <button class=\"normal-button\" type=\"default\" @click=\"handleCreateChannel(true)\">\r\n      创建通知渠道 | setPushChannel\r\n    </button>\r\n    <button class=\"normal-button\" type=\"default\" @click=\"handleGetAllChannels\">\r\n      获取所有通知渠道信息 | getAllChannels\r\n    </button>\r\n    <!-- #endif -->\r\n    <button class=\"normal-button\" type=\"default\" @click=\"handleCreateLocalNotification\">\r\n      创建本地通知消息 | createPushMessage\r\n    </button>\r\n    <text class=\"instructions\">\r\n      不同手机厂商的角标显示规则不同,有部分设备的rom版本不支持显示角标,另有部分rom需要在应用的通知管理里开启`桌面角标`配置,才可以设置角标成功。\\n\r\n      部分rom需要在设置中同时开启`通知开关`和`桌面角标`配置,才允许设置角标,例如鸿蒙4.2。 \\n\r\n      另外针对高版本小米设备,会借助创建通知栏消息来设置角标数,所以设置时需要注意是否有权限创建通知栏消息。\r\n    </text>\r\n\r\n    <button class=\"normal-button\" type=\"default\" @click=\"handleSetBadge\">\r\n      设置角标为5 | setAppBadgeNumber(5)\r\n    </button>\r\n    <button class=\"normal-button\" type=\"default\" @click=\"handleCleanBadge\">\r\n      清空角标 | setAppBadgeNumber(0)\r\n    </button>\r\n    <button class=\"normal-button\" type=\"default\" @click=\"handleGetClientId\">\r\n      获取cid | getPushClientId\r\n    </button>\r\n\r\n    <textarea style=\"flex: 1;width: 100%;\" :disabled=\"true\" :value=\"channelInfo\"></textarea>\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n  .normal-button {\r\n    width: 100%;\r\n  }\r\n\r\n  .instructions {\r\n    margin-top: 10px;\r\n    margin-left: 10px;\r\n    margin-right: 10px;\r\n    background-color: #eee;\r\n  }\r\n</style>\n\n```\n\n>Script\n```uts\n\r\n  const channelInfo = ref(\"\")\r\n\r\n  onMounted(() => {\r\n    uni.onPushMessage((res : OnPushMessageCallbackResult) => {\r\n      uni.showModal({\r\n        title: \"onPushMessage回调信息\",\r\n        content: `type:${res.type} \\n data:${JSON.stringify(res.data)}`\r\n      })\r\n    })\r\n  })\r\n\r\n  const handleCreateChannel = (showToast : boolean) => {\r\n    // #ifdef APP-ANDROID\r\n    const manager = uni.getPushChannelManager()\r\n    manager.setPushChannel({\r\n      channelId: \"msg-pass\",\r\n      channelDesc: \"留言审核通过\",\r\n      soundName: \"#填写配置的声音文件名#\",\r\n      enableLights: true,\r\n      enableVibration: true,\r\n      importance: 4,\r\n      lockscreenVisibility: 1\r\n    } as SetPushChannelOptions)\r\n    if (showToast) {\r\n      uni.showToast({\r\n        title: \"设置渠道成功\"\r\n      })\r\n    }\r\n    // #endif\r\n  }\r\n  const handleGetAllChannels = () => {\r\n    // #ifdef APP-ANDROID\r\n    const manager = uni.getPushChannelManager()\r\n    console.log(\"channels : \" + manager.getAllChannels());\r\n    channelInfo.value = `渠道信息为: \\n ${manager.getAllChannels()}`\r\n    // #endif\r\n  }\r\n  const handleCreateLocalNotification = () => {\r\n    if (uni.getAppAuthorizeSetting().notificationAuthorized == \"authorized\") {\r\n      handleCreateChannel(false)\r\n      const date = new Date();\r\n      const hour = date.getHours()\r\n      const minute = date.getMinutes()\r\n      const second = date.getSeconds()\r\n      const formateTime = (target : number) : string => {\r\n        return target < 10 ? `0${target}` : `${target}`\r\n      }\r\n      uni.createPushMessage({\r\n        title: \"主标题(title)\",\r\n        content: `内容(content),创建时间: ${formateTime(hour)}:${formateTime(minute)}:${formateTime(second)}`,\r\n        cover: false,\r\n        channelId: \"msg-pass\",\r\n        when: Date.now() + 10000,\r\n        icon: \"/static/uni.png\",\r\n        sound: \"system\",\r\n        delay: 1,\r\n        payload: {\r\n          pkey: \"pvalue1\"\r\n        },\r\n        category: \"IM\",\r\n        success(res) {\r\n          console.log(\"res: \" + res);\r\n          uni.hideToast()\r\n          uni.showToast({\r\n            title: \"创建本地通知消息成功\"\r\n          })\r\n        },\r\n        fail(e) {\r\n          console.log(\"fail :\" + e);\r\n          uni.hideToast()\r\n          uni.showToast({\r\n            title: \"创建本地通知消息失败\",\r\n            icon: \"error\"\r\n          })\r\n        }\r\n      })\r\n    } else {\r\n      uni.showToast({\r\n        title: \"请在设置中开启通知权限\",\r\n        icon: \"error\"\r\n      })\r\n    }\r\n  }\r\n  const handleGetClientId = () => {\r\n    uni.showLoading({\r\n      title: \"正在获取cid\",\r\n    })\r\n    uni.getPushClientId({\r\n      success: (res : GetPushClientIdSuccess) => {\r\n        uni.hideLoading()\r\n        uni.showModal({\r\n          title: \"信息\",\r\n          content: `cid : ${res.cid}`\r\n        })\r\n      },\r\n      fail: () => {\r\n        uni.hideLoading()\r\n        uni.showToast({\r\n          title: `获取cid失败`,\r\n          icon: \"error\"\r\n        })\r\n      }\r\n    })\r\n  }\r\n  const handleSetBadge = () => {\r\n    if (uni.getDeviceInfo().deviceBrand?.toLowerCase() == \"xiaomi\") {\r\n      if (uni.getAppAuthorizeSetting().notificationAuthorized == \"authorized\") {\r\n        uni.setAppBadgeNumber(5, {\r\n          title: \"AppName\",\r\n          content: \"您有5条未读消息\"\r\n        } as BadgeOptions)\r\n        uni.showToast({\r\n          title: \"设置应用角标数为5\"\r\n        })\r\n      } else {\r\n        uni.showToast({\r\n          title: \"请在设置中开启通知权限\",\r\n          icon: \"error\"\r\n        })\r\n      }\r\n\r\n    } else {\r\n      uni.setAppBadgeNumber(5)\r\n      uni.showToast({\r\n        title: \"设置应用角标数为5\"\r\n      })\r\n    }\r\n  }\r\n  const handleCleanBadge = () => {\r\n    if (uni.getDeviceInfo().deviceBrand?.toLowerCase() == \"xiaomi\") {\r\n      if (uni.getAppAuthorizeSetting().notificationAuthorized == \"authorized\") {\r\n        uni.setAppBadgeNumber(0, {} as BadgeOptions)\r\n        uni.showToast({\r\n          title: \"清空应用角标数\"\r\n        })\r\n      } else {\r\n        uni.showToast({\r\n          title: \"请在设置中开启通知权限\",\r\n          icon: \"error\"\r\n        })\r\n      }\r\n    } else {\r\n      uni.setAppBadgeNumber(0)\r\n      uni.showToast({\r\n        title: \"清空应用角标数\"\r\n      })\r\n    }\r\n\r\n  }\r\n\n```\n\n:::"},"createWebviewContext":{"name":"## uni.createWebviewContext(webviewId, component?) @createwebviewcontext","description":"创建 web-view 组件的上下文对象,用于操作 web-view 的行为。","compatibility":"### createWebviewContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9.0 | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| webviewId | [string.WebviewIdString](/uts/data-type.md#ide-string) | 是 | - | - | - |\n| component | ComponentPublicInstance | 否 | - | - |  | \n","returnValue":"### 返回值  \n\n| 类型 | 描述 | 必备 |\n| :- | :- | :- |\n| [WebviewContext](#webviewcontext-values) | web-view组件上下文对象 | 否 |\n\n#### WebviewContext 的方法 @webviewcontext-values \n\n#### back() : void @back\n后退到 web-view 组件网页加载历史的上一页,如果不存在上一页则没有任何效果。\n##### back 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n\n\n\n#### forward() : void @forward\n前进到 web-view 组件网页加载历史的下一页,如果不存在下一页则没有任何效果。\n##### forward 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n\n\n\n#### reload() : void @reload\n重新加载 web-view 组件当前页面。\n##### reload 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n\n\n\n#### stop() : void @stop\n停止加载 web-view 组件当前网页,该方法不能阻止已经加载的 html 文档,但是能够阻止未完成的图片及延迟加载的资源。\n##### stop 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n\n\n\n#### evalJS(js : string) : void @evaljs\n在网页中执行指定的js脚本,在 uvue 页面中可通过此方法向 web-view 组件加载的页面发送数据\n##### evalJS 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| js | string | 是 | - | - | - | \n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.createWebviewContext)"},"createVideoContext":{"name":"## uni.createVideoContext(videoId, component?) @createvideocontext","description":"创建并返回 video 上下文 videoContext 对象","compatibility":"### createVideoContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | √ | 4.11 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| videoId | [string.VideoIdString](/uts/data-type.md#ide-string) | 是 | - | - | - |\n| component | ComponentPublicInstance | 否 | - | - |  | \n","returnValue":"### 返回值  \n\n| 类型 | 描述 | 必备 |\n| :- | :- | :- |\n| [VideoContext](#videocontext-values) | video组件上下文对象 | 否 |\n\n#### VideoContext 的方法 @videocontext-values \n\n#### play() : void; @play\n播放\n##### play 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n\n\n#### pause() : void; @pause\n暂停\n##### pause 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n\n\n#### seek(position : number) : void; @seek\n跳转到指定位置\n##### seek 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| position | number | 是 | - | - | 跳转到指定位置(秒) | \n\n\n#### stop() : void; @stop\n停止视频\n##### stop 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n\n\n#### sendDanmu(danmu : Danmu) : void; @senddanmu\n发送弹幕\n##### sendDanmu 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| danmu | **Danmu** | 是 | - | - | text, color |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| text | string | 否 | - | - | 弹幕文字 |\n@| color | string | 否 | - | - | 弹幕颜色 |\n@| time | number | 否 | - | - | 显示时刻 | \n\n\n#### playbackRate(rate : number) : void; @playbackrate\n设置倍速播放\n##### playbackRate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| rate | number | 是 | - | - | , 支持倍率 0.5/0.8/1.0/1.25/1.5 | \n\n\n#### requestFullScreen(direction ?: RequestFullScreenOptions \\| null) : void; @requestfullscreen\n进入全屏\n##### requestFullScreen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| direction | **RequestFullScreenOptions** | 否 | - | - | , 0\\|正常竖向, 90\\|屏幕逆时针90度, -90\\|屏幕顺时针90度 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| direction | number | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9.0\",\"4.11\"]]}' /> | direction<br/>- 0: 正常竖向<br/>- 90: 屏幕逆时针90度<br/>- -90: 屏幕顺时针90度 | \n\n\n#### exitFullScreen() : void; @exitfullscreen\n退出全屏\n##### exitFullScreen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9.0 | 4.11 |\n\n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.createVideoContext)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/media/video-context.html#createvideocontext)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createVideoContext&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createVideoContext&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createVideoContext&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createVideoContext&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createVideoContext&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createVideoContext)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createVideoContext&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"createMapContext":{"name":"## uni.createMapContext(mapId, component?) @createmapcontext","description":"创建并返回 map 上下文 mapContext 对象","compatibility":"### createMapContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n","param":"### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| mapId | string | 是 | - | - | - |\n| component | ComponentPublicInstance | 否 | - | - |  | \n","returnValue":"### 返回值  \n\n| 类型 | 描述 | 必备 |\n| :- | :- | :- |\n| [MapContext](#mapcontext-values) | map组件上下文对象 | 否 |\n\n#### MapContext 的方法 @mapcontext-values \n\n#### getCenterLocation(options : MapContextGetCenterLocationOptions) : void; @getcenterlocation\n获取当前地图中心的经纬度,返回的是 gcj02 坐标系,可以用于 uni.openLocation\n##### getCenterLocation 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextGetCenterLocationOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [LocationObject](#locationobject-values)) => void | 否 | - | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### LocationObject 的属性值 @locationobject-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| latitude | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 纬度,浮点数,范围为-90~90,负数表示南纬 |\n| longitude | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 经度,范围为-180~180,负数表示西经 |\n\n\n#### moveToLocation(options : MapContextMoveToLocationOptions) : void; @movetolocation\n将地图中心移动到当前定位点,需要配合map组件的show-location使用\n##### moveToLocation 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextMoveToLocationOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| latitude | number | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 纬度,浮点数,范围为-90~90,负数表示南纬 |\n@| longitude | number | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 经度,范围为-180~180,负数表示西经 |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### translateMarker(options : MapContextTranslateMarkerOptions) : void; @translatemarker\n平移marker,带动画\n##### translateMarker 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextTranslateMarkerOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| markerId | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 指定marker |\n@| destination | [LocationObject](#locationobject-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 指定marker移动到的目标点 |\n@| rotate | number | 否 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | marker的旋转角度 |\n@| moveWithRotate | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 平移和旋转同时进行 |\n@| duration | number | 否 | 1000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 动画持续时长,平移与旋转分别计算 |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### includePoints(options : MapContextIncludePointsOptions) : void; @includepoints\n缩放视野展示所有经纬度\n##### includePoints 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextIncludePointsOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| points | Array\\<[LocationObject](#locationobject-values)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 要显示在可视区域内的坐标点列表,[{latitude, longitude}\\] |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### getRegion(options : MapContextGetRegionOptions) : void; @getregion\n获取当前地图的视野范围\n##### getRegion 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextGetRegionOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [MapContextGetRegionResult](#mapcontextgetregionresult-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### MapContextGetRegionResult 的属性值 @mapcontextgetregionresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| southwest | [LocationObject](#locationobject-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 西南角的经纬度 |\n| northeast | [LocationObject](#locationobject-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 东北角的经纬度 |\n\n\n#### getScale(options : MapContextGetScaleOptions) : void; @getscale\n获取当前地图的缩放级别\n##### getScale 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextGetScaleOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| success | (result: [MapContextGetScaleResult](#mapcontextgetscaleresult-values)) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n###### MapContextGetScaleResult 的属性值 @mapcontextgetscaleresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| scale | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 地图缩放级别 |\n\n\n#### addGroundOverlay(options : MapContextAddGroundOverlayOptions) : void; @addgroundoverlay\n创建自定义图片图层,图片会随着地图缩放而缩放\n##### addGroundOverlay 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextAddGroundOverlayOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| id | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片图层 id |\n@| src | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片路径,支持网络图片、临时路径、代码包路径 |\n@| bounds | **Bounds** | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片覆盖的经纬度范围 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| southwest | [LocationObject](#locationobject-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 西南角的经纬度 |\n@@| northeast | [LocationObject](#locationobject-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 东北角的经纬度 |\n@| visible | boolean | 否 | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 是否可见 |\n@| zIndex | number | 否 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图层绘制顺序 |\n@| opacity | number | 否 | 1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图层透明度 |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### addMarkers(options : MapContextAddMarkersOptions) : void; @addmarkers\n添加 marker\n##### addMarkers 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextAddMarkersOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| markers | Array\\<**Marker**\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 同传入 map 组件的 marker 属性 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- |  :-: | :- |\n@@| id | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 标记点id,marker点击事件回调会返回此id。建议为每个marker设置上Number类型id,保证更新marker时有更好的性能。最大限制9位数 |\n@@| latitude | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 纬度,浮点数,范围 -90 ~ 90 |\n@@| longitude | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 经度,浮点数,范围 -180 ~ 180 |\n@@| iconPath | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 显示的图标,项目目录下的图片路径,支持相对路径写法,以'/'开头则表示相对小程序根目录;也支持临时路径 |\n@@| title | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 标注点名,点击时显示,callout存在时将被忽略 |\n@@| rotate | number | 否 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 旋转角度,顺时针旋转的角度,范围 0 ~ 360 |\n@@| alpha | number | 否 | 1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 标注的透明度,范围 0 ~ 1 |\n@@| width | number | 否 | 默认为图片实际宽度 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 标注图标宽度 |\n@@| height | number | 否 | 默认为图片实际高度 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 标注图标高度 |\n@@| ariaLabel | string | 否 | null | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 无障碍访问,(属性)元素的额外描述 |\n@@| anchor | **Anchor** | 否 | [0.5, 1\\] | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 经纬度在标注图标的锚点,默认底边中点\t{x, y},x表示横向(0-1),y表示竖向(0-1)。{x: .5, y: 1} 表示底边中点 |\n@@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@@| :- | :- | :- | :- |  :-: | :- |\n@@@| x | number | 是 | - | - | - |\n@@@| y | number | 是 | - | - | - |\n@@| callout | **MapMarkerCallout** | 否 | - | - |  |\n@@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@@| :- | :- | :- | :- |  :-: | :- |\n@@@| content | string | 否 | - | - |  |\n@@@| color | string | 否 | - | - |  |\n@@@| fontSize | number | 否 | - | - |  |\n@@@| borderRadius | number | 否 | - | - |  |\n@@@| borderWidth | number | 否 | - | - |  |\n@@@| borderColor | string | 否 | - | - |  |\n@@@| bgColor | string | 否 | - | - |  |\n@@@| padding | number | 否 | - | - |  |\n@@@| display | string | 否 | - | - | - |\n@@@@| 合法值 | 兼容性 | 描述 |\n@@@@| :- |  :-: | :- |\n@@@@| BYCLICK | - | - |\n@@@@| ALWAYS | - | - |\n@@@| textAlign | string | 否 | - | - | - |\n@@@@| 合法值 | 兼容性 | 描述 |\n@@@@| :- |  :-: | :- |\n@@@@| left | - | - |\n@@@@| center | - | - |\n@@@@| right | - | - |\n@@@| anchorX | number | 否 | - | - |  |\n@@@| anchorY | number | 否 | - | - |  |\n@@| label | **MapMarkerLabel** | 否 | - | - |  |\n@@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@@| :- | :- | :- | :- |  :-: | :- |\n@@@| content | string | 否 | - | - |  |\n@@@| color | string | 否 | - | - |  |\n@@@| fontSize | number | 否 | - | - |  |\n@@@| x | number | 否 | - | - |  |\n@@@| y | number | 否 | - | - |  |\n@@@| anchorX | number | 否 | - | - |  |\n@@@| anchorY | number | 否 | - | - |  |\n@@@| borderWidth | number | 否 | - | - |  |\n@@@| borderColor | string | 否 | - | - |  |\n@@@| borderRadius | number | 否 | - | - |  |\n@@@| bgColor | string | 否 | - | - |  |\n@@@| padding | number | 否 | - | - |  |\n@@@| textAlign | string | 否 | - | - | - |\n@@@@| 合法值 | 兼容性 | 描述 |\n@@@@| :- |  :-: | :- |\n@@@@| left | - | - |\n@@@@| center | - | - |\n@@@@| right | - | - |\n@@@| ariaLabel | string | 否 | - | - |  |\n@@| clusterId | number | 否 | - | - |  |\n@@| customCallout | [MapMarkerCallout](#mapmarkercallout-values) | 否 | - | - |  |\n@@| joinCluster | boolean | 否 | - | - |  |\n@| clear | boolean | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 是否先清空地图上所有 marker |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### moveAlong(options : MapContextMoveAlongOptions) : void; @movealong\n沿指定路径移动 marker,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 marker 再次调用 moveAlong 方法,前一次的动画将被打断。\n##### moveAlong 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextMoveAlongOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| markerId | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 指定marker |\n@| path | Array\\<[LocationObject](#locationobject-values)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 移动路径的坐标串,坐标点格式 {longitude, latitude} |\n@| duration | number | 否 | 1000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 平滑移动的时间 |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### removeGroundOverlay(options : MapContextRemoveGroundOverlayOptions) : void; @removegroundoverlay\n移除自定义图片图层\n##### removeGroundOverlay 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextRemoveGroundOverlayOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| id | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片图层 id |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### removeMarkers(options : MapContextRemoveMarkersOptions) : void; @removemarkers\n移除 marker\n##### removeMarkers 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextRemoveMarkersOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| markerIds | Array\\<number\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 要被删除的marker的id属性组成的数组 |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n\n#### updateGroundOverlay(options : MapContextUpdateGroundOverlayOptions) : void; @updategroundoverlay\n更新自定义图片图层。\n##### updateGroundOverlay 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.31 | 4.31 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| options | **MapContextUpdateGroundOverlayOptions** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- |  :-: | :- |\n@| id | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片图层 id |\n@| src | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片路径,支持网络图片、临时路径、代码包路径 |\n@| bounds | [Bounds](#bounds-values) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图片覆盖的经纬度范围 |\n@| visible | boolean | 否 | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 是否可见 |\n@| zIndex | number | 否 | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图层绘制顺序 |\n@| opacity | number | 否 | 1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.31\",\"4.31\"]]}' /> | 图层透明度 |\n@| success | (result: any) => void | 否 | null | - | 接口调用成功的回调函数 |\n@| fail | (result: any) => void | 否 | null | - | 接口调用失败的回调函数 |\n@| complete | (result: any) => void | 否 | null | - | 接口调用结束的回调函数(调用成功、失败都会执行) | \n\n \n","tutorial":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=api.component.createMapContext)\n - [参见uni-app相关文档](https://uniapp.dcloud.net.cn/api/location/map.html#createmapcontext)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=createMapContext&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=createMapContext&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=createMapContext&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=createMapContext&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=createMapContext&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=createMapContext)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=createMapContext&from=docs)\n- [京东小程序文档](https://mp-docs.jd.com/doc/dev/framework/-1)\n- [华为快应用文档](https://developer.huawei.com/consumer/cn/doc/quickApp-References/webview-frame-overview-0000001124793625)\n- [360小程序文档](https://mp.360.cn/doc/miniprogram/dev/#/b770a184ff1f06c6b3393a0fd1132380)"},"general_type":{"name":"## 通用类型\n","param":"### GeneralCallbackResult \n\n| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- |  :-: | :- |\n| errMsg | string | 是 | - | - | 错误信息 |\n"}}