{"view":{"name":"## view","description":"> 组件类型:UniViewElement \n\n 基本视图容器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| hover-class | string([string.ClassString](/uts/data-type.md#ide-string)) | \"none\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定按下去的样式类。当 hover-class=\"none\" 时,没有点击态效果 |\n| hover-stop-propagation | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定是否阻止本节点的祖先节点出现点击态(祖先节点:指根节点到该节点路径上的所有节点都是这个节点的祖先节点) |\n| hover-start-time | number | 50 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 按住后多久出现点击态,单位毫秒 |\n| hover-stay-time | number | 400 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 手指松开后点击态保留时间,单位毫秒 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/view/view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/view/view\n>Template\n```vue\n<template>\n <page-head title=\"view\"></page-head>\n <view class=\"main\" :hover-class=\"hover_class ? 'is-parent-hover' : 'none'\">\n <view class=\"test-view\" :hover-class=\"hover_class ? 'is-hover' : 'none'\" :hover-stop-propagation=\"stop_propagation\"\n :hover-start-time=\"start_time\" :hover-stay-time=\"stay_time\">\n </view>\n </view>\n <scroll-view style=\"flex: 1\">\n <view class=\"content\">\n <boolean-data :defaultValue=\"false\" title=\"是否指定按下去的样式类\" @change=\"change_hover_class_boolean\"></boolean-data>\n <boolean-data :defaultValue=\"false\" title=\"是否阻止本节点的祖先节点出现点击态\"\n @change=\"change_stop_propagation_boolean\"></boolean-data>\n <enum-data :items=\"start_time_enum\" title=\"按住后多久出现点击态\" @change=\"radio_change_start_time_enum\"></enum-data>\n <enum-data :items=\"stay_time_enum\" title=\"手指松开后点击态保留时间\" @change=\"radio_change_stay_time_enum\"></enum-data>\n </view>\n </scroll-view>\n</template>\n\n\n<style>\n .main {\n padding: 5px 0;\n flex-direction: row;\n justify-content: center;\n }\n\n .test-view {\n height: 200px;\n width: 200px;\n background-color: white;\n }\n\n .text {\n color: #777;\n font-size: 13px;\n }\n\n .is-hover {\n background-color: #179b16;\n }\n\n .is-parent-hover {\n background-color: #aa0000;\n }\n</style>\n\n```\n>Script\n```uts\n\n import { ItemType } from '@/components/enum-data/enum-data'\n export default {\n data() {\n return {\n hover_class: false,\n stop_propagation: false,\n start_time: 50,\n stay_time: 400,\n start_time_enum: [{ \"value\": 50, \"name\": \"50毫秒\" }, { \"value\": 200, \"name\": \"200毫秒\" }] as ItemType[],\n stay_time_enum: [{ \"value\": 400, \"name\": \"400毫秒\" }, { \"value\": 200, \"name\": \"200毫秒\" }] as ItemType[]\n }\n },\n methods: {\n change_hover_class_boolean(checked : boolean) {\n this.hover_class = checked\n },\n change_stop_propagation_boolean(checked : boolean) {\n this.stop_propagation = checked\n },\n radio_change_start_time_enum(time : number) {\n this.start_time = time\n },\n radio_change_stay_time_enum(time : number) {\n this.stay_time = time\n },\n },\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/view.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=view&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)\n"},"scroll-view":{"name":"## scroll-view","description":"> 组件类型:UniScrollViewElement \n\n 可滚动视图容器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| type | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.11\"]]}' /> | 渲染模式,可取值 nested |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| nested | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.11\"]]}' /> | 嵌套模式。用于处理父子 scroll-view 间的嵌套滚动,子节点只能是 nested-scroll-header nested-scroll-body 组件或自定义 refresher |\n| direction | string | \"vertical\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 滚动方向,可取值 none、all、horizontal、vertical,默认值vertical |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 禁止滚动 |\n@| all | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 横向竖向都可滚动 app端不支持 |\n@| horizontal | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 横向滚动 |\n@| vertical | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 竖向滚动 |\n| ~~scroll-x~~ | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 允许横向滚动,不支持同时设置scroll-y属性为true,同时设置true时scroll-y生效。已废弃,请改用direction |\n| ~~scroll-y~~ | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 允许纵向滚动,不支持同时设置scroll-x属性为true,同时设置true时scroll-y生效。已废弃,请改用direction |\n| ~~rebound~~ | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"x\"]]}' /> | 控制是否回弹效果。已废弃,请改用bounces |\n| associative-container | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.11\"]]}' /> | 关联的滚动容器 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| nested-scroll-view | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.11\"]]}' /> | 嵌套滚动 |\n| enable-back-to-top | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.11\"]]}' /> | iOS点击顶部状态栏滚动条返回顶部,只支持竖向 |\n| bounces | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"4.11\"]]}' /> | 控制是否回弹效果 优先级高于rebound |\n| upper-threshold | number | 50 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 距顶部/左边多远时(单位px),触发 scrolltoupper 事件 |\n| lower-threshold | number | 50 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 距底部/右边多远时(单位px),触发 scrolltolower 事件 |\n| scroll-top | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设置竖向滚动条位置 |\n| scroll-left | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设置横向滚动条位置 |\n| scroll-into-view | string([string.IDString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素起始位置 |\n| scroll-with-animation | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否在设置滚动条位置时使用滚动动画,设置false没有滚动动画 |\n| refresher-enabled | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 开启下拉刷新,暂时不支持scroll-x = true横向刷新 |\n| refresher-threshold | number | 45 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置下拉刷新阈值 |\n| refresher-max-drag-distance | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设置下拉最大拖拽距离(单位px),默认是下拉刷新控件高度的2.5倍 |\n| refresher-default-style | string | \"black\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置下拉刷新默认样式,支持设置 black \\| white \\| none, none 表示不使用默认样式 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| black | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 深颜色雪花样式 |\n@| white | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 浅白色雪花样式 |\n@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 不使用默认样式 |\n| refresher-background | string([string.ColorString](/uts/data-type.md#ide-string)) | \"transparent\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置下拉刷新区域背景颜色,默认透明 |\n| refresher-triggered | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发 |\n| show-scrollbar | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 控制是否出现滚动条 |\n| custom-nested-scroll | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"x\"]]}' /> | 子元素是否开启嵌套滚动 将滚动事件与父元素协商处理 |\n| nested-scroll-child | string([string.IDString](/uts/data-type.md#ide-string)) | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.97\",\"x\"]]}' /> | 嵌套滚动子元素的id属性,不支持ref,scroll-view惯性滚动时会让对应id元素视图进行滚动,子元素滚动时会触发scroll-view的nestedprescroll事件,嵌套子元素需要设置custom-nested-scroll = true |\n| @refresherpulling | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新控件被下拉 |\n| @refresherrefresh | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新被触发 |\n| @refresherrestore | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新被复位 |\n| @refresherabort | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新被中止 |\n| @scrolltoupper | (event: [UniScrollToUpperEvent](#uniscrolltoupperevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 滚动到顶部/左边,会触发 scrolltoupper 事件 |\n| @scrolltolower | (event: [UniScrollToLowerEvent](#uniscrolltolowerevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 滚动到底部/右边,会触发 scrolltolower 事件 |\n| @scroll | (event: [UniScrollEvent](#uniscrollevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 滚动时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} |\n| @scrollend | (event: [UniScrollEvent](#uniscrollevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 滚动结束时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} |\n| @startnestedscroll | (event: [UniStartNestedScrollEvent](#unistartnestedscrollevent)) => Boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"x\"]]}' /> | 子元素开始滚动时触发, return true表示与子元素开启滚动协商 默认return false! event = {node} |\n| @nestedprescroll | (event: [UniNestedPreScrollEvent](#uninestedprescrollevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"x\"]]}' /> | 子元素滚动时触发,可执行event.consumed(x,y)告知子元素deltaX、deltaY各消耗多少。子元素将执行差值后的deltaX、deltaY滚动距离。不执行consumed(x,y)则表示父元素不消耗deltaX、deltaY。event = {deltaX, deltaY} |\n| @stopnestedscroll | (event: [UniStopNestedScrollEvent](#unistopnestedscrollevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"x\"]]}' /> | 子元素滚动结束或意外终止时触发 |","event":"\n### 事件\n#### UniRefresherEvent\n\n##### UniRefresherEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniRefresherEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| dy | number | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniRefresherEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniScrollToUpperEvent\n\n##### UniScrollToUpperEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniScrollToUpperEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| direction | string | 是 | - | - | 滚动方向 top 或 left |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniScrollToUpperEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniScrollToLowerEvent\n\n##### UniScrollToLowerEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniScrollToLowerEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| direction | string | 是 | - | - | 滚动方向 bottom 或 right |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniScrollToLowerEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniScrollEvent\n\n##### UniScrollEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniScrollEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| scrollTop | number | 是 | - | - | 竖向滚动的距离 |\n@| scrollLeft | number | 是 | - | - | 横向滚动的距离 |\n@| scrollHeight | number | 是 | - | - | 滚动区域的高度 |\n@| scrollWidth | number | 是 | - | - | 滚动区域的宽度 |\n@| deltaY | number | 是 | - | - | 当次滚动事件竖向滚动量 |\n@| deltaX | number | 是 | - | - | 当次滚动事件横向滚动量 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniScrollEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniStartNestedScrollEvent\n\n##### UniStartNestedScrollEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| node | [UniElement](/dom/unielement.md) | 是 | - | - | 开始滚动子节点对象 |\n| isTouch | boolean | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"x\"]]}' /> | 是否由触摸行为发生的Event |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniStartNestedScrollEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniNestedPreScrollEvent\n\n##### UniNestedPreScrollEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| deltaX | number | 是 | - | - | x轴滚动距离 |\n| deltaY | number | 是 | - | - | y轴滚动距离 |\n| isTouch | boolean | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"x\"]]}' /> | 是否由触摸行为发生的Event |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniNestedPreScrollEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| consumed | (consumedX: number, consumedY: number) => void | 是 | - | - | 通知到子节点x,y轴滚动距离的消耗 |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniStopNestedScrollEvent\n\n##### UniStopNestedScrollEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| isTouch | boolean | 是 | - | - | 是否由触摸行为发生的Event |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniStopNestedScrollEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/scroll-view/scroll-view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/scroll-view/scroll-view\n>Template\n```vue\n<template>\n <!-- #ifdef APP -->\n <scroll-view class=\"page-scroll-view\">\n <!-- #endif -->\n <view>\n <page-head title=\"scroll-view,区域滚动视图\"></page-head>\n <view class=\"uni-padding-wrap uni-common-mt\">\n <view class=\"uni-title uni-common-mt\">\n <text class=\"uni-title-text\">Vertical Scroll</text>\n <text class=\"uni-subtitle-text\">纵向滚动</text>\n </view>\n <view>\n <scroll-view :scroll-top=\"scrollTop\" direction=\"vertical\" class=\"scroll-Y\" scroll-with-animation=\"true\"\n @scrolltoupper=\"upper\" @scrolltolower=\"lower\" @scroll=\"scroll\" @scrollend=\"end\" :show-scrollbar=\"showScrollbar\">\n <view class=\"scroll-view-item uni-bg-red\"><text class=\"text\">A</text></view>\n <view class=\"scroll-view-item uni-bg-green\"><text class=\"text\">B</text></view>\n <view class=\"scroll-view-item uni-bg-blue\"><text class=\"text\">C</text></view>\n </scroll-view>\n </view>\n <view @tap=\"goTop\" class=\"uni-center uni-common-mt\">\n <text class=\"uni-link\">点击这里返回顶部</text>\n </view>\n\n <view class=\"uni-title uni-common-mt\">\n <text class=\"uni-title-text\">Horizontal Scroll</text>\n <text class=\"uni-subtitle-text\">横向滚动</text>\n </view>\n <view>\n <scroll-view class=\"scroll-view_H\" direction=\"horizontal\" @scroll=\"scroll\" @scrollend=\"end\" :scroll-left=\"scrollLeft\" :show-scrollbar=\"showScrollbar\">\n <view class=\"scroll-view-item_H uni-bg-red\"><text class=\"text\">A</text></view>\n <view class=\"scroll-view-item_H uni-bg-green\"><text class=\"text\">B</text></view>\n <view class=\"scroll-view-item_H uni-bg-blue\"><text class=\"text\">C</text></view>\n </scroll-view>\n </view>\n\n <navigator url=\"/pages/component/scroll-view/scroll-view-props\" hover-class=\"none\">\n <button type=\"primary\" class=\"button\">\n 非下拉刷新的属性示例\n </button>\n </navigator>\n <view class=\"uni-common-pb\"></view>\n\n <navigator url=\"/pages/component/scroll-view/scroll-view-refresher-props\" hover-class=\"none\">\n <button type=\"primary\" class=\"button\">\n 下拉刷新的属性示例\n </button>\n </navigator>\n <view class=\"uni-common-pb\"></view>\n <navigator url=\"/pages/component/scroll-view/scroll-view-refresher\" hover-class=\"none\">\n <button type=\"primary\" class=\"button\"> 默认下拉刷新示例 </button>\n </navigator>\n <view class=\"uni-common-pb\"></view>\n <navigator url=\"/pages/component/scroll-view/scroll-view-custom-refresher-props\" hover-class=\"none\">\n <button type=\"primary\" class=\"button\">\n 自定义下拉刷新示例\n </button>\n </navigator>\n <view class=\"uni-common-pb\"></view>\n </view>\n </view>\n <!-- #ifdef APP -->\n </scroll-view>\n <!-- #endif -->\n</template>\n\n\n<style>\n .scroll-Y {\n height: 150px;\n }\n\n .scroll-view_H {\n width: 100%;\n flex-direction: row;\n }\n\n .scroll-view-item {\n height: 150px;\n justify-content: center;\n align-items: center;\n }\n\n .scroll-view-item_H {\n width: 100%;\n height: 150px;\n justify-content: center;\n align-items: center;\n }\n\n .text {\n font-size: 18px;\n color: #ffffff;\n }\n\n .button {\n margin-top: 15px;\n }\n</style>\n\n```\n>Script\n```uts\n\n type ScrollEventTest = {\n type: string;\n target: UniElement | null;\n currentTarget: UniElement | null;\n direction?:string\n }\n export default {\n data() {\n return {\n scrollTop: 0,\n oldScrollTop: 0,\n scrollLeft:120,\n showScrollbar: true,\n // 自动化测试\n isScrollTest:'',\n isScrolltolowerTest:'',\n isScrolltoupperTest:'',\n // 在web端scroll事件event参数中detail类型报错,先条件编译处理\n // #ifndef WEB\n scrollDetailTest:null as UniScrollEventDetail|null,\n scrollEndDetailTest:null as UniScrollEventDetail|null,\n // #endif\n }\n },\n methods: {\n upper: function (e : UniScrollToUpperEvent) {\n console.log('滚动到顶部/左边',e)\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget,\n direction:e.detail.direction,\n } as ScrollEventTest,'scrolltoupper')\n },\n lower: function (e : UniScrollToLowerEvent) {\n console.log('滚动到底部/右边',e)\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget,\n direction:e.detail.direction,\n } as ScrollEventTest,'scrolltolower')\n },\n scroll: function (e : UniScrollEvent) {\n // #ifndef WEB\n this.scrollDetailTest = e.detail\n // #endif\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as ScrollEventTest,'scroll')\n this.oldScrollTop = e.detail.scrollTop\n },\n end: function (e : UniScrollEvent){\n console.log('滚动结束时触发',e)\n // #ifndef WEB\n this.scrollEndDetailTest = e.detail\n // #endif\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as ScrollEventTest,'scrollend')\n },\n goTop: function () {\n // 解决view层不同步的问题\n this.scrollTop = this.oldScrollTop\n this.$nextTick(function () {\n this.scrollTop = 0\n })\n uni.showToast({\n icon: 'none',\n title: '纵向滚动 scrollTop 值已被修改为 0',\n })\n },\n // 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)\n checkEventTest(e:ScrollEventTest, eventName:String){\n const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;\n const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;\n switch (eventName){\n case 'scroll':\n this.isScrollTest = result\n break;\n case 'scrolltolower':\n this.isScrolltolowerTest = result + `-${e.direction}`\n break;\n case 'scrolltoupper':\n this.isScrolltoupperTest = result + `-${e.direction}`\n break;\n default:\n break;\n }\n },\n },\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.scroll-view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/scroll-view.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=scroll-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=scroll-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=scroll-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=scroll-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=scroll-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=scroll-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=scroll-view&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)\n"},"swiper-item":{"name":"## swiper-item","description":"> 组件类型:UniSwiperItemElement \n\n swiper的唯一合法子组件。每个swiper-item代表一个滑块。宽高自动设置为100%","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| item-id | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 该 swiper-item 的标识符 |","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.swiper.swiper-item)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/component/swiper.html#swiper-item)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=swiper-item&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=swiper-item&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=swiper-item&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=swiper-item&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=swiper-item&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=swiper-item)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=swiper-item&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)\n"},"swiper":{"name":"## swiper","description":"> 组件类型:UniSwiperElement \n\n 滑块视图容器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| indicator-dots | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示面板指示点 |\n| indicator-color | string([string.ColorString](/uts/data-type.md#ide-string)) | \"rgba(0, 0, 0, .3)\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指示点颜色 |\n| indicator-active-color | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#000000\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当前选中的指示点颜色 |\n| disable-touch | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 是否禁止用户 touch 操作 |\n| autoplay | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否自动切换 |\n| current | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当前所在滑块的 index |\n| current-item-id | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当前所在滑块的 item-id ,不能与 current 被同时指定 |\n| interval | number | 3000 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 自动切换时间间隔 |\n| duration | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 滑动动画时长 |\n| circular | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否采用衔接滑动 |\n| vertical | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 滑动方向是否为纵向 |\n| rebound | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 控制是否回弹效果 |\n| @change | (event: [UniSwiperChangeEvent](#uniswiperchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | current 改变时会触发 change 事件,event.detail = {current: current, source: source} |\n| @transition | (event: [UniSwiperTransitionEvent](#uniswipertransitionevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | swiper-item 的位置发生改变时会触发 transition 事件,event.detail = {dx: dx, dy: dy} |\n| @animationfinish | (event: [UniSwiperAnimationFinishEvent](#uniswiperanimationfinishevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 动画结束时会触发 animationfinish 事件,event.detail = {current: current, source: source} |","event":"\n### 事件\n#### UniSwiperChangeEvent\n\n##### UniSwiperChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniSwiperChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| current | number | 是 | - | - | 发生change事件的滑块下标 |\n@| currentItemId | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"x\",\"x\"]]}' /> | 切换结束的 swiper-item 的 item-id 属性值 |\n@| source | string | 是 | - | - | autoplay 自动播放导致swiper变化;touch 用户划动引起swiper变化 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniSwiperChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniSwiperTransitionEvent\n\n##### UniSwiperTransitionEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniSwiperTransitionEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| dx | number | 是 | - | - | 横向偏移量,单位是逻辑像素px |\n@| dy | number | 是 | - | - | 纵向偏移量,单位是逻辑像素px |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniSwiperTransitionEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniSwiperAnimationFinishEvent\n\n##### UniSwiperAnimationFinishEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniSwiperAnimationFinishEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| current | number | 是 | - | - | 发生动画结束事件的滑块下标 |\n@| currentItemId | string | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"x\",\"x\"]]}' /> | 动画结束的 swiper-item 的 item-id 属性值 |\n@| source | string | 是 | - | - | autoplay 自动播放导致swiper变化;touch 用户划动引起swiper变化 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniSwiperAnimationFinishEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/swiper/swiper.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/swiper/swiper\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=\"swiper,可滑动视图\"></page-head>\r\n <view class=\"uni-margin-wrap\">\r\n <swiper class=\"swiper\" :vertical=\"verticalSelect\" :indicator-dots=\"dotsSelect\" :autoplay=\"autoplaySelect\"\r\n :rebound=\"reboundSelect\" :interval=\"intervalSelect\" :circular=\"circularSelect\"\r\n :indicator-color=\"indicatorColor\" :indicator-active-color=\"indicatorColorActive\"\r\n :disable-touch=\"disableTouchSelect\" :current=\"currentVal\" :current-item-id=\"currentItemIdVal\"\r\n @change=\"swiperChange\" @transition=\"swiperTransition\" @animationfinish=\"swiperAnimationfinish\">\r\n <swiper-item item-id=\"A\">\r\n <view class=\"swiper-item uni-bg-red\"><text class=\"swiper-item-Text\">A</text></view>\r\n </swiper-item>\r\n <swiper-item item-id=\"B\">\r\n <view class=\"swiper-item uni-bg-green\"><text class=\"swiper-item-Text\">B</text></view>\r\n </swiper-item>\r\n <swiper-item item-id=\"C\">\r\n <view class=\"swiper-item uni-bg-blue\"><text class=\"swiper-item-Text\">C</text></view>\r\n </swiper-item>\r\n </swiper>\r\n </view>\r\n <view class=\"uni-list\">\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">是否显示面板指示点</view>\r\n <switch :checked=\"dotsSelect\" @change=\"dotsChange\" />\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=\"autoplaySelect\" @change=\"autoplayChange\" />\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=\"circularSelect\" @change=\"circularChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">是否显示rebound效果</view>\r\n <switch :checked=\"reboundSelect\" @change=\"reboundSelectChange\" />\r\n </view>\r\n <view class=\"uni-title uni-list-cell-padding\">间隔时间(毫秒)</view>\r\n <view class=\"uni-list-cell-padding\">\r\n <slider @change=\"sliderChange\" :value=\"1000\" :min=\"500\" :max=\"5000\" :show-value=\"true\" />\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=\"indicatorColorSelect\" @change=\"indicatorColorChange\" />\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=\"verticalSelect\" @change=\"verticalChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">指定current为最后一个元素</view>\r\n <switch :checked=\"currentSelect\" @change=\"currentChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">指定current-item-id为最后一个元素</view>\r\n <switch :checked=\"currentItemIdSelect\" @change=\"currentItemIdChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">禁止用户 touch 操作</view>\r\n <switch :checked=\"disableTouchSelect\" @change=\"disableTouchChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">swiperTransition 是否打印</view>\r\n <switch :checked=\"swiperTransitionSelect\" @change=\"swiperTransitionChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">swiperAnimationfinish 是否打印</view>\r\n <switch :checked=\"swiperAnimationfinishSelect\" @change=\"swiperAnimationfinishChange\" />\r\n </view>\r\n <view class=\"uni-list-cell uni-list-cell-padding\">\r\n <view class=\"uni-list-cell-db\">swiperChange 是否打印</view>\r\n <switch :checked=\"swiperChangeSelect\" @change=\"swiperChangeChange\" />\r\n </view>\n\n <navigator url=\"/pages/component/swiper/swiper-list-view\">\n <button type=\"primary\">\n swiper 嵌套 list-view 测试\n </button>\n </navigator>\n\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 .swiper {\r\n height: 150px;\r\n }\r\n\r\n .swiper-item {\r\n width: 100%;\r\n height: 150px;\r\n }\r\n\r\n .swiper-item-Text {\r\n width: 100%;\r\n text-align: center;\r\n line-height: 150px;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\n type SwiperEventTest = {\n type: string;\n target: UniElement | null;\n currentTarget: UniElement | null;\n }\r\n export default {\r\n data() {\r\n return {\r\n background: ['color1', 'color2', 'color3'],\r\n dotsSelect: false,\r\n reboundSelect: false,\r\n autoplaySelect: false,\r\n circularSelect: false,\r\n indicatorColorSelect: false,\r\n verticalSelect: false,\r\n currentSelect: false,\r\n currentItemIdSelect: false,\r\n intervalSelect: 2000,\r\n indicatorColor: \"\",\r\n indicatorColorActive: \"\",\r\n currentVal: 0,\r\n currentItemIdVal: \"\",\r\n disableTouchSelect: false,\r\n swiperTransitionSelect: false,\r\n swiperAnimationfinishSelect: false,\r\n swiperChangeSelect: false,\r\n currentValChange: 0,\n // 自动化测试\n changeDetailTest:null as UniSwiperChangeEventDetail | null,\n transitionDetailTest:null as UniSwiperTransitionEventDetail | null,\n animationfinishDetailTest:null as UniSwiperAnimationFinishEventDetail | null,\n isChangeTest:'',\n isTransitionTest:'',\n isAnimationfinishTest:''\n }\r\n },\n methods: {\r\n swiperChange: function (e : UniSwiperChangeEvent) {\n this.changeDetailTest = e.detail\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as SwiperEventTest,'change')\n this.currentValChange = e.detail.current\r\n console.log(this.currentValChange)\r\n if (this.swiperChangeSelect) {\r\n console.log(\"swiperChange\")\r\n console.log(e)\r\n }\r\n },\r\n swiperTransition: function (e : UniSwiperTransitionEvent) {\n this.transitionDetailTest = e.detail\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as SwiperEventTest,'transition')\n if (this.swiperTransitionSelect) {\r\n console.log(\"swiperTransition\")\r\n console.log(e)\r\n }\r\n },\r\n swiperAnimationfinish: function (e : UniSwiperAnimationFinishEvent) {\n this.animationfinishDetailTest = e.detail\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as SwiperEventTest,'animationfinish')\n if (this.swiperAnimationfinishSelect) {\r\n console.log(\"swiperAnimationfinish\")\r\n console.log(e)\r\n }\r\n },\r\n // 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)\n checkEventTest(e:SwiperEventTest, eventName:String){\n const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;\n const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;\n switch (eventName){\n case 'change':\n this.isChangeTest = result\n break;\n case 'transition':\n this.isTransitionTest = result\n break;\n case 'animationfinish':\n this.isAnimationfinishTest = result\n break;\n default:\n break;\n }\n },\r\n dotsChange: function (e : UniSwitchChangeEvent) {\r\n this.dotsSelect = e.detail.value\r\n },\r\n swiperTransitionChange: function (e : UniSwitchChangeEvent) {\r\n this.swiperTransitionSelect = e.detail.value\r\n },\r\n swiperChangeChange: function (e : UniSwitchChangeEvent) {\r\n this.swiperChangeSelect = e.detail.value\r\n },\r\n swiperAnimationfinishChange: function (e : UniSwitchChangeEvent) {\r\n this.swiperAnimationfinishSelect = e.detail.value\r\n },\r\n autoplayChange: function (e : UniSwitchChangeEvent) {\n this.autoplaySelect = e.detail.value\r\n },\r\n verticalChange: function (e : UniSwitchChangeEvent) {\r\n this.verticalSelect = e.detail.value\r\n },\r\n disableTouchChange: function (e : UniSwitchChangeEvent) {\r\n this.disableTouchSelect = e.detail.value\r\n },\r\n currentItemIdChange: function (e : UniSwitchChangeEvent) {\r\n this.currentItemIdSelect = e.detail.value\r\n if (this.currentItemIdSelect) {\r\n this.currentItemIdVal = 'C'\r\n } else {\r\n this.currentItemIdVal = 'A'\r\n }\r\n },\r\n currentChange: function (e : UniSwitchChangeEvent) {\r\n this.currentSelect = e.detail.value\r\n if (this.currentSelect) {\r\n this.currentVal = 2\r\n } else {\r\n this.currentVal = 0\r\n }\r\n\r\n },\r\n circularChange: function (e : UniSwitchChangeEvent) {\r\n this.circularSelect = e.detail.value\r\n console.log(this.circularSelect)\r\n },\r\n reboundSelectChange: function (e : UniSwitchChangeEvent) {\r\n this.reboundSelect = e.detail.value\r\n console.log(this.reboundSelect)\r\n },\r\n sliderChange(e : UniSliderChangeEvent) {\r\n this.intervalSelect = e.detail.value\r\n },\r\n indicatorColorChange(e : UniSwitchChangeEvent) {\r\n this.indicatorColorSelect = e.detail.value\r\n if (this.indicatorColorSelect) {\r\n // 选择了定制指示器颜色\r\n this.indicatorColor = \"#ff00ff\"\r\n this.indicatorColorActive = \"#0000ff\"\r\n } else {\r\n // 没有选择颜色\r\n this.indicatorColor = \"\"\r\n this.indicatorColorActive = \"\"\r\n }\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n - [swiper-item](swiper-item.md)","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.swiper.swiper)\n- [参见uni-app相关文档](https://uniapp.dcloud.net.cn/component/swiper.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=swiper&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=swiper&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=swiper&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=swiper&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=swiper&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=swiper)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=swiper&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)\n"},"match-media":{"name":"## match-media","description":"media query 匹配检测节点","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| width | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面宽度(px 为单位) |\n| min-width | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面最小宽度(px 为单位) |\n| max-width | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面最大宽度(px 为单位) |\n| height | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面高度(px 为单位) |\n| min-height | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面最小高度(px 为单位) |\n| max-height | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 页面最大高度(px 为单位) |\n| orientation | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 屏幕方向(landscape 或 portrait) |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| vertical | - | - |\n@| horizontal | - | - |","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.match-media)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/match-media.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=match-media&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=match-media&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=match-media&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=match-media&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=match-media&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=match-media)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=match-media&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)\n"},"movable-area":{"name":"## movable-area","description":"movable-view 的可移动区域","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.movable.movable-area)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/movable-area.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=movable-area&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=movable-area&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=movable-area&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=movable-area&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=movable-area&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=movable-area)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=movable-area&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)\n"},"movable-view":{"name":"## movable-view","description":"可移动的视图容器,在页面中可以拖拽滑动","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| direction | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | movable-view的移动方向,属性值有all、vertical、horizontal、none |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| all | - | - |\n@| vertical | - | - |\n@| horizontal | - | - |\n@| none | - | - |\n| inertia | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | movable-view 是否带有惯性。 |\n| out-of-bounds | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 超过可移动区域后,movable-view 是否还可以移动。 |\n| x | string \\| number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 定义 x 轴方向的偏移,如果 x 的值不在可移动范围内,会自动移动到可移动范围;改变 x 的值会触发动画。 |\n| y | string \\| number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 定义 y 轴方向的偏移,如果 y 的值不在可移动范围内,会自动移动到可移动范围;改变 y 的值会触发动画。 |\n| damping | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 阻尼系数,用于控制 x 或 y 改变时的动画和过界回弹的动画,值越大移动越快。 |\n| friction | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 摩擦系数,用于控制惯性滑动的动画,值越大摩擦力越大,滑动越快停止;必须大于0,否则会被设置成默认值 2。 |\n| disabled | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否禁用。 |\n| scale | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否支持双指缩放,默认缩放手势生效区域是在 movable-view 内。 |\n| scale-min | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 定义缩放倍数最小值,默认为 0.5。 |\n| scale-max | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 定义缩放倍数最大值,默认为 10。 |\n| scale-value | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 定义缩放倍数,取值范围为 0.5 - 10 |\n| animation | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否使用动画,默认为 true。 |\n| @change | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 拖动过程中触发的事件,event.detail = {x: x, y: y, source: source}。其中source表示产生移动的原因,值可为touch(拖动)、touch-out-of-bounds(超出移动范围)、out-of-bounds(超出移动范围后的回弹)、friction(惯性)和空字符串(setData)。 |\n| @scale | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 缩放过程中触发的事件,event.detail = {x: x, y: y, scale: scale}。 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/movable-view/movable-view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/movable-view/movable-view\n>Template\n```vue\n<template>\n\t<view class=\"page-body\">\n\t\t<page-head title=\"movable-view,可拖动视图\"></page-head>\n\t\t<view class=\"uni-padding-wrap uni-common-mt\">\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 1\n\t\t\t\t<text>\\nmovable-view 区域小于 movable-area</text>\n\t\t\t</view>\n\t\t\t<movable-area>\n\t\t\t\t<movable-view :x=\"x\" :y=\"y\" direction=\"all\" @change=\"onChange\">text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view @tap=\"tap\" class=\"uni-link uni-center uni-common-mt\">\n\t\t\t\t点击这里移动至 (30px, 30px)\n\t\t\t</view>\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 2\n\t\t\t\t<text>\\nmovable-view区域大于movable-area</text>\n\t\t\t</view>\n\t\t\t<movable-area>\n\t\t\t\t<movable-view class=\"max\" direction=\"all\">text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 3\n\t\t\t\t<text>\\n只可以横向移动</text>\n\t\t\t</view>\n\t\t\t<movable-area>\n\t\t\t\t<movable-view direction=\"horizontal\">text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 4\n\t\t\t\t<text>\\n只可以纵向移动</text>\n\t\t\t</view>\n\t\t\t<movable-area>\n\t\t\t\t<movable-view direction=\"vertical\">text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 5\n\t\t\t\t<text>\\n可超出边界</text>\n\t\t\t</view>\n\t\t\t<movable-area>\n\t\t\t\t<movable-view direction=\"all\" out-of-bounds>text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 6\n\t\t\t\t<text>\\n带有惯性</text>\n\t\t\t</view>\n\t\t\t<movable-area>\n\t\t\t\t<movable-view direction=\"all\" inertia>text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view class=\"uni-title uni-common-mt\">\n\t\t\t\t示例 7\n\t\t\t\t<text>\\n可放缩</text>\n\t\t\t</view>\n\t\t\t<movable-area scale-area>\n\t\t\t\t<movable-view direction=\"all\" @scale=\"onScale\" scale scale-min=\"0.5\" scale-max=\"4\" :scale-value=\"scale\">text</movable-view>\n\t\t\t</movable-area>\n\t\t\t<view @tap=\"tap2\" class=\"uni-link uni-center uni-common-mt\" style=\"padding-bottom:80rpx;\">\n\t\t\t\t点击这里放大3倍\n\t\t\t</view>\n\t\t</view>\n\t</view>\n</template>\n\n\n\n<style>\n\tmovable-view {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\theight: 150rpx;\n\t\twidth: 150rpx;\n\t\tbackground-color: #007AFF;\n\t\tcolor: #fff;\n\t}\n\n\tmovable-area {\n\t\theight: 300rpx;\n\t\twidth: 100%;\n\t\tbackground-color: #D8D8D8;\n\t\toverflow: hidden;\n\t}\n\n\t.max {\n\t\twidth:500rpx;\n\t\theight: 500rpx;\n\t}\n</style>\n\n```\n>Script\n```uts\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tx: 0,\n\t\t\t\ty: 0,\n\t\t\t\tscale: 2,\n\t\t\t\told: {\n\t\t\t\t\tx: 0,\n\t\t\t\t\ty: 0,\n\t\t\t\t\tscale: 2\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tmethods: {\n\t\t\ttap: function(e) {\n\t\t\t\t// 解决view层不同步的问题\n\t\t\t\tthis.x = this.old.x\n\t\t\t\tthis.y = this.old.y\n\t\t\t\tthis.$nextTick(function() {\n\t\t\t\t\tthis.x = 30\n\t\t\t\t\tthis.y = 30\n\t\t\t\t})\n\t\t\t},\n\t\t\ttap2() {\n\t\t\t\t// 解决view层不同步的问题\n\t\t\t\tthis.scale = this.old.scale\n\t\t\t\tthis.scale = this.old.scale\n\t\t\t\tthis.$nextTick(function() {\n\t\t\t\t\tthis.scale = 3\n\t\t\t\t})\n\t\t\t},\n\t\t\tonChange: function(e) {\n\t\t\t\tthis.old.x = e.detail.x\n\t\t\t\tthis.old.y = e.detail.y\n\t\t\t},\n\t\t\tonScale: function(e) {\n\t\t\t\tthis.old.scale = e.detail.scale\n\t\t\t}\n\t\t}\n\t}\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.movable.movable-view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/movable-view.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=movable-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=movable-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=movable-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=movable-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=movable-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=movable-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=movable-view&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)\n"},"cover-view":{"name":"## cover-view","description":"覆盖在原生组件之上的文本视图,可覆盖的原生组件包括map、video、canvas、camera,只支持嵌套cover-view、cover-image","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/cover-view/cover-view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/cover-view/cover-view\n>Template\n```vue\n<template>\n\t<view>\n\t\t<page-head title=\"cover-view用于覆盖map、video等原生组件\"></page-head>\n\t\t<view class=\"cover-content\">\n\t\t\t<map :latitude=\"latitude\" :longitude=\"longitude\"></map>\n\t\t\t<cover-view class=\"cover-view\">简单的cover-view</cover-view>\n\t\t\t<cover-image class=\"cover-image\" src=\"/static/uni.png\"></cover-image>\n\t\t</view>\n\t</view>\n</template>\n\n\n\n<style>\n\tmap {\n\t\twidth: 100%;\n\t\theight: 600px;\n\t}\n\n\t.cover-content {\n\t\tposition: relative;\n\t}\n\n\t.cover-view {\n\t\tposition: absolute;\n\t\tleft: 5px;\n\t\ttop: 5px;\n\t\twidth: 375rpx;\n\t\ttext-align: center;\n\t\tbackground-color: #DDDDDD;\n\t}\n\n\t.cover-image {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tmargin: auto;\n\t\twidth: 96px;\n\t\theight: 96px;\n\t}\n</style>\n\n```\n>Script\n```uts\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tshowMap: false,\n latitude: 39.909,\n longitude: 116.39742\n\t\t\t};\n\t\t},\n\t\tonLoad() {\n this.showMap = true\n\t\t}\n\t}\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.cover.cover-view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/cover-view.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=cover-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=cover-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=cover-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=cover-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=cover-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=cover-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=cover-view&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)\n"},"cover-image":{"name":"## cover-image","description":"覆盖在原生组件之上的图片视图,可覆盖的原生组件同cover-view,支持嵌套在cover-view里。","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| v-for | Any | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | - |\n| v-if | Any | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | - |\n| v-show | Any | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | - |\n| src | string([string.ImageURIString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 图标路径,支持临时路径、网络地址(1.6.0起支持)。暂不支持base64格式。 |","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.cover.cover-image)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/cover-image.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=cover-image&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=cover-image&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=cover-image&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=cover-image&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=cover-image&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=cover-image)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=cover-image&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)\n"},"list-item":{"name":"## list-item","description":"> 组件类型:UniListItemElement \n\n list-view组件的唯一合法子组件。每个item是一行","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.02 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| type | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 对应list-item的类型 list-view 将对同类型条目进行复用,所以合理的类型拆分,可以很好地提升 list-view 性能 |","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.list-view.list-item)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=list-item&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=list-item&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=list-item&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=list-item&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=list-item&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=list-item)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=list-item&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)\n"},"sticky-header":{"name":"## sticky-header","description":"> 组件类型:UniStickyHeaderElement \n\n 吸顶布局容器 \n\n 注意:暂时仅支持作为list-view、sticky-section的子节点, sticky-header不支持css样式!当一个容器视图设置多个sticky-header时,后一个sticky-header会停靠在前一个sticky-header的末尾处。","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.02 | 3.93 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| padding | array\\<number> | [0,0,0,0\\] | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.98\",\"4.11\"]]}' /> | 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/sticky-header/sticky-header.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/sticky-header/sticky-header\n>Template\n```vue\n<template>\n <list-view :scroll-y=\"true\" class=\"page\" rebound=\"false\" show-scrollbar=false :scroll-top=\"scroll_top_input\"\n :refresher-enabled=\"refresher_enabled_boolean\" :refresher-triggered=\"refresher_triggered_boolean\"\n @refresherrefresh=\"list_view_refresherrefresh\">\n <list-item type=1>\n <swiper indicator-dots=\"true\" circular=\"true\" style=\"height: 240px;\">\n <swiper-item v-for=\"i in 3\" :item-id=\"i + ''\">\n <image src=\"/static/shuijiao.jpg\" style=\"height: 240px; width: 100%;\"></image>\n <text style=\"position: absolute;\">{{i}}</text>\n </swiper-item>\n </swiper>\n </list-item>\n <list-item class=\"content-item\" type=2>\n <text class=\"text\">向上滑动页面,体验sticky-header吸顶效果。</text>\n </list-item>\n <sticky-header>\n <scroll-view style=\"background-color: #f5f5f5; flex-direction: row;\" direction=\"horizontal\"\n :show-scrollbar=\"false\">\n <view style=\"align-self: flex-start; flex-direction: row;\">\n <text ref=\"swipertab\" class=\"sift-item\" v-for=\"(name,index) in sift_item\" @click=\"clickTH(index)\">\n {{name}}\n </text>\n </view>\n </scroll-view>\n </sticky-header>\n\n <list-item v-for=\"(item,index) in list_item\" :key=\"index\" class=\"content-item\" type=3>\n <text class=\"text\">{{item}}</text>\n </list-item>\n </list-view>\n</template>\n\n\n\n<style>\n .page {\n flex: 1;\n background-color: #f5f5f5;\n }\n\n .content-item {\n padding: 15px;\n margin-bottom: 10px;\n background-color: #fff;\n }\n\n .text {\n font-size: 14px;\n color: #666;\n line-height: 20px;\n }\n\n .sift-item {\n color: #555;\n font-size: 16px;\n padding: 12px 15px;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n sift_item: [\"排序\", \"筛选\"],\n list_item: [] as Array<string>,\n refresher_enabled_boolean: true,\n refresher_triggered_boolean: false,\n scroll_top_input: 0\n }\n },\n onLoad() {\n let lists : Array<string> = []\n for (let i = 0; i < 40; i++) {\n lists.push(\"item---\" + i)\n }\n this.list_item = lists\n },\n methods: {\n list_view_refresherrefresh() {\n console.log(\"下拉刷新被触发 \")\n this.refresher_triggered_boolean = true\n setTimeout(() => {\n this.refresher_triggered_boolean = false\n }, 1500)\n },\n confirm_scroll_top_input(value : number) {\n this.scroll_top_input = value\n },\n clickTH(index : number) {\n console.log(\"点击表头:\" + index);\n }\n }\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.sticky.sticky-header)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=sticky-header&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=sticky-header&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=sticky-header&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=sticky-header&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=sticky-header&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=sticky-header)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=sticky-header&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)\n"},"sticky-section":{"name":"## sticky-section","description":"> 组件类型:UniStickySectionElement \n\n 吸顶布局容器 \n\n 注意:暂时仅支持作为list-view的子节点, sticky-section不支持css样式!","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.02 | 3.98 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| push-pinned-header | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.98\",\"4.11\"]]}' /> | sticky-section元素重叠时是否继续上推 |\n| padding | array\\<number> | [0,0,0,0\\] | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.98\",\"4.11\"]]}' /> | 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/sticky-section/sticky-section.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/sticky-section/sticky-section\n>Template\n```vue\n<template>\r\n <page-head title=\"sticky-section\"></page-head>\n <list-view id=\"list-view\" ref=\"list-view\" show-scrollbar=false class=\"page\" :scroll-into-view=\"scrollIntoView\"\r\n @scroll=\"onScroll\" @scrollend=\"onScrollEnd\" bounces=\"false\">\r\n <list-item style=\"padding: 10px; margin: 5px 0;align-items: center;\" :type = 20>\r\n <button @click=\"gotoStickyHeader('C')\" size=\"mini\">跳转到id为C的sticky-header位置上</button>\r\n </list-item>\n <list-item style=\"padding: 10px; margin: 5px 0;align-items: center;\" :type = 20>\n <button @click=\"appendSectionItem(0)\" size=\"mini\">第一组 section 新增5条内容</button>\n </list-item>\n <list-item style=\"padding: 10px; margin: 5px 0;align-items: center;\" :type = 20>\n <button @click=\"deleteSection()\" size=\"mini\">删除第一组 section</button>\n </list-item>\r\n <sticky-section v-for=\"(section) in sectionArray\" :key=\"section.name\" :padding=\"sectionPadding\" :push-pinned-header=\"true\">\r\n <sticky-header :id=\"section.name\">\r\n <text class=\"sticky-header-text\">{{section.name}}</text>\r\n </sticky-header>\r\n <list-item v-for=\"(list) in section.list\" :key=\"list.text\" :name=\"list.text\" class=\"content-item\" :type=10>\r\n <text class=\"text\">{{list.text}}</text>\r\n </list-item>\r\n </sticky-section>\r\n <list-item style=\"padding: 10px; margin: 5px 0;align-items: center;\" :type= 30>\r\n <!-- <text style=\"color: #aaa\">到底了</text> -->\r\n <button @click=\"toTop\" size=\"mini\">回到顶部</button>\r\n </list-item>\r\n </list-view>\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n .page {\r\n flex: 1;\r\n background-color: #f5f5f5;\r\n }\r\n\r\n .sticky-header-text {\r\n font-size: 16px;\r\n padding: 8px;\r\n color: #959595;\r\n background-color: #f5f5f5;\r\n }\r\n\r\n .content-item {\r\n padding: 15px;\r\n margin-bottom: 10px;\r\n background-color: #fff;\r\n }\r\n</style>\r\n\n```\n>Script\n```uts\n\n export type sectionData={\n \tname:string,\n \tlist:sectionListItem[]\n }\n export type sectionListItem ={\n text:string\n }\r\n export default {\r\n data() {\r\n return {\r\n data: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'],\n sectionPadding: [0, 10, 0, 10] as Array<number>,\r\n scrollIntoView: \"\",\r\n scrolling: false,\n sectionArray:[] as sectionData[],\n appendId: 0\r\n }\r\n },\n onLoad() {\n this.data.forEach(key=> {\n const list =[] as sectionListItem[]\n for(let i = 1; i<11; i++) {\n const item = {text: key+\"--item--content----\"+i} as sectionListItem\n list.push(item)\n }\n const data = {name: key, list: list} as sectionData\n this.sectionArray.push(data)\n }\n )\n },\r\n methods: {\r\n toTop(){\r\n this.scrollIntoView = \"\"\r\n uni.getElementById(\"list-view\")!.scrollTop = 0\r\n },\r\n //用于自动化测试\r\n listViewScrollByY(y : number) {\r\n const listview = this.$refs[\"list-view\"] as UniElement\r\n // listview.scrollBy(0, y)\n listview.scrollTop = y\r\n },\r\n gotoStickyHeader(id : string) {\n // #ifdef APP\r\n this.scrollIntoView = id\n // #endif\n // #ifdef WEB\n console.log(\"web端不支持该功能\")\n // #endif\r\n },\r\n onScroll() {\r\n this.scrolling = true\r\n },\r\n onScrollEnd() {\r\n this.scrolling = false\r\n //滚动后重置scrollIntoView = \"\"\r\n if(this.scrollIntoView != \"\") {\r\n this.scrollIntoView = \"\"\r\n }\n },\n appendSectionItem(index: number) {\n const data = this.sectionArray[index]\n this.appendId++\n const list = [\n {text: data.name+\"--item--content----new1--\"+this.appendId} as sectionListItem,\n {text: data.name+\"--item--content----new2--\"+this.appendId} as sectionListItem,\n {text: data.name+\"--item--content----new3--\"+this.appendId} as sectionListItem,\n {text: data.name+\"--item--content----new4--\"+this.appendId} as sectionListItem,\n {text: data.name+\"--item--content----new5--\"+this.appendId} as sectionListItem\n ] as sectionListItem[]\n data.list.unshift(...list)\n },\n deleteSection() {\n this.sectionArray.shift()\n }\r\n }\r\n }\r\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.sticky.sticky-section)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=sticky-section&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=sticky-section&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=sticky-section&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=sticky-section&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=sticky-section&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=sticky-section)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=sticky-section&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)\n"},"list-view":{"name":"## list-view","description":"> 组件类型:UniListViewElement \n\n 列表组件","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.02 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| direction | string | \"vertical\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"4.11\"]]}' /> | 滚动方向,可取值 none、horizontal、vertical,默认值vertical。注:iOS 平台仅支持vertical |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"4.0\",\"4.11\"]]}' /> | 禁止滚动 |\n@| horizontal | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"x\"]]}' /> | 横向滚动 |\n@| vertical | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"4.0\",\"4.11\"]]}' /> | 竖向滚动 |\n| ~~scroll-x~~ | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"x\"]]}' /> | 允许横向滚动,不支持同时设置scroll-y属性为true,同时设置true时scroll-y生效。已废弃,请改用direction |\n| ~~scroll-y~~ | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 允许纵向滚动,不支持同时设置scroll-x属性为true,同时设置true时scroll-y生效。已废弃,请改用direction |\n| ~~rebound~~ | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 控制是否回弹效果。已废弃,请改用bounces |\n| associative-container | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.11\"]]}' /> | 关联的滚动容器 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| nested-scroll-view | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.11\"]]}' /> | 嵌套滚动 |\n| bounces | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"4.11\"]]}' /> | 控制是否回弹效果 优先级高于rebound |\n| upper-threshold | number | 50 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 距顶部/左边多远时(单位px),触发 scrolltoupper 事件 |\n| lower-threshold | number | 50 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 距底部/右边多远时(单位px),触发 scrolltolower 事件 |\n| scroll-top | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 设置竖向滚动条位置 |\n| scroll-left | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设置横向滚动条位置 |\n| show-scrollbar | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 控制是否出现滚动条 |\n| scroll-into-view | string([string.IDString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 值应为某子元素id(id不能以数字开头)。设置哪个方向可滚动,则在哪个方向滚动到该元素起始位置 |\n| scroll-with-animation | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 是否在设置滚动条位置时使用滚动动画,设置false没有滚动动画 |\n| refresher-enabled | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 开启下拉刷新,暂时不支持scroll-x = true横向刷新 |\n| refresher-threshold | number | 45 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置下拉刷新阈值, 仅 refresher-default-style = 'none' 自定义样式下生效 |\n| refresher-max-drag-distance | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设置下拉最大拖拽距离(单位px),默认是下拉刷新控件高度的2.5倍 |\n| refresher-default-style | string | \"black\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置下拉刷新默认样式,支持设置 black \\| white \\| none, none 表示不使用默认样式 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| black | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 深颜色雪花样式 |\n@| white | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.9\",\"4.11\"]]}' /> | 浅白色雪花样式 |\n@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.93\",\"4.11\"]]}' /> | 不使用默认样式 |\n| refresher-background | string([string.ColorString](/uts/data-type.md#ide-string)) | \"transparent\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置下拉刷新区域背景颜色,默认透明 |\n| refresher-triggered | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发 |\n| enable-back-to-top | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.11\"]]}' /> | iOS点击顶部状态栏滚动条返回顶部,只支持竖向 |\n| custom-nested-scroll | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 子元素是否开启嵌套滚动 将滚动事件与父元素协商处理 |\n| @refresherpulling | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新控件被下拉 |\n| @refresherrefresh | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新被触发 |\n| @refresherrestore | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新被复位 |\n| @refresherabort | (event: [UniRefresherEvent](#unirefresherevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.11\",\"3.9\",\"4.11\"]]}' /> | 下拉刷新被中止 |\n| @scrolltoupper | (event: [UniScrollToUpperEvent](#uniscrolltoupperevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 滚动到顶部/左边,会触发 scrolltoupper 事件 |\n| @scrolltolower | (event: [UniScrollToLowerEvent](#uniscrolltolowerevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 滚动到底部/右边,会触发 scrolltolower 事件 |\n| @scroll | (event: [UniScrollEvent](#uniscrollevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.02\",\"3.9\",\"4.11\"]]}' /> | 滚动时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} |\n| @scrollend | (event: [UniScrollEvent](#uniscrollevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 滚动结束时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY} |","event":"\n### 事件\n#### UniRefresherEvent\n\n##### UniRefresherEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniRefresherEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| dy | number | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniRefresherEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniScrollToUpperEvent\n\n##### UniScrollToUpperEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniScrollToUpperEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| direction | string | 是 | - | - | 滚动方向 top 或 left |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniScrollToUpperEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniScrollToLowerEvent\n\n##### UniScrollToLowerEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniScrollToLowerEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| direction | string | 是 | - | - | 滚动方向 bottom 或 right |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniScrollToLowerEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniScrollEvent\n\n##### UniScrollEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniScrollEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| scrollTop | number | 是 | - | - | 竖向滚动的距离 |\n@| scrollLeft | number | 是 | - | - | 横向滚动的距离 |\n@| scrollHeight | number | 是 | - | - | 滚动区域的高度 |\n@| scrollWidth | number | 是 | - | - | 滚动区域的宽度 |\n@| deltaY | number | 是 | - | - | 当次滚动事件竖向滚动量 |\n@| deltaX | number | 是 | - | - | 当次滚动事件横向滚动量 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniScrollEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/list-view/list-view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/list-view/list-view\n>Template\n```vue\n\n\n<template>\n <view class=\"main\">\n <list-view :direction=\"scroll_direction\" :rebound=\"bounces_boolean\" :upper-threshold=\"upper_threshold_input\"\n :lower-threshold=\"lower_threshold_input\" :scroll-top=\"scroll_top_input\" :scroll-left=\"scroll_left_input\"\n :show-scrollbar=\"show_scrollbar_boolean\" :scroll-into-view=\"scrollIntoView\"\n :scroll-with-animation=\"scroll_with_animation_boolean\" :refresher-enabled=\"refresher_enabled_boolean\"\n :refresher-background=\"refresher_background_input\" :refresher-triggered=\"refresher_triggered_boolean\"\n :refresher-default-style=\"refresher_default_style_input\" @click=\"list_view_click\"\n @touchstart=\"list_view_touchstart\" @touchmove=\"list_view_touchmove\" @touchcancel=\"list_view_touchcancel\"\n @touchend=\"list_view_touchend\" @tap=\"list_view_tap\" @longpress=\"list_view_longpress\"\n @refresherpulling=\"list_view_refresherpulling\" @refresherrefresh=\"list_view_refresherrefresh\"\n @refresherrestore=\"list_view_refresherrestore\" @refresherabort=\"list_view_refresherabort\"\n @scrolltoupper=\"list_view_scrolltoupper\" ref=\"listview\" @scrolltolower=\"list_view_scrolltolower\"\n @scroll=\"list_view_scroll\" @scrollend=\"list_view_scrollend\" style=\"width:100%;\" id=\"listview\">\n <list-item v-for=\"key in scrollData\" :key=\"key\" :id=\"key\" @click=\"list_item_click\"\n @touchstart=\"list_item_touchstart\" @touchmove=\"list_item_touchmove\" @touchcancel=\"list_item_touchcancel\"\n @touchend=\"list_item_touchend\" @tap=\"list_item_tap\" @longpress=\"list_item_longpress\" class=\"list-item\">\n <text>{{key}}</text>\n </list-item>\n <!-- #ifdef APP -->\n <list-item slot=\"refresher\" class=\"refresh-box\">\n <text class=\"tip-text\">{{text[state]}}</text>\n </list-item>\n <!-- #endif -->\n </list-view>\n </view>\n\n <scroll-view style=\"flex:1\" direction=\"vertical\">\n <view class=\"content\">\n <!-- #ifdef APP -->\n <boolean-data :defaultValue=\"false\" title=\"设置当前下拉刷新状态,true 表示下拉刷新已经被触发,false 表示下拉刷新未被触发\"\n @change=\"change_refresher_triggered_boolean\"></boolean-data>\n <boolean-data :defaultValue=\"false\" title=\"开启下拉刷新\" @change=\"change_refresher_enabled_boolean\"></boolean-data>\n <boolean-data :defaultValue=\"false\" title=\"开启自定义样式\" @change=\"change_refresher_style_boolean\"></boolean-data>\n <!-- #endif -->\n <boolean-data :defaultValue=\"false\" title=\"是否在设置滚动条位置时使用滚动动画,设置false没有滚动动画\"\n @change=\"change_scroll_with_animation_boolean\"></boolean-data>\n <boolean-data :defaultValue=\"false\" title=\"控制是否出现滚动条\" @change=\"change_show_scrollbar_boolean\"></boolean-data>\n <!-- #ifdef APP -->\n <boolean-data :defaultValue=\"true\" title=\"控制是否回弹效果\" @change=\"change_bounces_boolean\"></boolean-data>\n <!-- #endif -->\n <boolean-data :defaultValue=\"true\" title=\"允许纵向滚动\" @change=\"change_scroll_y_boolean\"></boolean-data>\n <!-- #ifdef APP -->\n <boolean-data :defaultValue=\"false\" title=\"允许横向滚动\" @change=\"change_scroll_x_boolean\"></boolean-data>\n <!-- #endif -->\n <input-data defaultValue=\"50\" title=\"距顶部/左边多远时(单位px),触发 scrolltoupper 事件\" type=\"number\"\n @confirm=\"confirm_upper_threshold_input\"></input-data>\n <input-data defaultValue=\"50\" title=\"距底部/右边多远时(单位px),触发 scrolltolower 事件\" type=\"number\"\n @confirm=\"confirm_lower_threshold_input\"></input-data>\n <input-data defaultValue=\"0\" title=\"设置竖向滚动条位置\" type=\"number\" @confirm=\"confirm_scroll_top_input\"></input-data>\n <!-- #ifdef APP -->\n <input-data defaultValue=\"0\" title=\"设置横向滚动条位置\" type=\"number\" @confirm=\"confirm_scroll_left_input\"></input-data>\n <input-data defaultValue=\"#FFF\" title=\"设置下拉刷新区域背景颜色\" type=\"text\"\n @confirm=\"confirm_refresher_background_input\"></input-data>\n <enum-data :items=\"size_enum\" title=\"通过id位置跳转\" @change=\"item_change_size_enum\"></enum-data>\n <navigator url=\"/pages/component/list-view/list-view-refresh\">\n <button type=\"primary\" class=\"button\">\n list-view 下拉刷新\n </button>\n </navigator>\n <!-- #endif -->\n <navigator url=\"/pages/component/list-view/list-view-multiplex\">\n <button type=\"primary\" class=\"button\">\n list-view 对list-item复用测试\n </button>\n </navigator>\n <navigator url=\"/pages/component/list-view/list-view-multiplex-input\">\n <button type=\"primary\" class=\"button\">\n list-view 复用测试(item中嵌入input)\n </button>\n </navigator>\n <navigator url=\"/pages/component/list-view/list-view-multiplex-video\">\n <button type=\"primary\" class=\"button\">\n list-view 复用测试(item中嵌入video)\n </button>\n </navigator>\n <navigator url=\"/pages/component/list-view/list-view-children-in-slot\">\n <button type=\"primary\" class=\"button\">\n list-view 测试插槽中子组件增删\n </button>\n </navigator>\n </view>\n </scroll-view>\n</template>\n\n<style>\n .main {\n max-height: 250px;\n padding: 5px 0;\n border-bottom: 1px solid rgba(0, 0, 0, .06);\n flex-direction: row;\n justify-content: center;\n }\n\n .main .list-item {\n width: 100%;\n height: 250px;\n border: 1px solid #666;\n background-color: #66ccff;\n align-items: center;\n justify-content: center;\n }\n\n .tip-text {\n color: #888;\n font-size: 12px;\n }\n\n .refresh-box {\n justify-content: center;\n align-items: center;\n flex-direction: row;\n height: 45px;\n width: 100%;\n }\n\n .button {\n margin-top: 15px;\n }\n</style>\n\n```\n>Script\n```uts\n\n type ScrollEventTest = {\n type: string;\n target: UniElement | null;\n currentTarget: UniElement | null;\n direction?:string\n }\n import { ItemType } from '@/components/enum-data/enum-data'\n export default {\n data() {\n return {\n refresher_triggered_boolean: false,\n refresher_enabled_boolean: false,\n scroll_with_animation_boolean: false,\n show_scrollbar_boolean: false,\n bounces_boolean: true,\n scroll_y_boolean: true,\n scroll_x_boolean: false,\n scroll_direction: \"vertical\",\n upper_threshold_input: 50,\n lower_threshold_input: 50,\n scroll_top_input: 0,\n scroll_left_input: 0,\n refresher_background_input: \"#FFF\",\n scrollData: [] as Array<string>,\n size_enum: [{ \"value\": 0, \"name\": \"item---0\" }, { \"value\": 3, \"name\": \"item---3\" }] as ItemType[],\n scrollIntoView: \"\",\n refresherrefresh: false,\n refresher_default_style_input: \"black\",\n text: ['继续下拉执行刷新', '释放立即刷新', '刷新中', \"\"],\n state: 3,\n reset: true,\n // 自动化测试\n isScrollTest:'',\n isScrolltolowerTest:'',\n isScrolltoupperTest:'',\n // 在web端scroll事件event参数中detail类型报错,先条件编译处理\n // #ifndef WEB\n scrollDetailTest:null as UniScrollEventDetail|null,\n scrollEndDetailTest:null as UniScrollEventDetail|null,\n // #endif\n }\n },\n onLoad() {\n let lists : Array<string> = []\n for (let i = 0; i < 10; i++) {\n lists.push(\"item---\" + i)\n }\n this.scrollData = lists\n },\n methods: {\n list_view_click() { console.log(\"组件被点击时触发\") },\n list_view_touchstart() { console.log(\"手指触摸动作开始\") },\n list_view_touchmove() { console.log(\"手指触摸后移动\") },\n list_view_touchcancel() { console.log(\"手指触摸动作被打断,如来电提醒,弹窗\") },\n list_view_touchend() { console.log(\"手指触摸动作结束\") },\n list_view_tap() { console.log(\"手指触摸后马上离开\") },\n list_view_longpress() { console.log(\"如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\") },\n list_view_refresherpulling(e : RefresherEvent) {\n console.log(\"下拉刷新控件被下拉\")\n if (this.reset) {\n if (e.detail.dy > 45) {\n this.state = 1\n } else {\n this.state = 0\n }\n }\n },\n list_view_refresherrefresh() {\n console.log(\"下拉刷新被触发 \")\n this.refresherrefresh = true\n this.refresher_triggered_boolean = true\n this.state = 2\n this.reset = false;\n setTimeout(() => {\n this.refresher_triggered_boolean = false\n }, 1500)\n },\n list_view_refresherrestore() {\n this.refresherrefresh = false\n this.state = 3\n this.reset = true\n console.log(\"下拉刷新被复位\")\n },\n list_view_refresherabort() { console.log(\"下拉刷新被中止\") },\n list_view_scrolltoupper(e : UniScrollToUpperEvent) {\n console.log(\"滚动到顶部/左边,会触发 scrolltoupper 事件 direction=\" + e.detail.direction)\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget,\n direction:e.detail.direction,\n } as ScrollEventTest,'scrolltoupper')\n },\n list_view_scrolltolower(e : UniScrollToLowerEvent) {\n console.log(\"滚动到底部/右边,会触发 scrolltolower 事件 direction=\" + e.detail.direction)\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget,\n direction:e.detail.direction,\n } as ScrollEventTest,'scrolltolower')\n },\n list_view_scroll(e:UniScrollEvent) {\n console.log(\"滚动时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY}\")\n // #ifndef WEB\n this.scrollDetailTest = e.detail\n // #endif\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as ScrollEventTest,'scroll')\n },\n list_view_scrollend(e:UniScrollEvent){\n console.log(\"滚动结束时触发\",e.detail)\n // #ifndef WEB\n this.scrollEndDetailTest = e.detail\n // #endif\n this.checkEventTest({\n type:e.type,\n target:e.target,\n currentTarget:e.currentTarget\n } as ScrollEventTest,'scrollend')\n },\n list_item_click() { console.log(\"list-item组件被点击时触发\") },\n list_item_touchstart() { console.log(\"手指触摸list-item组件动作开始\") },\n list_item_touchmove() { console.log(\"手指触摸list-item组件后移动\") },\n list_item_touchcancel() { console.log(\"手指触摸list-item组件动作被打断,如来电提醒,弹窗\") },\n list_item_touchend() { console.log(\"手指触摸list-item组件动作结束\") },\n list_item_tap() { console.log(\"手指触摸list-item组件后马上离开\") },\n list_item_longpress() { console.log(\"list-item组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\") },\n change_refresher_triggered_boolean(checked : boolean) { this.refresher_triggered_boolean = checked },\n change_refresher_enabled_boolean(checked : boolean) { this.refresher_enabled_boolean = checked },\n change_scroll_with_animation_boolean(checked : boolean) { this.scroll_with_animation_boolean = checked },\n change_show_scrollbar_boolean(checked : boolean) { this.show_scrollbar_boolean = checked },\n change_bounces_boolean(checked : boolean) { this.bounces_boolean = checked },\n change_scroll_y_boolean(checked : boolean) {\n this.scroll_y_boolean = checked\n this.change_scroll_direction()\n },\n change_scroll_x_boolean(checked : boolean) {\n this.scroll_x_boolean = checked\n this.change_scroll_direction()\n },\n change_scroll_direction() {\n if (this.scroll_y_boolean && this.scroll_x_boolean || this.scroll_y_boolean) {\n this.scroll_direction = \"vertical\"\n } else if (!this.scroll_y_boolean && !this.scroll_x_boolean) {\n this.scroll_direction = \"none\"\n } else if (!this.scroll_y_boolean && this.scroll_x_boolean) {\n this.scroll_direction = \"horizontal\"\n }\n },\n confirm_upper_threshold_input(value : number) { this.upper_threshold_input = value },\n confirm_lower_threshold_input(value : number) { this.lower_threshold_input = value },\n confirm_scroll_top_input(value : number) { this.scroll_top_input = value },\n confirm_scroll_left_input(value : number) { this.scroll_left_input = value },\n confirm_refresher_background_input(value : string) { this.refresher_background_input = value },\n item_change_size_enum(index : number) { this.scrollIntoView = \"item---\" + index },\n // 自动化测试专用(由于事件event参数对象中存在循环引用,在ios端JSON.stringify报错,自动化测试无法page.data获取)\n checkEventTest(e:ScrollEventTest, eventName:String){\n const isPass = e.type === eventName && e.target instanceof UniElement && e.currentTarget instanceof UniElement;\n const result = isPass ? `${eventName}:Success` : `${eventName}:Fail`;\n switch (eventName){\n case 'scroll':\n this.isScrollTest = result\n break;\n case 'scrolltolower':\n this.isScrolltolowerTest = result + `-${e.direction}`\n break;\n case 'scrolltoupper':\n this.isScrolltoupperTest = result + `-${e.direction}`\n break;\n default:\n break;\n }\n },\n //自动化测试例专用\n check_scroll_height() : Boolean {\n var listElement = this.$refs[\"listview\"] as UniElement\n console.log(\"check_scroll_height--\" + listElement.scrollHeight)\n if (listElement.scrollHeight > 2000) {\n return true\n }\n return false\n },\n //自动化测试例专用\n check_scroll_width() : Boolean {\n var listElement = this.$refs[\"listview\"] as UniElement\n console.log(\"check_scroll_width\" + listElement.scrollWidth)\n if (listElement.scrollWidth > 2000) {\n return true\n }\n return false\n },\n change_refresher_style_boolean(checked : boolean) {\n if (checked) {\n this.refresher_default_style_input = \"none\"\n } else {\n this.refresher_default_style_input = \"black\"\n }\n }\n }\n }\n\n```\n:::","children":"### 子组件 @children-tags \n - [list-item](list-item.md)\n- [sticky-header](https://uniapp.dcloud.net.cn/uni-app-x/component/sticky.html#sticky-header)\n- [sticky-section](https://uniapp.dcloud.net.cn/uni-app-x/component/sticky.html#sticky-section)","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.list-view.list-view)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=list-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=list-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=list-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=list-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=list-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=list-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=list-view&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)\n"},"nested-scroll-header":{"name":"## nested-scroll-header","description":"> 组件类型:UniNestedScrollHeaderElement \n\n scroll-view 嵌套模式场景中属于外层 scroll-view 的节点,仅支持作为 \\<scroll-view type='nested'> 嵌套模式的直接子节点。不支持复数子节点,渲染时会取其第一个子节点来渲染","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.11 | 4.11 |\n","attribute":"","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/nested-scroll-header/nested-scroll-header.uvue) \n >\n> 该组件不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n```uvue\n<template>\n\t<scroll-view style=\"flex:1\" type=\"nested\" direction=\"vertical\">\n <nested-scroll-header>\n <view class=\"scroll-header-tiem1\">\n <text>会渲染的nested-scroll-header</text>\n </view>\n <view class=\"scroll-header-tiem1\">\n <text>不会渲染nested-scroll-header,因为 nested-scroll-header 只会渲染第一个子节点</text>\n </view>\n </nested-scroll-header>\n <nested-scroll-header>\n <swiper ref=\"header\" indicator-dots=\"true\" circular=\"true\">\n <swiper-item v-for=\"i in 3\" :item-id=\"i\">\n <view class=\"scroll-header-tiem2\">\n <text>如果存在多个头部节点,那么就使用多个 nested-scroll-header 来将其包裹</text>\n </view>\n </swiper-item>\n </swiper>\n </nested-scroll-header>\n <nested-scroll-body>\n <scroll-view style=\"flex:1\" associative-container=\"nested-scroll-view\">\n <view v-for=\"key in scrollData\">\n \t<view class=\"scroll-item\">\n \t\t<text class=\"scroll-item-title\">{{key}}</text>\n \t</view>\n </view>\n </scroll-view>\n </nested-scroll-body>\n\t</scroll-view>\n</template>\n\n<script>\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n scrollData: [] as Array<string>,\n\t\t\t}\n\t\t},\n onLoad() {\n \tlet lists : Array<string> = []\n \tfor (let i = 0; i < 30; i++) {\n \t\tlists.push(\"item---\" + i)\n \t}\n \tthis.scrollData = lists\n },\n\t\tmethods: {\n\t\t}\n\t}\n</script>\n\n<style>\n\t.scroll-item {\r\n\t\tmargin-left: 6px;\r\n\t\tmargin-right: 6px;\r\n\t\tmargin-top: 6px;\r\n\t\tbackground-color: #fff;\r\n\t\tborder-radius: 4px;\r\n\t}\r\n\r\n\t.scroll-item-title {\r\n\t\twidth: 100%;\r\n\t\theight: 60px;\r\n\t\tline-height: 60px;\r\n\t\ttext-align: center;\r\n\t\tcolor: #555;\r\n\t}\n\n .scroll-header-tiem1 {\n height: 200px;\n background-color: #66ccff;\n align-items: center;\n justify-content: center;\n }\n\n .scroll-header-tiem2 {\n height: 100px;\n background-color: #89ff8d;\n align-items: center;\n justify-content: center;\n }\n\n</style>\n\n```","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.nested-scroll.nested-scroll-header)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=nested-scroll-header&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=nested-scroll-header&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=nested-scroll-header&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=nested-scroll-header&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=nested-scroll-header&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=nested-scroll-header)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=nested-scroll-header&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)\n"},"nested-scroll-body":{"name":"## nested-scroll-body","description":"> 组件类型:UniNestedScrollHeaderElement \n\n scroll-view 嵌套模式场景中属于嵌套内层 scroll-view 的父节点,仅支持作为 \\<scroll-view type='nested'> 嵌套模式的直接子节点。不支持复数子节点,渲染时会取其第一个子节点来渲染","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.11 | 4.11 |\n","attribute":"","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/nested-scroll-body/nested-scroll-body.uvue) \n >\n> 该组件不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n```uvue\n<template>\n\t<scroll-view style=\"flex:1\" type=\"nested\" direction=\"vertical\" refresher-enabled=\"true\" refresher-default-style=\"none\"\n bounces=\"false\" :refresher-triggered=\"refresherTriggered\" @refresherpulling=\"onRefresherpulling\" @refresherrefresh=\"onRefresherrefresh\" @refresherrestore=\"onRefreshrestore\">\n <nested-scroll-header>\n <swiper ref=\"header\" indicator-dots=\"true\" circular=\"true\">\n <swiper-item v-for=\"i in 3\" :item-id=\"i\">\n <image src=\"/static/shuijiao.jpg\" style=\"width:100% ;height: 240px;\"></image>\n </swiper-item>\n </swiper>\n </nested-scroll-header>\n <nested-scroll-body>\n <view style=\"flex:1\">\n <view style=\"flex-direction: row;\">\n <text style=\"padding: 12px 15px;\">nested-scroll-body</text>\n </view>\n <!-- 嵌套滚动仅可能关闭bounces效果 会影响嵌套滚动不连贯 -->\n <list-view bounces=\"false\" id=\"body-list\" :scroll-top=\"scrollTop\" style=\"flex:1\" associative-container=\"nested-scroll-view\">\n <list-item v-for=\"key in scrollData\">\n \t<view class=\"scroll-item\">\n \t\t<text class=\"scroll-item-title\">{{key}}</text>\n \t</view>\n </list-item>\n </list-view>\n </view>\n <text>不会渲染,因为 nested-scroll-body 只会渲染第一个子节点</text>\n </nested-scroll-body>\n <!-- 支持自定义样式下拉刷新slot组件 -->\n <refresh-box slot=\"refresher\" :state=\"state\"></refresh-box>\n\t</scroll-view>\n</template>\n\n<script>\n import refreshBox from '../../template/custom-refresher/refresh-box/refresh-box.uvue';\n\texport default {\n components: { refreshBox },\n\t\tdata() {\n\t\t\treturn {\n scrollData: [] as Array<string>,\n scrollTop: 0,\n refresherTriggered: false,\n pullingDistance: 0,\n resetting: false\n\t\t\t}\n\t\t},\n computed: {\n \tstate() : number {\n \t\tif (this.resetting) {\n \t\t\treturn 3;\n \t\t}\n \t\tif (this.refresherTriggered) {\n \t\t\treturn 2\n \t\t}\n \t\tif (this.pullingDistance > 45) {\n \t\t\treturn 1\n \t\t} else {\n \t\t\treturn 0;\n \t\t}\n \t}\n },\n onLoad() {\n \tlet lists : Array<string> = []\n \tfor (let i = 0; i < 30; i++) {\n \t\tlists.push(\"item---\" + i)\n \t}\n \tthis.scrollData = lists\n },\n\t\tmethods: {\n onRefresherpulling(e : RefresherEvent) {\n \tthis.pullingDistance = e.detail.dy;\n },\n onRefresherrefresh() {\n \tthis.refresherTriggered = true\n \tsetTimeout(() => {\n \t\tthis.refresherTriggered = false\n \t\tthis.resetting = true;\n \t}, 1500)\n },\n onRefreshrestore() {\n this.pullingDistance = 0\n \tthis.resetting = false;\n },\n //自动化测试使用\n testBodyScrollBy(y: number) {\n this.scrollTop = y\n }\n\t\t}\n\t}\n</script>\n\n<style>\n\t.scroll-item {\r\n\t\tmargin-left: 6px;\r\n\t\tmargin-right: 6px;\r\n\t\tmargin-top: 6px;\r\n\t\tbackground-color: #fff;\r\n\t\tborder-radius: 4px;\r\n\t}\r\n\r\n\t.scroll-item-title {\r\n\t\twidth: 100%;\r\n\t\theight: 60px;\r\n\t\tline-height: 60px;\r\n\t\ttext-align: center;\r\n\t\tcolor: #555;\r\n\t}\n\n .scroll-header-tiem {\n height: 200px;\n background-color: #66ccff;\n align-items: center;\n justify-content: center;\n }\n</style>\n\n```","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.nested-scroll.nested-scroll-body)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=nested-scroll-body&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=nested-scroll-body&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=nested-scroll-body&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=nested-scroll-body&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=nested-scroll-body&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=nested-scroll-body)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=nested-scroll-body&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)\n"},"object":{"name":"## object","description":"> 组件类型:[UniObjectElement](/dom/uniobjectelement.md) \n\n 自定义原生组件","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.25 | 4.25 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| @init | (event: [UniObjectInitEvent](#uniobjectinitevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.25\",\"4.25\"]]}' /> | object初始化时回调,event.detail = { element: 'object元素实例对象'} |","event":"\n### 事件\n#### UniObjectInitEvent\nUniObject init事件event\n##### UniObjectInitEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniObjectInitEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| element | [UniObjectElement](/dom/uniobjectelement.md) | 是 | - | - | - |\n| type | string | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniObjectInitEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.view-container.object)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=object&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=object&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=object&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=object&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=object&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=object)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=object&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)\n"},"icon":{"name":"## icon","description":"图标","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| type | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | icon的类型,有效值:success, success_no_circle, info, warn, waiting, cancel, download, search, clear |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| success | - | - |\n@| success_no_circle | - | - |\n@| warn | - | - |\n@| waiting | - | - |\n@| cancel | - | - |\n@| download | - | - |\n@| search | - | - |\n@| clear | - | - |\n| size | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | icon的大小,单位px |\n| color | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | icon的颜色,同css的color |","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.basic-content.icon)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/icon.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=icon&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=icon&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=icon&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=icon&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=icon&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=icon)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=icon&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)\n"},"text":{"name":"## text","description":"> 组件类型:[UniTextElement](#unitextelement) \n\n 文本","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| selectable | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 文本是否可选 |\n| space | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 显示连续空格 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| ensp | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 中文字符空格一半大小 |\n@| emsp | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 中文字符空格大小 |\n@| nbsp | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 根据字体设置的空格大小 |\n| decode | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否解码 (app平台如需解析字符实体,需要配置为 true) |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/text/text.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/text/text\n>Template\n```vue\n<template>\r\n <!-- #ifdef APP -->\n <scroll-view style=\"flex: 1\">\n <!-- #endif -->\r\n <page-head :title=\"title\"></page-head>\r\n <view class=\"uni-padding-wrap uni-common-mt\">\r\n <view class=\"text-box\">\r\n <text class=\"text\">{{ text }}</text>\r\n </view>\r\n <view class=\"uni-btn-v\">\r\n <button class=\"uni-btn\" type=\"primary\" :disabled=\"!canAdd\" @click=\"add\">\r\n add line\r\n </button>\r\n <button class=\"uni-btn\" type=\"warn\" :disabled=\"!canRemove\" @click=\"remove\">\r\n remove line\r\n </button>\r\n <button class=\"uni-btn\" type=\"primary\" @click=\"textProps\">\r\n 更多属性示例\r\n </button>\r\n </view>\r\n </view>\r\n <!-- #ifdef APP -->\n </scroll-view>\n <!-- #endif -->\r\n</template>\n\r\n\r\n\r\n<style>\r\n .text-box {\r\n margin-bottom: 20px;\r\n padding: 20px 0;\r\n display: flex;\r\n min-height: 150px;\r\n background-color: #ffffff;\r\n justify-content: center;\r\n align-items: center;\r\n }\r\n\r\n .text {\r\n font-size: 15px;\r\n color: #353535;\r\n line-height: 27px;\r\n text-align: center;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'text',\r\n texts: [\r\n 'HBuilderX,轻巧、极速,极客编辑器',\r\n 'uni-app x,终极跨平台方案',\r\n 'uniCloud,js serverless云服务',\r\n 'uts,大一统语言',\r\n 'uniMPSdk,让你的App具备小程序能力',\r\n 'uni-admin,开源、现成的全端管理后台',\r\n 'uni-id,开源、全端的账户中心',\r\n 'uni-pay,开源、云端一体、全平台的支付',\r\n 'uni-ai,聚合ai能力',\r\n 'uni-cms,开源、云端一体、全平台的内容管理平台',\r\n 'uni-im,开源、云端一体、全平台的im即时消息',\r\n 'uni统计,开源、完善、全平台的统计报表',\r\n '......'\r\n ] as string[],\r\n text: '',\r\n canAdd: true,\r\n canRemove: false,\r\n extraLine: [] as string[]\r\n }\r\n },\r\n methods: {\r\n add: function () {\r\n this.extraLine.push(this.texts[this.extraLine.length % 12]);\r\n this.text = this.extraLine.join('\\n');\r\n this.canAdd = this.extraLine.length < 12;\r\n this.canRemove = this.extraLine.length > 0;\r\n },\r\n remove: function () {\r\n if (this.extraLine.length > 0) {\r\n this.extraLine.pop();\r\n this.text = this.extraLine.join('\\n');\r\n this.canAdd = this.extraLine.length < 12;\r\n this.canRemove = this.extraLine.length > 0;\r\n }\r\n },\r\n textProps: function () {\r\n uni.navigateTo({\r\n url: '/pages/component/text/text-props'\r\n })\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n - [text](text.md)","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.basic-content.text)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/text.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=text&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=text&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=text&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=text&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=text&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=text)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=text&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)\n","component_type":"### UniTextElement\ntext元素对象\n#### UniTextElement 的属性值\n| 名称 | 类型 | 必填 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| value | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 text元素的文案内容 |\n#### UniTextElement 的方法\n##### getTextExtra() @gettextextra\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| any \\| null | 否 |\n \n\n###### getTextExtra 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n"},"rich-text":{"name":"## rich-text","description":"> 组件类型:UniRichTextElement \n\n 富文本。可渲染文字样式、图片、超链接。支持部分HTML标签","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| nodes | array \\| string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 节点列表 \\| HTML String |\n| selectable | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 文本是否可选 |\n| @itemclick | (event: [UniRichTextItemClickEvent](#unirichtextitemclickevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 拦截点击事件(只支持 a、img标签),返回用户自定义数据或img标签的src属性或a标签的href属性。event.detail={ ref \\| src \\| href } |","event":"\n### 事件\n#### UniRichTextItemClickEvent\n\n##### UniRichTextItemClickEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniRichTextItemClickEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| ref | string \\| null | 否 | - | - | 自定义数据 |\n@| src | string \\| null | 否 | - | - | \\<img/>图片链接 |\n@| href | string \\| null | 否 | - | - | \\<a/>超链接 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniRichTextItemClickEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/rich-text/rich-text.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/rich-text/rich-text\n>Template\n```vue\n<template>\n <view>\n <page-head title=\"rich-text\"></page-head>\n <view class=\"uni-padding-wrap uni-common-mt\">\n <view class=\"uni-btn-v\">\n <navigator url=\"/pages/component/rich-text/rich-text-tags\">\n <button type=\"primary\">rich-text渲染单个HTML标签示例</button>\n </navigator>\n </view>\n <view class=\"uni-btn-v\">\n <navigator url=\"/pages/component/rich-text/rich-text-complex\">\n <button type=\"primary\">rich-text渲染复杂HTML示例</button>\n </navigator>\n </view>\n <view class=\"uni-title\">\n <text class=\"uni-subtitle-text\">selectable</text>\n </view>\n <view class=\"text-box\">\n <rich-text :selectable=\"true\"\n nodes=\"<span>hello uni-app x!</span><br/><span>uni-app x,终极跨平台方案</span>\"></rich-text>\n </view>\n </view>\n </view>\n</template>\n\n\n\n<style>\n .text-box {\n padding: 20px 0;\n background-color: white;\n }\n</style>\n\n```\n>Script\n```uts\n\n\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.basic-content.rich-text)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/rich-text.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=rich-text&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=rich-text&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=rich-text&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=rich-text&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=rich-text&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=rich-text)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=rich-text&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)\n"},"progress":{"name":"## progress","description":"> 组件类型:UniProgressElement \n\n 进度条","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| duration | number | 30 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 进度增加1%所需毫秒数 |\n| percent | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 百分比0~100 |\n| show-info | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在进度条右侧显示百分比 |\n| border-radius | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 圆角大小 |\n| font-size | number | 16 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 右侧百分比字体大小 |\n| stroke-width | number | 6 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 进度条线的宽度,单位px |\n| activeColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#09BB07\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 已选择的进度条的颜色 |\n| backgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#EBEBEB\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 未选择的进度条的颜色 |\n| active | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 进度条从左往右的动画 |\n| active-mode | string | \"backwards\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | backwards: 动画从头播;forwards:动画从上次结束点接着播 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| backwards | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 动画从头播 |\n@| forwards | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 动画从上次结束点接着播 |\n| @activeend | (event: [UniProgressActiveendEvent](#uniprogressactiveendevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 动画完成事件 |","event":"\n### 事件\n#### UniProgressActiveendEvent\n\n##### UniProgressActiveendEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniProgressActiveendEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| curPercent | number | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniProgressActiveendEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/progress/progress.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/progress/progress\n>Template\n```vue\n\r\n\r\n<template>\r\n <view class=\"main\">\r\n <progress :duration=\"duration_input\" :percent=\"percent_input\" :show-info=\"show_info_boolean\"\r\n :stroke-width=\"stroke_width_input\" :activeColor=\"activeColor_input\" :backgroundColor=\"backgroundColor_input\"\r\n :active=\"active_boolean\" :active-mode=\"active_mode_enum[active_mode_enum_current].name\"\r\n @touchstart=\"progress_touchstart\" @touchmove=\"progress_touchmove\" @touchcancel=\"progress_touchcancel\"\r\n @touchend=\"progress_touchend\" @tap=\"progress_tap\" style=\"width: 80%\">\r\n <text>uni-app-x</text>\r\n </progress>\r\n </view>\r\n\r\n <scroll-view style=\"flex: 1\">\r\n <view class=\"content\">\r\n <page-head title=\"组件属性\"></page-head>\r\n <boolean-data :defaultValue=\"false\" title=\"进度条从左往右的动画\" @change=\"change_active_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"在进度条右侧显示百分比\" @change=\"change_show_info_boolean\"></boolean-data>\r\n <input-data defaultValue=\"30\" title=\"进度增加1%所需毫秒数\" type=\"number\" @confirm=\"confirm_duration_input\"></input-data>\r\n <input-data defaultValue=\"0\" title=\"百分比0~100\" type=\"number\" @confirm=\"confirm_percent_input\"></input-data>\r\n <input-data defaultValue=\"6\" title=\"进度条线的宽度,单位px\" type=\"number\"\r\n @confirm=\"confirm_stroke_width_input\"></input-data>\r\n <input-data defaultValue=\"#09BB07\" title=\"已选择的进度条的颜色\" type=\"text\"\r\n @confirm=\"confirm_activeColor_input\"></input-data>\r\n <input-data defaultValue=\"#EBEBEB\" title=\"未选择的进度条的颜色\" type=\"text\"\r\n @confirm=\"confirm_backgroundColor_input\"></input-data>\r\n <enum-data :items=\"active_mode_enum\" title=\"backwards: 动画从头播;forwards:动画从上次结束点接着播\"\r\n @change=\"radio_change_active_mode_enum\"></enum-data>\r\n </view>\r\n\r\n <view>\r\n <page-head title=\"默认及使用\"></page-head>\r\n <view class=\"uni-padding-wrap uni-common-mt\">\r\n <view class=\"progress-box\">\r\n <progress :percent=\"pgList[0]\" :active=\"true\" :border-radius=\"borderRadius\" :show-info=\"showInfo\"\r\n :font-size=\"fontSize\" :stroke-width=\"strokeWidth\" :background-color=\"backgroundColor\" class=\"progress p\"\r\n @activeend=\"activeend\" />\r\n </view>\r\n <view class=\"progress-box\">\r\n <progress :percent=\"pgList[1]\" :stroke-width=\"3\" class=\"progress p1\" />\r\n </view>\r\n <view class=\"progress-box\">\r\n <progress :percent=\"pgList[2]\" :stroke-width=\"3\" class=\"progress p2\" />\r\n </view>\r\n <view class=\"progress-box\">\r\n <progress :percent=\"pgList[3]\" activeColor=\"#10AEFF\" :stroke-width=\"3\" class=\"progress p3\" />\r\n </view>\r\n <view class=\"progress-control\">\r\n <button type=\"primary\" @click=\"setProgress\" class=\"button\">\r\n 设置进度\r\n </button>\r\n <button type=\"warn\" @click=\"clearProgress\" class=\"button\">\r\n 清除进度\r\n </button>\r\n </view>\r\n </view>\r\n </view>\r\n </scroll-view>\r\n</template>\r\n\r\n<style>\r\n .main {\r\n max-height: 250px;\r\n padding: 5px 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n .main .list-item {\r\n width: 100%;\r\n height: 100px;\r\n border: 1px solid #666;\r\n }\r\n\r\n .progress-box {\r\n height: 25px;\r\n margin-bottom: 30px;\r\n }\r\n\r\n .button {\r\n margin-top: 10px;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n import { state, setEventCallbackNum } from '@/store/index.uts'\r\n import { ItemType } from '@/components/enum-data/enum-data'\r\n export default {\r\n data() {\r\n return {\r\n title: 'progress',\r\n pgList: [0, 0, 0, 0] as number[],\r\n curPercent: 0,\r\n showInfo: true,\r\n borderRadius: 0,\r\n fontSize: 16,\r\n strokeWidth: 3,\r\n backgroundColor: '#EBEBEB',\r\n\r\n // 组件属性 autotest\r\n active_boolean: false,\r\n show_info_boolean: false,\r\n duration_input: 30,\r\n percent_input: 0,\r\n stroke_width_input: 6,\r\n activeColor_input: \"#09BB07\",\r\n backgroundColor_input: \"#EBEBEB\",\r\n active_mode_enum: [{ \"value\": 0, \"name\": \"backwards\" }, { \"value\": 1, \"name\": \"forwards\" }] as ItemType[],\r\n active_mode_enum_current: 0\r\n }\r\n },\r\n methods: {\r\n // 自动化测试\r\n getEventCallbackNum() : number {\r\n return state.eventCallbackNum\r\n },\r\n // 自动化测试\r\n setEventCallbackNum(num : number) {\r\n setEventCallbackNum(num)\r\n },\r\n\r\n setProgress() {\r\n this.pgList = [20, 40, 60, 80] as number[]\r\n },\r\n clearProgress() {\r\n this.pgList = [0, 0, 0, 0] as number[]\r\n },\r\n activeend(e : UniProgressActiveendEvent) {\r\n // 自动化测试\r\n if ((e.target?.tagName ?? '').includes('PROGRESS')) {\r\n this.setEventCallbackNum(state.eventCallbackNum + 1)\r\n }\r\n if (e.type === 'activeend') {\r\n this.setEventCallbackNum(state.eventCallbackNum + 2)\r\n }\r\n this.curPercent = e.detail.curPercent\r\n },\r\n progress_touchstart() { console.log(\"手指触摸动作开始\") },\r\n progress_touchmove() { console.log(\"手指触摸后移动\") },\r\n progress_touchcancel() { console.log(\"手指触摸动作被打断,如来电提醒,弹窗\") },\r\n progress_touchend() { console.log(\"手指触摸动作结束\") },\r\n progress_tap() { console.log(\"手指触摸后马上离开\") },\r\n change_active_boolean(checked : boolean) { this.active_boolean = checked },\r\n change_show_info_boolean(checked : boolean) { this.show_info_boolean = checked },\r\n confirm_duration_input(value : number) { this.duration_input = value },\r\n confirm_percent_input(value : number) { this.percent_input = value },\r\n confirm_stroke_width_input(value : number) { this.stroke_width_input = value },\r\n confirm_activeColor_input(value : string) { this.activeColor_input = value },\r\n confirm_backgroundColor_input(value : string) { this.backgroundColor_input = value },\r\n radio_change_active_mode_enum(checked : number) { this.active_mode_enum_current = checked }\r\n }\r\n }\r\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.basic-content.progress)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/progress.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=progress&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=progress&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=progress&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=progress&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=progress&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=progress)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=progress&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)\n"},"button":{"name":"## button","description":"> 组件类型:UniButtonElement \n\n 按钮","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| disabled | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否禁用 |\n| hover-class | string([string.ClassString](/uts/data-type.md#ide-string)) | \"button-hover\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定按下去的样式类。当 hover-class=\"none\" 时,没有点击态效果 |\n| hover-start-time | number | 20 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 按住后多久出现点击态,单位毫秒 |\n| hover-stay-time | number | 70 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 手指松开后点击态保留时间,单位毫秒 |\n| size | string | \"default\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 按钮的大小 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| default | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 默认大小 |\n@| mini | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 小尺寸 |\n| type | string | \"default\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 按钮的样式类型 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| default | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 白色 |\n@| primary | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 蓝色 |\n@| warn | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 红色 |\n| plain | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 按钮是否镂空,背景色透明 |\n| loading | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 名称前是否带 loading 图标 |\n| form-type | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 用于 form 组件,点击分别会触发 form 组件的 submit/reset 事件 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| submit | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 提交表单 |\n@| reset | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 重置表单 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/button/button.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/button/button\n>Template\n```vue\n\r\n\r\n<template>\r\n <view class=\"main\">\r\n <button id=\"testButton\" :disabled=\"disabled_boolean\" :size=\"size_enum[size_enum_current].name\"\r\n :type=\"type_enum[type_enum_current].name\" :plain=\"plain_boolean\" @click=\"button_click\"\r\n @touchstart=\"button_touchstart\" @touchmove=\"button_touchmove\" @touchcancel=\"button_touchcancel\"\r\n @touchend=\"button_touchend\" @tap=\"button_tap\" @longpress=\"button_longpress\" class=\"btn\"\r\n :class=\"default_style ? (disabled_boolean ? 'custom-btn-disable' : 'custom-btn') : ''\"\r\n :hover-class=\"default_style ? 'is-hover' : 'button-hover'\">\r\n {{ text }}\r\n </button>\r\n </view>\r\n <scroll-view style=\"flex: 1\">\r\n <view class=\"content\">\r\n <boolean-data :defaultValue=\"false\" title=\"按钮是否镂空,背景色透明\" @change=\"change_plain_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"是否禁用\" @change=\"change_disabled_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"修改默认样式和点击效果(高优先)\" @change=\"change_default_style\"></boolean-data>\r\n <enum-data :items=\"size_enum\" title=\"按钮的大小\" @change=\"radio_change_size_enum\"></enum-data>\r\n <enum-data :items=\"type_enum\" title=\"按钮的类型\" @change=\"radio_change_type_enum\"></enum-data>\r\n <input-data :defaultValue=\"text\" title=\"按钮的文案\" type=\"text\" @confirm=\"confirm_text_input\"></input-data>\r\n <view style=\"height: 10px;\"></view>\r\n <button @click=\"navigateToChild\">更多示例</button>\r\n </view>\r\n </scroll-view>\r\n</template>\r\n\r\n<style>\r\n .main {\r\n padding: 5px 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n .main .list-item {\r\n width: 100%;\r\n height: 100px;\r\n border: 1px solid #666;\r\n }\r\n\r\n .custom-btn {\r\n color: #ffffff;\r\n background-color: #1AAD19;\r\n border-color: #1AAD19;\r\n }\r\n\r\n .custom-btn-disable {\r\n color: rgba(255, 255, 255, 0.7);\r\n background-color: rgba(26, 173, 25, 0.7);\r\n border-color: rgba(26, 173, 25, 0.7);\r\n }\r\n\r\n .is-hover {\r\n color: rgba(255, 255, 255, 0.6);\r\n background-color: #179b16;\r\n border-color: #179b16;\r\n }\r\n\r\n .button-hover {\r\n color: rgba(0, 0, 0, 0.6);\r\n background-color: #dedede;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n import { ItemType } from '@/components/enum-data/enum-data'\r\n export default {\r\n data() {\r\n return {\r\n plain_boolean: false,\r\n disabled_boolean: false,\r\n default_style: false,\r\n size_enum: [{ \"value\": 0, \"name\": \"default\" }, { \"value\": 1, \"name\": \"mini\" }] as ItemType[],\r\n size_enum_current: 0,\r\n type_enum: [{ \"value\": 0, \"name\": \"default\" }, { \"value\": 1, \"name\": \"primary\" }, { \"value\": 2, \"name\": \"warn\" }] as ItemType[],\r\n type_enum_current: 0,\r\n count: 0,\r\n text: ''\r\n }\r\n },\n onReady() {\n this.text = 'uni-app-x'\n },\r\n methods: {\r\n button_click() {\r\n console.log(\"组件被点击时触发\")\r\n this.count++\r\n },\r\n button_touchstart() { console.log(\"手指触摸动作开始\") },\r\n button_touchmove() { console.log(\"手指触摸后移动\") },\r\n button_touchcancel() { console.log(\"手指触摸动作被打断,如来电提醒,弹窗\") },\r\n button_touchend() { console.log(\"手指触摸动作结束\") },\r\n button_tap() { console.log(\"手指触摸后马上离开\") },\r\n button_longpress() { console.log(\"如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\") },\r\n change_plain_boolean(checked : boolean) { this.plain_boolean = checked },\r\n change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },\r\n change_default_style(checked : boolean) { this.default_style = checked },\r\n radio_change_size_enum(checked : number) { this.size_enum_current = checked },\r\n radio_change_type_enum(checked : number) { this.type_enum_current = checked },\r\n confirm_text_input(value : string) { this.text = value },\r\n navigateToChild() {\r\n uni.navigateTo({\r\n url: 'buttonstatus',\r\n })\r\n },\r\n //用于自动化测试\r\n checkUniButtonElement() : boolean {\r\n const button = uni.getElementById(\"testButton\")\r\n if (button != null && button instanceof UniButtonElement) {\r\n return true\r\n }\r\n return false\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.button)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/button.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=button&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=button&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=button&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=button&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=button&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=button)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=button&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)\n"},"checkbox":{"name":"## checkbox","description":"> 组件类型:UniCheckboxElement \n\n 多选项。在1组check-group中可选择多个","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| disabled | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否禁用 |\n| value | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox 标识,选中时触发 checkbox-group 的 change 事件,并携带 checkbox 的 value |\n| checked | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当前是否选中,可用来设置默认选中 |\n| ~~color~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007aff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox的颜色 (使用foreColor替代) |\n| backgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#ffffff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox默认的背景颜色 |\n| borderColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#d1d1d1\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox默认的边框颜色 |\n| activeBackgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#ffffff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox选中时的背景颜色 |\n| activeBorderColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#d1d1d1\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox选中时的边框颜色 |\n| ~~iconColor~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007aff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox的图标颜色,优先级大于color属性 (使用foreColor替代) |\n| foreColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007aff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | checkbox的图标颜色,优先级大于color属性 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/checkbox/checkbox.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/checkbox/checkbox\n>Template\n```vue\n\r\n\r\n<template>\r\n <view class=\"main\">\r\n <checkbox :disabled=\"disabled_boolean\" :checked=\"checked_boolean\" :color=\"color_input\" :iconColor=\"iconColor_input\"\r\n :foreColor=\"foreColor_input\" :backgroundColor=\"backgroundColor_input\" :borderColor=\"borderColor_input\"\r\n :activeBackgroundColor=\"activeBackgroundColor_input\" :activeBorderColor=\"activeBorderColor_input\"\r\n @click=\"checkbox_click\" @touchstart=\"checkbox_touchstart\" @touchmove=\"checkbox_touchmove\"\r\n @touchcancel=\"checkbox_touchcancel\" @touchend=\"checkbox_touchend\" @tap=\"checkbox_tap\"\r\n @longpress=\"checkbox_longpress\"><text>uni-app-x</text></checkbox>\r\n </view>\r\n\r\n <scroll-view style=\"flex: 1\">\r\n <view class=\"content\">\r\n <page-head title=\"组件属性\"></page-head>\r\n <boolean-data :defaultValue=\"false\" title=\"当前是否选中,可用来设置默认选中\" @change=\"change_checked_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"是否禁用\" @change=\"change_disabled_boolean\"></boolean-data>\r\n <input-data defaultValue=\"#007aff\" title=\"checkbox的颜色\" type=\"text\" @confirm=\"confirm_color_input\"></input-data>\r\n <input-data defaultValue=\"#ffffff\" title=\"checkbox默认的背景颜色\" type=\"text\"\r\n @confirm=\"confirm_backgroundColor_input\"></input-data>\r\n <input-data defaultValue=\"#d1d1d1\" title=\"checkbox默认的边框颜色\" type=\"text\"\r\n @confirm=\"confirm_borderColor_input\"></input-data>\r\n <input-data defaultValue=\"#ffffff\" title=\"checkbox选中时的背景颜色\" type=\"text\"\r\n @confirm=\"confirm_activeBackgroundColor_input\"></input-data>\r\n <input-data defaultValue=\"#d1d1d1\" title=\"checkbox选中时的边框颜色\" type=\"text\"\r\n @confirm=\"confirm_activeBorderColor_input\"></input-data>\r\n <input-data defaultValue=\"#007aff\" title=\"iconColor: checkbox的图标颜色,优先级大于color属性\" type=\"text\"\r\n @confirm=\"confirm_iconColor_input\"></input-data>\r\n <input-data defaultValue=\"#ff0000\" title=\"foreColor: checkbox的图标颜色,优先级大于color属性\" type=\"text\"\r\n @confirm=\"confirm_foreColor_input\"></input-data>\r\n </view>\r\n\r\n <view>\r\n <page-head title=\"默认及使用\"></page-head>\r\n <view class=\"uni-padding-wrap uni-common-mt\">\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 <checkbox-group class=\"uni-flex uni-row checkbox-group\" @change=\"testChange\" style=\"flex-wrap: wrap\">\r\n <checkbox value=\"cb\" :checked=\"checked\" :color=\"color\" :iconColor=\"iconColor\" :foreColor=\"foreColor\"\r\n style=\"margin-right: 15px\" class=\"checkbox cb\">选中\r\n </checkbox>\r\n <checkbox value=\"cb1\" style=\"margin-right: 15px\" class=\"checkbox cb1\">{{ text }}</checkbox>\r\n <checkbox value=\"cb2\" :disabled=\"disabled\" class=\"checkbox cb2\">禁用</checkbox>\r\n <checkbox value=\"cb3\" style=\"margin-top: 10px\" class=\"checkbox cb3\">\r\n {{ wrapText }}\r\n </checkbox>\r\n </checkbox-group>\r\n </view>\r\n <view class=\"uni-title uni-common-mt\">\r\n <text class=\"uni-title-text\"> 不同颜色和尺寸的checkbox </text>\r\n </view>\r\n <view>\r\n <checkbox-group class=\"uni-flex uni-row checkbox-group\">\r\n <checkbox value=\"cb1\" :checked=\"true\" color=\"#FFCC33\" style=\"transform: scale(0.7); margin-right: 15px\"\r\n class=\"checkbox\">选中\r\n </checkbox>\r\n <checkbox value=\"cb\" color=\"#FFCC33\" style=\"transform: scale(0.7)\" class=\"checkbox\">未选中</checkbox>\r\n </checkbox-group>\r\n </view>\r\n </view>\r\n\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 <checkbox-group @change=\"checkboxChange\" class=\"checkbox-group\" id=\"trigger-change\">\r\n <checkbox class=\"uni-list-cell uni-list-cell-pd checkbox\" v-for=\"(item, index) in items\" :key=\"item.value\"\r\n :value=\"item.value\" :checked=\"item.checked\" :class=\"[\r\n index < items.length - 1 ? 'uni-list-cell-line' : '',\r\n 'checkbox-item-' + index,\r\n ]\">\r\n {{ item.name }}\r\n </checkbox>\r\n </checkbox-group>\r\n </view>\r\n </view>\r\n </scroll-view>\r\n</template>\r\n\r\n<style>\r\n .main {\r\n max-height: 250px;\r\n padding: 5px 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n .main .list-item {\r\n width: 100%;\r\n height: 100px;\r\n border: 1px solid #666;\r\n }\r\n\r\n .uni-list-cell {\r\n justify-content: flex-start;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n type ItemType = {\r\n value : string\r\n name : string\r\n checked : boolean\r\n }\r\n export default {\r\n data() {\r\n return {\r\n items: [\r\n {\r\n value: 'CHN',\r\n name: '中国',\r\n checked: true,\r\n },\r\n {\r\n value: 'USA',\r\n name: '美国',\r\n checked: false,\r\n },\r\n {\r\n value: 'BRA',\r\n name: '巴西',\r\n checked: false,\r\n },\r\n {\r\n value: 'JPN',\r\n name: '日本',\r\n checked: false,\r\n },\r\n {\r\n value: 'ENG',\r\n name: '英国',\r\n checked: false,\r\n },\r\n {\r\n value: 'FRA',\r\n name: '法国',\r\n checked: false,\r\n },\r\n ] as ItemType[],\r\n testEvent: false,\r\n text: '未选中',\r\n wrapText: 'uni-app x,终极跨平台方案\\nuts,大一统语言',\r\n value: [] as string[],\r\n disabled: true,\r\n checked: true,\r\n color: '#007aff',\r\n iconColor: '#211cfe',\r\n foreColor: '#ff0000',\r\n // 组件属性 autotest\r\n checked_boolean: false,\r\n disabled_boolean: false,\r\n color_input: \"#007aff\",\r\n backgroundColor_input: \"#ffffff\",\r\n borderColor_input: \"#d1d1d1\",\r\n activeBackgroundColor_input: \"#ffffff\",\r\n activeBorderColor_input: \"#d1d1d1\",\r\n iconColor_input: \"#007aff\",\r\n foreColor_input: '#ff0000'\r\n }\r\n },\r\n methods: {\r\n\r\n checkboxChange: function (e : UniCheckboxGroupChangeEvent) {\r\n // 自动化测试\r\n if ((e.target?.tagName ?? '') == 'CHECKBOX-GROUP' && e.type === 'change') {\r\n this.testEvent = true\r\n }\r\n\r\n const selectedNames : string[] = []\r\n this.items.forEach((item) => {\r\n if (e.detail.value.includes(item.value)) {\r\n selectedNames.push(item.name)\r\n }\r\n })\r\n uni.showToast({\r\n icon: 'none',\r\n title: '当前选中:' + selectedNames.join(','),\r\n })\r\n },\r\n testChange: function (e : UniCheckboxGroupChangeEvent) {\r\n this.value = e.detail.value\r\n },\r\n checkbox_click() { console.log(\"组件被点击时触发\") },\r\n checkbox_touchstart() { console.log(\"手指触摸动作开始\") },\r\n checkbox_touchmove() { console.log(\"手指触摸后移动\") },\r\n checkbox_touchcancel() { console.log(\"手指触摸动作被打断,如来电提醒,弹窗\") },\r\n checkbox_touchend() { console.log(\"手指触摸动作结束\") },\r\n checkbox_tap() { console.log(\"手指触摸后马上离开\") },\r\n checkbox_longpress() { console.log(\"如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\") },\r\n change_checked_boolean(checked : boolean) { this.checked_boolean = checked },\r\n change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },\r\n confirm_color_input(value : string) { this.color_input = value },\r\n confirm_backgroundColor_input(value : string) { this.backgroundColor_input = value },\r\n confirm_borderColor_input(value : string) { this.borderColor_input = value },\r\n confirm_activeBackgroundColor_input(value : string) { this.activeBackgroundColor_input = value },\r\n confirm_activeBorderColor_input(value : string) { this.activeBorderColor_input = value },\r\n confirm_iconColor_input(value : string) { this.iconColor_input = value },\r\n confirm_foreColor_input(value : string) { this.foreColor_input = value }\r\n }\r\n }\r\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.checkbox.checkbox)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/checkbox.html#checkbox)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=checkbox&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=checkbox&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=checkbox&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=checkbox&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=checkbox&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=checkbox)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=checkbox&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)\n"},"checkbox-group":{"name":"## checkbox-group","description":"> 组件类型:UniCheckboxGroupElement \n\n 多选框组","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| @change | (event: [UniCheckboxGroupChangeEvent](#unicheckboxgroupchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checkbox-group中选中项发生改变是触发 change 事件,detail = {value:\\[选中的checkbox的value的数组] |","event":"\n### 事件\n#### UniCheckboxGroupChangeEvent\n\n##### UniCheckboxGroupChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniCheckboxGroupChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | Array\\<string\\> | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniCheckboxGroupChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"","children":"### 子组件 @children-tags \n - [checkbox](checkbox.md)","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.checkbox.checkbox-group)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/checkbox.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=checkbox-group&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=checkbox-group&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=checkbox-group&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=checkbox-group&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=checkbox-group&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=checkbox-group)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=checkbox-group&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)\n"},"form":{"name":"## form","description":"> 组件类型:UniFormElement \n\n 表单","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.97 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| disabled | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 是否禁用 |\n| @submit | (event: [UniFormSubmitEvent](#uniformsubmitevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 携带 form 中的数据触发 submit 事件,event.detail = {value : {'name': 'value'}} |\n| @reset | (event: [UniFormResetEvent](#uniformresetevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.97\",\"4.11\"]]}' /> | 表单重置时会触发 reset 事件 |","event":"\n### 事件\n#### UniFormSubmitEvent\n\n##### UniFormSubmitEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniFormSubmitEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | UTSJSONObject | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniFormSubmitEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniFormResetEvent\n\n##### UniFormResetEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | UniFormResetEventDetail | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniFormResetEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/form/form.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/form/form\n>Template\n```vue\n<template>\n <!-- #ifdef APP -->\n <scroll-view class=\"scroll-view\">\n <!-- #endif -->\n <view class=\"page\">\n <form @submit=\"onFormSubmit\" @reset=\"onFormReset\">\n <view class=\"uni-form-item\">\n <view class=\"title\">姓名</view>\n <input class=\"uni-input\" name=\"nickname\" :value=\"nickname\" placeholder=\"请输入姓名\" maxlength=\"-1\"/>\n </view>\n <view class=\"uni-form-item\">\n <view class=\"title\">性别</view>\n <radio-group name=\"gender\" class=\"flex-row\">\n <view class=\"group-item\">\n <radio value=\"0\" :checked=\"gender=='0'\" /><text>男</text>\n </view>\n <view class=\"group-item\">\n <radio value=\"1\" :checked=\"gender=='1'\" /><text>女</text>\n </view>\n </radio-group>\n </view>\n <view class=\"uni-form-item\">\n <view class=\"title\">爱好</view>\n <checkbox-group name=\"loves\" class=\"flex-row\">\n <view class=\"group-item\">\n <checkbox value=\"0\" :checked=\"loves.indexOf('0')>-1\" /><text>读书</text>\n </view>\n <view class=\"group-item\">\n <checkbox value=\"1\" :checked=\"loves.indexOf('1')>-1\" /><text>写字</text>\n </view>\n </checkbox-group>\n </view>\n <view class=\"uni-form-item\">\n <view class=\"title\">年龄</view>\n <slider name=\"age\" :value=\"age\" :show-value=\"true\"></slider>\n </view>\n <view class=\"uni-form-item\">\n <view class=\"title\">保留选项</view>\n <view>\n <switch name=\"switch\" :checked=\"switch\" />\n </view>\n </view>\n <view class=\"uni-form-item\">\n <view class=\"title\">备注</view>\n <textarea name=\"comment\" :value=\"comment\" placeholder=\"请输入备注\" style=\"background: #FFF;\"/>\n <!-- <textarea class=\"uni-input\" name=\"comment\" :value=\"comment\" placeholder=\"这个class的写法,导致iOS和Android产生了高度差异\"/> -->\n </view>\n <view class=\"uni-btn-v flex-row\">\n <button class=\"btn btn-submit\" form-type=\"submit\" type=\"primary\">Submit</button>\n <button class=\"btn btn-reset\" type=\"default\" form-type=\"reset\">Reset</button>\n </view>\n </form>\n <view class=\"result\">提交的表单数据</view>\n <textarea class=\"textarea\" :value=\"formDataText\" :maxlength=\"-1\" :auto-height=\"true\"></textarea>\n </view>\n <!-- #ifdef APP -->\n </scroll-view>\n <!-- #endif -->\n</template>\n\n\n\n<style>\n .scroll-view {\n flex: 1;\n }\n\n .page {\n padding: 15px;\n }\n\n .flex-row {\n flex-direction: row;\n }\n\n .uni-form-item {\n padding: 15px 0;\n }\n\n .title {\n margin-bottom: 10px;\n }\n\n .group-item {\n flex-direction: row;\n margin-right: 20px;\n }\n\n .btn {\n flex: 1;\n }\n\n .btn-submit {\n margin-right: 5px;\n }\n\n .btn-reset {\n margin-left: 5px;\n }\n\n .result {\n margin-top: 30px;\n }\n\n .textarea {\n margin-top: 5px;\n padding: 5px;\n background-color: #fff;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n nickname: '',\n gender: '0',\n age: 18,\n loves: ['0'],\n switch: true,\n comment:'',\n formData: {} as UTSJSONObject,\n // 仅测试\n testVerifySubmit: false,\n testVerifyReset: false,\n }\n },\n computed: {\n formDataText() : string {\n return JSON.stringify(this.formData)\n }\n },\n methods: {\n onFormSubmit: function (e : UniFormSubmitEvent) {\n this.formData = e.detail.value\n\n // 仅测试\n this.testVerifySubmit = (e.type == 'submit' && (e.target?.tagName ?? '') == \"FORM\")\n },\n onFormReset: function (e : UniFormResetEvent) {\n this.formData = {}\n\n // 仅测试\n this.testVerifyReset = (e.type == 'reset' && (e.target?.tagName ?? '') == \"FORM\")\n }\n }\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.form)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/form.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=form&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=form&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=form&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=form&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=form&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=form)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=form&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)\n"},"input":{"name":"## input","description":"> 组件类型:[UniInputElement](#uniinputelement) \n\n 输入框","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| disabled | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否禁用 |\n| value | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框的初始内容 |\n| type | text \\| number \\| digit \\| tel | \"text\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | input的类型 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| text | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 文本输入键盘 |\n@| number | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 数字输入键盘 |\n@| digit | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 带小数点数字输入键盘 |\n@| tel | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 电话输入键盘 |\n| password | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否是密码类型 |\n| placeholder | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框为空时占位符 |\n| placeholder-style | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定 placeholder 的样式 |\n| placeholder-class | string([string.ClassString](/uts/data-type.md#ide-string)) | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight |\n| maxlength | number | \"不限制长度\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 最大输入长度,0和正数为合法值,非法值的时候不限制最大长度 |\n| cursor-spacing | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 指定光标与键盘的距离,单位 px 。取 input 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 |\n| cursor-color | string([string.ColorString](/uts/data-type.md#ide-string)) | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.99\",\"4.11\"]]}' /> | 指定光标颜色 |\n| auto-focus | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 自动获取焦点,与`focus`属性对比,此属性只会首次生效。 |\n| focus | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 获取焦点 |\n| confirm-type | send \\| search \\| next \\| go \\| done | \"done\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设置键盘右下角按钮的文字,仅在 type为text 时生效。 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| send | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 发送 |\n@| search | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 搜索 |\n@| next | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 下一个 |\n@| go | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 前往 |\n@| done | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 完成 |\n| confirm-hold | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 点击键盘右下角按钮时是否保持键盘不收起 |\n| cursor | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定focus时的光标位置 |\n| selection-start | number | -1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 光标起始位置,自动聚集时有效,需与selection-end搭配使用 |\n| selection-end | number | -1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 光标结束位置,自动聚集时有效,需与selection-satrt搭配使用 |\n| adjust-position | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 键盘弹起时,是否自动上推页面 |\n| hold-keyboard | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"4.11\"]]}' /> | focus时,点击页面的时候不收起键盘 |\n| inputmode | none \\| text \\| decimal \\| numeric \\| tel \\| search \\| email \\| url | \"text\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是一个枚举属性,它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。在符合条件的高版本webview里,uni-app的 web 和 app-vue 平台中可使用本属性。 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| none | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 无虚拟键盘。在应用程序或者站点需要实现自己的键盘输入控件时很有用。 |\n@| text | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 使用用户本地区域设置的标准文本输入键盘。 |\n@| decimal | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 小数输入键盘,包含数字和分隔符(通常是“ . ”或者“ , ”),设备可能也可能不显示减号键。 |\n@| numeric | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 数字输入键盘,所需要的就是 0 到 9 的数字,设备可能也可能不显示减号键。 |\n@| tel | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 电话输入键盘,包含 0 到 9 的数字、星号(*)和井号(#)键。表单输入里面的电话输入通常应该使用 \\<input type=\"tel\"\\> 。 |\n@| search | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 为搜索输入优化的虚拟键盘,比如,返回键可能被重新标记为“搜索”,也可能还有其他的优化。 |\n@| email | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 为邮件地址输入优化的虚拟键盘,通常包含\"@\"符号和其他优化。表单里面的邮件地址输入应该使用 \\<input type=\"email\"\\> 。 |\n@| url | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 为网址输入优化的虚拟键盘,比如,“/”键会更加明显、历史记录访问等。表单里面的网址输入通常应该使用 \\<input type=\"url\"\\> 。 |\n| @input | (event: [UniInputEvent](#uniinputevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当键盘输入时,触发input事件,event.detail = {value, cursor},处理函数可以直接 return 一个字符串,将替换输入框的内容。 |\n| @focus | (event: [UniInputFocusEvent](#uniinputfocusevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度 |\n| @blur | (event: [UniInputBlurEvent](#uniinputblurevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框失去焦点时触发,event.detail = {value: value} |\n| @keyboardheightchange | (event: [UniInputKeyboardHeightChangeEvent](#uniinputkeyboardheightchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration} |\n| @confirm | (event: [UniInputConfirmEvent](#uniinputconfirmevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 点击完成按钮时触发,event.detail = {value: value} |","event":"\n### 事件\n#### UniInputEvent\n\n##### UniInputEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | 输入框内容 |\n@| cursor | number | 是 | - | - | 光标的位置 |\n@| keyCode | number | 是 | - | - | 输入字符的Unicode值 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniInputFocusEvent\n\n##### UniInputFocusEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputFocusEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| height | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 键盘高度 |\n@| value | string | 是 | - | - | 输入框内容 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputFocusEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniInputBlurEvent\n\n##### UniInputBlurEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputBlurEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | 输入框内容 |\n@| cursor | number | 是 | - | - | 选择区域的起始位置 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputBlurEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniInputKeyboardHeightChangeEvent\n\n##### UniInputKeyboardHeightChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputKeyboardHeightChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| height | number | 是 | - | - | 键盘高度 |\n@| duration | number | 是 | - | - | 持续时间 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputKeyboardHeightChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniInputConfirmEvent\n\n##### UniInputConfirmEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputConfirmEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | 输入框内容 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputConfirmEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/input/input.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/input/input\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-common-mt uni-padding-wrap\">\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">设置输入框的初始内容</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-default\" class=\"uni-input\" value=\"hello uni-app x\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">type取值(不同输入法表现可能不一致)</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-type-text\" class=\"uni-input\" type=\"text\" placeholder=\"文本输入键盘\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-type-number\" class=\"uni-input\" type=\"number\" placeholder=\"数字输入键盘\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-type-digit\" class=\"uni-input\" type=\"digit\" placeholder=\"带小数点的数字输入键盘\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-type-tel\" class=\"uni-input\" :type=\"inputTypeTel\" placeholder=\"电话输入键盘\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">密码输入框</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-password\" class=\"uni-input\" :password=\"inputPassword\" :value=\"inputPasswordValue\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">无value设置的密码输入框</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :password=\"true\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">占位符样式</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-placeholder1\" class=\"uni-input\" :placeholder-style=\"inputPlaceHolderStyle\"\r\n placeholder=\"占位符文字颜色为红色\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-placeholder2\" class=\"uni-input\" :placeholder-class=\"inputPlaceHolderClass\"\r\n placeholder=\"占位符字体大小为10px\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :placeholder-style=\"inputPlaceHolderStyle\"\r\n value=\"不设置placeholder只设置placeholder-style\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">设置禁用输入框</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-disable\" class=\"uni-input\" :disabled=\"true\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">设置最大输入长度</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-maxlength\" class=\"uni-input\" :maxlength=\"10\" placeholder=\"最大输入长度为10\"\r\n :value=\"inputMaxLengthValue\" @input=\"onMaxLengthInput\" :focus=\"inputMaxLengthFocus\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">设置光标与键盘的距离</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :cursor-spacing=\"1000\" placeholder=\"光标与键盘的距离为1000px\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">自动获取焦点</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-focus\" class=\"uni-input\" :focus=\"focus\"\r\n @keyboardheightchange=\"inputFocusKeyBoardChange\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">confirm-type取值(不同输入法表现可能不一致)</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-confirm-send\" class=\"uni-input\" confirmType=\"send\" placeholder=\"键盘右下角按钮显示为发送\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-confirm-search\" class=\"uni-input\" confirmType=\"search\" placeholder=\"键盘右下角按钮显示为搜索\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-confirm-next\" class=\"uni-input\" confirmType=\"next\" placeholder=\"键盘右下角按钮显示为下一个\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-confirm-go\" class=\"uni-input\" confirmType=\"go\" placeholder=\"键盘右下角按钮显示为前往\" />\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-confirm-done\" class=\"uni-input\" confirmType=\"done\" placeholder=\"键盘右下角按钮显示为完成\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">点击键盘右下角按钮时保持键盘不收起</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :confirm-hold=\"true\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\" @click=\"setCursor(4)\">\r\n <text class=\"uni-title-text\">设置输入框聚焦时光标的位置(点击生效)</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input ref=\"input\" class=\"uni-input\" value=\"0123456789\" :cursor=\"cursor\" @blur=\"onCursorBlurChange\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\" @click=\"setSelection(0, 4)\">\r\n <text class=\"uni-title-text\">设置输入框聚焦时光标的起始位置和结束位置(点击生效)</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input ref=\"input2\" class=\"uni-input\" value=\"0123456789\" :selection-start=\"selectionStart\"\r\n :selection-end=\"selectionEnd\" @blur=\"onSelectionBlurChange\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\" style=\"flex-direction: row; align-items: center\">\r\n <text class=\"uni-title-text\">设置光标颜色为红色</text>\r\n <switch style=\"margin-left: 10px\" @change=\"changeCursorColor\" :checked=\"cursor_color == 'red'\"></switch>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"uni-input-cursor-color\" class=\"uni-input\" :cursor-color=\"cursor_color\" value=\"光标颜色\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">键盘弹起时,自动上推页面</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :adjust-position=\"true\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\" style=\"flex-direction: row; align-items: center\">\r\n <text class=\"uni-title-text\">设置hold-keyboard</text>\r\n <switch style=\"margin-left: 10px\" @change=\"changeHoldKeyboard\" :checked=\"holdKeyboard\"></switch>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :hold-keyboard=\"holdKeyboard\" value=\"hold keyboard \" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">input事件</text>\r\n <text class=\"uni-subtitle-text\" v-if=\"inputEventDetail\">{{\r\n inputEventDetail\r\n }}</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" @input=\"onInput\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">focus事件和blur事件</text>\r\n <text class=\"uni-subtitle-text\" v-if=\"focusAndBlurEventDetail\">{{\r\n focusAndBlurEventDetail\r\n }}</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" @focus=\"onFocus\" @blur=\"onBlur\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">confirm事件</text>\r\n <text class=\"uni-subtitle-text\" v-if=\"confirmEventDetail\">{{\r\n confirmEventDetail\r\n }}</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" @confirm=\"onConfirm\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">keyboardheightchange事件</text>\r\n <text class=\"uni-subtitle-text\"\r\n v-if=\"keyboardHeightChangeEventDetail\">{{ keyboardHeightChangeEventDetail }}</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" @keyboardheightchange=\"onKeyborardHeightChange\"\r\n :focus=\"focusedForKeyboardHeightChangeTest\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">带清除按钮的输入框</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" placeholder=\"带清除按钮的输入框\" :value=\"inputClearValue\" @input=\"clearInput\" />\r\n <image class=\"uni-icon\" src=\"/static/icons/clear.png\" v-if=\"showClearIcon\" @click=\"clearIcon\">\r\n </image>\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">可查看密码的输入框</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" placeholder=\"请输入密码\" :password=\"showPassword\" />\r\n <image class=\"uni-icon\" :src=\"\r\n !showPassword\r\n ? '/static/icons/eye-active.png'\r\n : '/static/icons/eye.png'\r\n \" @click=\"changePassword\"></image>\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\">\r\n <text class=\"uni-title-text\">同时存在 v-model 和 value</text>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input id=\"both-model-value\" class=\"uni-input\" v-model=\"demoValue\" value=\"456\" />\r\n </view>\r\n </view>\r\n\r\n <view>\r\n <view class=\"uni-title\" style=\"flex-direction: row; align-items: center\">\r\n <text class=\"uni-title-text\">设置adjust-position</text>\r\n <switch style=\"margin-left: 10px\" @change=\"changeAdjustPosition\" :checked=\"adjustPosition\"></switch>\r\n </view>\r\n <view class=\"input-wrapper\">\r\n <input class=\"uni-input\" :adjust-position=\"adjustPosition\" />\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 scoped>\r\n .input-wrapper {\r\n display: flex;\r\n padding: 8px 13px;\r\n margin: 5px 0;\r\n flex-direction: row;\r\n flex-wrap: nowrap;\r\n background-color: #ffffff;\r\n }\r\n\r\n .uni-input {\r\n height: 28px;\r\n font-size: 15px;\r\n padding: 0px;\r\n flex: 1;\r\n background-color: #ffffff;\r\n }\r\n\r\n .uni-icon {\r\n width: 24px;\r\n height: 24px;\r\n }\r\n\r\n .uni-input-placeholder-class {\r\n font-size: 10px;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'input',\r\n showClearIcon: false,\r\n inputClearValue: '',\r\n showPassword: true,\r\n cursor: -1,\r\n cursor_color: \"#3393E2\",\r\n selectionStart: -1,\r\n selectionEnd: -1,\r\n inputEventDetail: '',\r\n focusAndBlurEventDetail: '',\r\n confirmEventDetail: '',\r\n keyboardHeightChangeEventDetail: '',\r\n focus: true,\r\n inputPassword: true,\r\n inputTypeTel: \"tel\",\r\n inputPlaceHolderStyle: \"color:red\",\r\n inputPlaceHolderClass: \"uni-input-placeholder-class\" as string.ClassString,\r\n inputMaxLengthValue: \"\",\r\n onMaxLengthInputValue: \"\",\r\n inputMaxLengthFocus: false,\r\n inputPasswordValue: \"cipher\",\r\n inputFocusKeyBoardChangeValue: true,\r\n holdKeyboard: false,\r\n keyboardHeight: 0,\r\n focusedForKeyboardHeightChangeTest: false,\r\n demoValue: '123',\r\n adjustPosition: false\r\n }\r\n },\r\n methods: {\r\n inputFocusKeyBoardChange(e : UniInputKeyboardHeightChangeEvent) {\r\n this.inputFocusKeyBoardChangeValue = e.detail.height > 50\r\n },\r\n onMaxLengthInput(event : UniInputEvent) {\r\n this.onMaxLengthInputValue = event.detail.value\r\n },\r\n setCursor: function (cursor : number) {\r\n (this.$refs['input'] as UniInputElement).focus();\r\n this.cursor = cursor;\r\n },\r\n onCursorBlurChange() {\r\n this.cursor = 0\r\n },\r\n setSelection: function (selectionStart : number, selectionEnd : number) {\r\n (this.$refs['input2'] as UniInputElement).focus();\r\n this.selectionStart = selectionStart;\r\n this.selectionEnd = selectionEnd;\r\n },\r\n onSelectionBlurChange() {\r\n this.selectionEnd = 0;\r\n },\r\n clearInput: function (event : UniInputEvent) {\r\n this.inputClearValue = event.detail.value\r\n if (event.detail.value.length > 0) {\r\n this.showClearIcon = true\r\n } else {\r\n this.showClearIcon = false\r\n }\r\n },\r\n clearIcon: function () {\r\n this.inputClearValue = ''\r\n this.showClearIcon = false\r\n },\r\n changePassword: function () {\r\n this.showPassword = !this.showPassword\r\n },\r\n onInput: function (event : UniInputEvent) {\r\n console.log(\"键盘输入\", JSON.stringify(event.detail));\r\n this.inputEventDetail = JSON.stringify(event.detail)\r\n },\r\n onFocus: function (event : UniInputFocusEvent) {\r\n console.log(\"输入框聚焦\", JSON.stringify(event.detail));\r\n this.focusAndBlurEventDetail = JSON.stringify(event.detail);\r\n },\r\n onBlur: function (event : UniInputBlurEvent) {\r\n console.log(\"输入框失去焦点\", JSON.stringify(event.detail));\r\n this.focusAndBlurEventDetail = JSON.stringify(event.detail);\r\n },\r\n onConfirm: function (event : UniInputConfirmEvent) {\r\n console.log(\"点击完成按钮\", JSON.stringify(event.detail));\r\n this.confirmEventDetail = JSON.stringify(event.detail);\r\n },\r\n onKeyborardHeightChange: function (event : UniInputKeyboardHeightChangeEvent) {\r\n console.log(\"键盘高度发生变化\", JSON.stringify(event.detail));\r\n this.keyboardHeightChangeEventDetail = JSON.stringify(event.detail);\r\n this.keyboardHeight = event.detail.height;\r\n },\r\n test_check_input_value() : number {\r\n return this.onMaxLengthInputValue.length\r\n },\r\n changeCursorColor(event : UniSwitchChangeEvent) {\r\n const checked = event.detail.value;\r\n if (checked) {\r\n this.cursor_color = \"red\"\r\n } else {\r\n this.cursor_color = \"#3393E2\"\r\n }\r\n const input = uni.getElementById<UniInputElement>(\"uni-input-cursor-color\")\r\n input?.focus()\r\n },\r\n changeHoldKeyboard(event : UniSwitchChangeEvent) {\r\n const checked = event.detail.value;\r\n this.holdKeyboard = checked\r\n },\r\n changeAdjustPosition(event : UniSwitchChangeEvent) {\r\n const checked = event.detail.value;\r\n this.adjustPosition = checked\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.input)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/input.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=input&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=input&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=input&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=input&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=input&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=input)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=input&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)\n","component_type":"### UniInputElement\ninput元素对象\n#### UniInputElement 的属性值\n| 名称 | 类型 | 必填 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| type | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | input的类型 |\n| disabled | boolean | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 是否禁用 |\n| autofocus | boolean | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 自动获取焦点 |\n| value | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 输入框的初始内容 |"},"editor":{"name":"## editor","description":"富文本编辑器,可以对图片、文字进行编辑。","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| read-only | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 设置编辑器为只读。 |\n| placeholder | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 提示信息。 |\n| show-img-size | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击图片时显示图片大小控件。 |\n| show-img-toolbar | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击图片时显示工具栏控件。 |\n| show-img-resize | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击图片时显示修改尺寸控件。 |\n| @ready | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 编辑器初始化完成时触发 |\n| @focus | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 编辑器聚焦时触发,event.detail = {html, text, delta} |\n| @blur | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 编辑器失去焦点时触发,detail = {html, text, delta} |\n| @input | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 编辑器内容改变时触发,detail = {html, text, delta} |\n| @statuschange | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 通过 Context 方法改变编辑器内样式时触发,返回选区已设置的样式 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/editor/editor.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/editor/editor\n>Template\n```vue\n<template>\n\t<view class=\"container\">\n\t\t<view class=\"page-body\">\n\t\t\t<view class='wrapper'>\n\t\t\t\t<view class='toolbar' @tap=\"format\">\n\t\t\t\t\t<view :class=\"formats.bold ? 'ql-active' : ''\" class=\"iconfont icon-zitijiacu\"\n data-name=\"bold\"></view>\n\t\t\t\t\t<view :class=\"formats.italic ? 'ql-active' : ''\" class=\"iconfont icon-zitixieti\"\n data-name=\"italic\"></view>\n\t\t\t\t\t<view :class=\"formats.underline ? 'ql-active' : ''\" class=\"iconfont icon-zitixiahuaxian\"\n\t\t\t\t\t\tdata-name=\"underline\"></view>\n\t\t\t\t\t<view :class=\"formats.strike ? 'ql-active' : ''\" class=\"iconfont icon-zitishanchuxian\"\n\t\t\t\t\t\tdata-name=\"strike\"></view>\n\n\t\t\t\t\t<view :class=\"formats.align === 'left' ? 'ql-active' : ''\" class=\"iconfont icon-zuoduiqi\"\n\t\t\t\t\t\tdata-name=\"align\" data-value=\"left\"></view>\n\n\t\t\t\t\t<view :class=\"formats.align === 'center' ? 'ql-active' : ''\" class=\"iconfont icon-juzhongduiqi\"\n\t\t\t\t\t\tdata-name=\"align\" data-value=\"center\"></view>\n\t\t\t\t\t<view :class=\"formats.align === 'right' ? 'ql-active' : ''\" class=\"iconfont icon-youduiqi\"\n\t\t\t\t\t\tdata-name=\"align\" data-value=\"right\"></view>\n\t\t\t\t\t<view :class=\"formats.align === 'justify' ? 'ql-active' : ''\" class=\"iconfont icon-zuoyouduiqi\"\n\t\t\t\t\t\tdata-name=\"align\" data-value=\"justify\"></view>\n\n\t\t\t\t\t<view :class=\"formats.lineHeight ? 'ql-active' : ''\" class=\"iconfont icon-line-height\"\n\t\t\t\t\t\tdata-name=\"lineHeight\" data-value=\"2\"></view>\n\t\t\t\t\t<view :class=\"formats.letterSpacing ? 'ql-active' : ''\" class=\"iconfont icon-Character-Spacing\"\n\t\t\t\t\t\tdata-name=\"letterSpacing\" data-value=\"2em\"></view>\n\t\t\t\t\t<view :class=\"formats.marginTop ? 'ql-active' : ''\" class=\"iconfont icon-722bianjiqi_duanqianju\"\n\t\t\t\t\t\tdata-name=\"marginTop\" data-value=\"20px\"></view>\n\t\t\t\t\t<view :class=\"formats.marginBottom ? 'ql-active' : ''\" class=\"iconfont icon-723bianjiqi_duanhouju\"\n\t\t\t\t\t\tdata-name=\"marginBottom\" data-value=\"20px\"></view>\n\n\t\t\t\t\t<view :class=\"formats.fontFamily ? 'ql-active' : ''\" class=\"iconfont icon-font\"\n\t\t\t\t\t\tdata-name=\"fontFamily\" data-value=\"Pacifico\"></view>\n\t\t\t\t\t<view :class=\"formats.fontSize === '24px' ? 'ql-active' : ''\" class=\"iconfont icon-fontsize\"\n\t\t\t\t\t\tdata-name=\"fontSize\" data-value=\"24px\"></view>\n\t\t\t\t\t<view :class=\"formats.color === '#0000ff' ? 'ql-active' : ''\" class=\"iconfont icon-text_color\"\n\t\t\t\t\t\tdata-name=\"color\" data-value=\"#0000ff\"></view>\n\t\t\t\t\t<view :class=\"formats.backgroundColor === '#00ff00' ? 'ql-active' : ''\"\n\t\t\t\t\t\tclass=\"iconfont icon-fontbgcolor\" data-name=\"backgroundColor\" data-value=\"#00ff00\"></view>\n\n\t\t\t\t\t<view class=\"iconfont icon--checklist\" data-name=\"list\" data-value=\"check\"></view>\n\t\t\t\t\t<view :class=\"formats.list === 'ordered' ? 'ql-active' : ''\" class=\"iconfont icon-youxupailie\"\n\t\t\t\t\t\tdata-name=\"list\" data-value=\"ordered\"></view>\n\t\t\t\t\t<view :class=\"formats.list === 'bullet' ? 'ql-active' : ''\" class=\"iconfont icon-wuxupailie\"\n\t\t\t\t\t\tdata-name=\"list\" data-value=\"bullet\"></view>\n\n\n\t\t\t\t\t<view class=\"iconfont icon-outdent\" data-name=\"indent\" data-value=\"-1\"></view>\n\t\t\t\t\t<view class=\"iconfont icon-indent\" data-name=\"indent\" data-value=\"+1\"></view>\n\n\n\t\t\t\t\t<view :class=\"formats.header === 1 ? 'ql-active' : ''\" class=\"iconfont icon-format-header-1\"\n\t\t\t\t\t\tdata-name=\"header\" :data-value=\"1\"></view>\n\t\t\t\t\t<view :class=\"formats.script === 'sub' ? 'ql-active' : ''\" class=\"iconfont icon-zitixiabiao\"\n\t\t\t\t\t\tdata-name=\"script\" data-value=\"sub\"></view>\n\t\t\t\t\t<view :class=\"formats.script === 'super' ? 'ql-active' : ''\" class=\"iconfont icon-zitishangbiao\"\n\t\t\t\t\t\tdata-name=\"script\" data-value=\"super\"></view>\n\n\t\t\t\t\t<view :class=\"formats.direction === 'rtl' ? 'ql-active' : ''\" class=\"iconfont icon-direction-rtl\"\n\t\t\t\t\t\tdata-name=\"direction\" data-value=\"rtl\"></view>\n\n <view class=\"iconfont icon-date\" @tap=\"insertDate\"></view>\n <view class=\"iconfont icon-fengexian\" @tap=\"insertDivider\"></view>\n <view class=\"iconfont icon-charutupian\" @tap=\"chooseInsertImage\"></view>\n <view class=\"iconfont icon-clearedformat\" @tap=\"removeFormat\"></view>\n <view class=\"iconfont icon-undo\" @tap=\"undo\"></view>\n <view class=\"iconfont icon-redo\" @tap=\"redo\"></view>\n <view class=\"iconfont icon-shanchu\" @tap=\"clearShowModal\"></view>\n\t\t\t\t</view>\n\n\t\t\t\t<view class=\"editor-wrapper\">\n\t\t\t\t\t<editor id=\"editor\" class=\"ql-container\" placeholder=\"开始输入...\" show-img-size show-img-toolbar\n\t\t\t\t\t\tshow-img-resize @statuschange=\"onStatusChange\" :read-only=\"readOnly\" @ready=\"onEditorReady\">\n\t\t\t\t\t</editor>\n\t\t\t\t</view>\n\t\t\t\t<view>\n\t\t\t\t\t<button @tap=\"getCon\">打印文本内容</button>\n\t\t\t\t</view>\n\t\t\t</view>\n\t\t</view>\n\t</view>\n</template>\n\n\n\n<style>\n\t@import \"./editor-icon.css\";\n\n\t.page-body {\n\t\theight: calc(100vh - var(--window-top) - var(--status-bar-height));\n\t}\n\n\t.wrapper {\n\t\theight: 100%;\n\t}\n\n\t.editor-wrapper {\n\t\theight: calc(100vh - var(--window-top) - var(--status-bar-height) - 140px - 46px);\n\t\tbackground: #fff;\n\t}\n\n\t.iconfont {\n\t\tdisplay: inline-block;\n\t\twidth: 30px;\n\t\theight: 30px;\n\t\tcursor: pointer;\n\t\tfont-size: 20px;\n margin: 0px 6px;\n align-content: center;\n\t}\n\n\t.toolbar {\n\t\tbox-sizing: border-box;\n\t\tborder-bottom: 0;\n\t\tfont-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;\n flex-direction: row;\n flex-wrap: wrap;\n height: 140px;\n padding-left: 10px;\n\t}\n\n\t.ql-container {\n\t\tbox-sizing: border-box;\n\t\tpadding: 12px 15px;\n\t\twidth: 100%;\n\t\tmin-height: 30vh;\n\t\theight: 100%;\n\t\tfont-size: 16px;\n\t\tline-height: 1.5;\n\t}\n\n\t.ql-active {\n\t\tcolor: #06c;\n\t}\n</style>\n\n```\n>Script\n```uts\n\n type Context = {\n \tid?: string;\n \tpageId?: number;\n }\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\treadOnly: false,\n\t\t\t\tformats: {},\n editorCtx:{} as Context,\n // 自动化测试\n autoTest:false,\n undoTest:false,\n redoTest:false,\n removeFormatTest:false\n\t\t\t}\n\t\t},\n\t\tonLoad() {\n\t\t\tuni.loadFontFace({\n\t\t\t\tfamily: 'Pacifico',\n\t\t\t\tsource: 'url(\"/static/font/Pacifico-Regular.ttf\")',\n\t\t\t\tsuccess() {\n\t\t\t\t\tconsole.log('success load font')\n\t\t\t\t},\n\t\t\t\tfail() {\n\t\t\t\t\tconsole.log('fail load font load')\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\tmethods: {\n\t\t\treadOnlyChange() {\n\t\t\t\tthis.readOnly = !this.readOnly\n\t\t\t},\n\t\t\tonEditorReady() {\n\t\t\t\tuni.createSelectorQuery().select('#editor').context((res) => {\n\t\t\t\t\tthis.editorCtx = res.context\n\t\t\t\t}).exec()\n\t\t\t},\n // 自动化测试专用\n setContents(options) {\n \tthis.editorCtx.setContents({\n delta: {\n ops:options\n },\n success: (res) => {\n \tconsole.log('setContents-success', res)\n },\n fail: (err) => {\n \tconsole.log(err)\n }\n \t})\n },\n getCon() {\n \tthis.editorCtx.getContents({\n \t\tsuccess: (res) => {\n \t\t\tconsole.log('文本详情:', res)\n \t\t},\n \t\tfail: (err) => {\n \t\t\tconsole.log(err)\n \t\t}\n \t})\n },\n\t\t\tundo() {\n\t\t\t\tthis.editorCtx.undo({\n \t\tsuccess: (res) => {\n this.undoTest = true\n \t\t},\n \t\tfail: (err) => {\n this.undoTest = false\n \t\t}\n \t})\n\t\t\t},\n\t\t\tredo() {\n\t\t\t\tthis.editorCtx.redo({\n \t\tsuccess: (res) => {\n this.redoTest = true\n \t\t},\n \t\tfail: (err) => {\n this.redoTest = false\n \t\t}\n \t})\n\t\t\t},\n\t\t\tformat(e) {\n\t\t\t\tlet {name,value} = e.target.dataset\n\t\t\t\tif (!name) return\n\t\t\t\t// console.log('format', name, value)\n\t\t\t\tthis.editorCtx.format(name, value)\n\t\t\t},\n\t\t\tonStatusChange(e) {\n\t\t\t\tconst formats = e.detail\n\t\t\t\tthis.formats = formats\n\t\t\t},\n\t\t\tinsertDivider() {\n\t\t\t\tthis.editorCtx.insertDivider({\n\t\t\t\t\tsuccess: function() {\n\t\t\t\t\t\tconsole.log('insert divider success')\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n clear() {\n this.editorCtx.clear({\n success: function(res) {\n console.log(\"clear success\")\n }\n })\n },\n\t\t\tclearShowModal() {\n uni.showModal({\n \ttitle: '清空编辑器',\n \tcontent: '确定清空编辑器全部内容?',\n \tsuccess: res => {\n \t\tif (res.confirm) {\n \t\t\tthis.clear()\n \t\t}\n \t}\n })\n\t\t\t},\n\t\t\tremoveFormat() {\n\t\t\t\tthis.editorCtx.removeFormat({\n \t\tsuccess: (res) => {\n \t\t\tconsole.log('removeFormat-success', res)\n this.removeFormatTest = true\n \t\t},\n \t\tfail: (err) => {\n this.removeFormatTest = false\n \t\t}\n \t})\n\t\t\t},\n\t\t\tinsertDate() {\n\t\t\t\tconst date = new Date()\n\t\t\t\tconst formatDate = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`\n\t\t\t\tthis.editorCtx.insertText({\n\t\t\t\t\ttext: formatDate\n\t\t\t\t})\n\t\t\t},\n insertImage(image){\n this.editorCtx.insertImage({\n src:image,\n alt: '图像',\n success: function() {\n console.log('insert image success')\n }\n })\n },\n\t\t\tchooseInsertImage() {\n uni.chooseImage({\n \tcount: 1,\n \tsuccess: (res) => {\n \t\tthis.insertImage(res.tempFilePaths[0])\n \t}\n })\n\t\t\t}\n\t\t}\n\t}\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.editor)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/editor.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=editor&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=editor&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=editor&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=editor&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=editor&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=editor)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=editor&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)\n"},"label":{"name":"## label","description":"用来改进表单组件的可用性,使用for属性找到对应的id,或者将控件放在该标签下,当点击时,就会触发对应的控件","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| disabled | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否禁用 |\n| for | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 绑定控件的 id |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/label/label.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/label/label\n>Template\n```vue\n<template>\n <view>\n <page-head :title=\"title\"></page-head>\n <view class=\"uni-common-mt\">\n <view class=\"uni-form-item uni-column\">\n <view class=\"title\">表单组件在label内</view>\n <checkbox-group class=\"uni-list\" @change=\"checkboxChange\">\n <label class=\"uni-list-cell uni-list-cell-pd checkboxItemsTest\" v-for=\"item in checkboxItems\" :key=\"item.name\">\n <view>\n <checkbox :value=\"item.name\" :checked=\"item.checked\"></checkbox>\n </view>\n <view>{{item.value}}</view>\n </label>\n </checkbox-group>\n </view>\n\n <view class=\"uni-form-item uni-column\">\n <view class=\"title\">label用for标识表单组件</view>\n <radio-group class=\"uni-list\" @change=\"radioChange\">\n <view class=\"uni-list-cell uni-list-cell-pd\" v-for=\"(item,index) in radioItems\" :key=\"index\">\n <view>\n <radio :id=\"item.name\" :value=\"item.name\" :checked=\"item.checked\"></radio>\n </view>\n <label class=\"label-2-text\" :for=\"item.name\">\n <text>{{item.value}}</text>\n </label>\n </view>\n </radio-group>\n </view>\n\n <view class=\"uni-form-item uni-column\">\n <view class=\"title\">label内有多个时选中第一个</view>\n <checkbox-group class=\"uni-list\" @change=\"checkboxChange\">\n <label class=\"label-3\">\n <view class=\"uni-list-cell uni-list-cell-pd\">\n <checkbox>选项一</checkbox>\n </view>\n <view class=\"uni-list-cell uni-list-cell-pd\">\n <checkbox>选项二</checkbox>\n </view>\n <view class=\"uni-link uni-center\" style=\"margin:20rpx 0;\">点击该label下的文字默认选中第一个checkbox</view>\n </label>\n </checkbox-group>\n </view>\n </view>\n </view>\n</template>\n\n\n<style>\n .uni-list-cell {\n justify-content: flex-start\n }\n\n .uni-list .label-3 {\n padding: 0;\n }\n\n .label-2-text {\n flex: 1;\n }\n .uni-form-item{\n \tdisplay:flex;\n \twidth:100%;\n \tpadding:10rpx 0;\n }\n .uni-form-item .title{\n \tpadding:10rpx 25rpx;\n }\n radio-group{\n \tpadding: 0 20rpx;\n }\n checkbox-group label{\n \tmargin: 0 20rpx;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'label',\n checkboxItems: [{\n name: 'USA',\n value: '美国'\n },\n {\n name: 'CHN',\n value: '中国',\n checked: 'true'\n }\n ],\n radioItems: [{\n name: 'USA',\n value: '美国'\n },\n {\n name: 'CHN',\n value: '中国',\n checked: 'true'\n }\n ],\n hidden: false,\n checkboxValue: [] as string[],\n radioValue:''\n }\n },\n methods: {\n checkboxChange: function (e : UniCheckboxGroupChangeEvent) {\n console.log(e.detail.value)\n this.checkboxValue = e.detail.value\n },\n radioChange: function (e : UniRadioGroupChangeEvent) {\n console.log(e.detail.value)\n this.radioValue = e.detail.value\n }\n }\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.label)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/label.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=label&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=label&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=label&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=label&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=label&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=label)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=label&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)\n"},"picker":{"name":"## picker","description":"从底部弹起的滚动选择器,现支持五种选择器,通过mode来区分,分别是普通选择器,多列选择器,时间选择器,日期选择器,省市区选择器,默认是普通选择器。","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| disabled | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 是否禁用 |\n| mode | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 选择器类型 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| selector | - | 普通选择器 |\n@| multiSelector | - | 多列选择器 |\n@| time | - | 时间选择器 |\n@| date | - | 日期选择器 |\n@| region | - | 省市选择器 |\n| range | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | mode为 selector 或 multiSelector 时,range 有效 |\n| range-key | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 当 range 是一个 Object Array 时,通过 range-key 来指定 Object 中 key 的值作为选择器显示内容 |\n| value | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | mode为select或multiSelector时:value 的值表示选择了 range 中的第几个(下标从 0 开始);mode为time时:表示选中的时间,格式为\"hh:mm\";mode为date时:表示选中的日期,格式为\"YYYY-MM-DD\";mode为region时: \t\t表示选中的省市区,默认选中每一列的第一个值。 |\n| start | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | mode为time:表示有效时间范围的开始,字符串格式为\"hh:mm\";mode为date:表示有效日期范围的开始,字符串格式为\"YYYY-MM-DD\" |\n| end | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | mode为time:表示有效时间范围的结束,字符串格式为\"hh:mm\";mode为date:表示有效日期范围的结束,字符串格式为\"YYYY-MM-DD\" |\n| fields | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 有效值 year,month,day,表示选择器的粒度 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| year | - | 选择器粒度为年 |\n@| month | - | 选择器粒度为月份 |\n@| day | - | 选择器粒度为天 |\n| custom-item | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 可为每一列的顶部添加一个自定义的项 |\n| @change | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | value 改变时触发 change 事件,event.detail = {value: value} |\n| @columnchange | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 某一列的值改变时触发 columnchange 事件,event.detail = {column: column, value: value},column 的值表示改变了第几列(下标从0开始),value 的值表示变更值的下标 |\n| @cancel | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 取消选择时触发 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/picker/picker.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/picker/picker\n>Template\n```vue\n<template>\n\t<view>\n\t\t<page-head :title=\"title\"></page-head>\n\t\t<view class=\"uni-title uni-common-pl\">普通选择器</view>\n\t\t<view class=\"uni-list\">\n\t\t\t<view class=\"uni-list-cell\">\n\t\t\t\t<view class=\"uni-list-cell-left\">\n\t\t\t\t\t当前选择\n\t\t\t\t</view>\n\t\t\t\t<view class=\"uni-list-cell-db\">\n\t\t\t\t\t<picker class=\"picker\" @change=\"bindPickerChange\" :value=\"index\" :range=\"array\" range-key=\"name\">\n\t\t\t\t\t\t<view class=\"uni-input pickerValue\">{{array[index].name}}</view>\n\t\t\t\t\t</picker>\n\t\t\t\t</view>\n\t\t\t</view>\n\t\t</view>\n\n\t\t<view class=\"uni-title uni-common-pl\">多列选择器</view>\n\t\t<view class=\"uni-list\">\n\t\t\t<view class=\"uni-list-cell\">\n\t\t\t\t<view class=\"uni-list-cell-left\">\n\t\t\t\t\t当前选择\n\t\t\t\t</view>\n\t\t\t\t<view class=\"uni-list-cell-db\">\n\t\t\t\t\t<picker class=\"pickerMulti\" mode=\"multiSelector\" @columnchange=\"bindMultiPickerColumnChange\" :value=\"multiIndex\" :range=\"multiArray\">\n\t\t\t\t\t\t<view class=\"uni-input pickerMultiValue\">{{multiArray[0][multiIndex[0]]}},{{multiArray[1][multiIndex[1]]}},{{multiArray[2][multiIndex[2]]}}</view>\n\t\t\t\t\t</picker>\n\t\t\t\t</view>\n\t\t\t</view>\n\t\t</view>\n\n\t\t<view class=\"uni-title uni-common-pl\">时间选择器</view>\n\t\t<view class=\"uni-list\">\n\t\t\t<view class=\"uni-list-cell\">\n\t\t\t\t<view class=\"uni-list-cell-left\">\n\t\t\t\t\t当前选择\n\t\t\t\t</view>\n\t\t\t\t<view class=\"uni-list-cell-db\">\n\t\t\t\t\t<picker class=\"pickerTime\" mode=\"time\" :value=\"time\" start=\"09:01\" end=\"21:01\" @change=\"bindTimeChange\">\n\t\t\t\t\t\t<view class=\"uni-input\">{{time}}</view>\n\t\t\t\t\t</picker>\n\t\t\t\t</view>\n\t\t\t</view>\n\t\t</view>\n\t\t<view class=\"uni-picker-tips\">\n\t\t\t注:选择 09:01 ~ 21:01 之间的时间, 不在区间内不能选中\n\t\t</view>\n\n\t\t<view class=\"uni-title uni-common-pl\">日期选择器</view>\n\t\t<view class=\"uni-list\">\n\t\t\t<view class=\"uni-list-cell\">\n\t\t\t\t<view class=\"uni-list-cell-left\">\n\t\t\t\t\t当前选择\n\t\t\t\t</view>\n\t\t\t\t<view class=\"uni-list-cell-db\">\n\t\t\t\t\t<picker class=\"pickerDate\" mode=\"date\" :value=\"date\" :start=\"startDate\" :end=\"endDate\" @change=\"bindDateChange\">\n\t\t\t\t\t\t<view class=\"uni-input\">{{date}}</view>\n\t\t\t\t\t</picker>\n\t\t\t\t</view>\n\t\t\t</view>\n\t\t</view>\n\t\t<view class=\"uni-picker-tips\">\n\t\t\t注:选择当前时间 ±10 年之间的时间, 不在区间内不能选中\n\t\t</view>\n\t</view>\n</template>\n\n\n<style>\n.uni-picker-tips {\n\tfont-size: 12px;\n\tcolor: #666;\n\tmargin-bottom: 15px;\n\tpadding: 0 15px;\n}\n</style>\n\n```\n>Script\n```uts\n\n\n\tfunction getDate(type?:string):string {\n\t\tconst date = new Date();\n\n\t\tlet year:string | number = date.getFullYear();\n\t\tlet month:string | number = date.getMonth() + 1;\n\t\tlet day:string | number = date.getDate();\n\n\t\tif (type === 'start') {\n\t\t\tyear = year - 10;\n\t\t} else if (type === 'end') {\n\t\t\tyear = year + 10;\n\t\t}\n\t\tmonth = month > 9 ? month : '0' + month;;\n\t\tday = day > 9 ? day : '0' + day;\n\n\t\treturn `${year}-${month}-${day}`;\n\t}\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\ttitle: 'picker',\n\t\t\t\tarray: [{name:'中国'},{name: '美国'}, {name:'巴西'}, {name:'日本'}],\n\t\t\t\tindex: 0,\n\t\t\t\tmultiArray: [\n\t\t\t\t\t['亚洲', '欧洲'],\n\t\t\t\t\t['中国', '日本'],\n\t\t\t\t\t['北京', '上海', '广州']\n\t\t\t\t],\n\t\t\t\tmultiIndex: [0, 0, 0],\n date:getDate(),\n\t\t\t\tstartDate:getDate('start'),\n\t\t\t\tendDate:getDate('end'),\n\t\t\t\ttime: '12:01'\n\t\t\t}\n\t\t},\n\t\tmethods: {\n\t\t\tbindPickerChange: function(e) {\n\t\t\t\tconsole.log('picker发送选择改变,携带值为:' + e.detail.value)\n\t\t\t\tthis.index = e.detail.value\n\t\t\t},\n\t\t\tbindMultiPickerColumnChange: function(e) {\n\t\t\t\tconsole.log('修改的列为:' + e.detail.column + ',值为:' + e.detail.value)\n\t\t\t\tthis.multiIndex[e.detail.column] = e.detail.value\n\t\t\t\tswitch (e.detail.column) {\n\t\t\t\t\tcase 0: //拖动第1列\n\t\t\t\t\t\tswitch (this.multiIndex[0]) {\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\tthis.multiArray[1] = ['中国', '日本']\n\t\t\t\t\t\t\t\tthis.multiArray[2] = ['北京', '上海', '广州']\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\tthis.multiArray[1] = ['英国', '法国']\n\t\t\t\t\t\t\t\tthis.multiArray[2] = ['伦敦', '曼彻斯特']\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.multiIndex.splice(1, 1, 0)\n\t\t\t\t\t\tthis.multiIndex.splice(2, 1, 0)\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 1: //拖动第2列\n\t\t\t\t\t\tswitch (this.multiIndex[0]) { //判断第一列是什么\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\tswitch (this.multiIndex[1]) {\n\t\t\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t\t\tthis.multiArray[2] = ['北京', '上海', '广州']\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t\t\tthis.multiArray[2] = ['东京','北海道']\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\tswitch (this.multiIndex[1]) {\n\t\t\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t\t\tthis.multiArray[2] = ['伦敦', '曼彻斯特']\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t\t\tthis.multiArray[2] = ['巴黎', '马赛']\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.multiIndex.splice(2, 1, 0)\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tthis.$forceUpdate()\n\t\t\t},\n\t\t\tbindDateChange: function(e) {\n\t\t\t\tthis.date = e.detail.value\n\t\t\t},\n\t\t\tbindTimeChange: function(e) {\n\t\t\t\tthis.time = e.detail.value\n\t\t\t}\n\t\t}\n\t}\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.picker)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/picker.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=picker&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=picker&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=picker&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=picker&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=picker&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=picker)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=picker&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)\n"},"picker-view-column":{"name":"## picker-view-column","description":"仅可放置于 picker-view 中,其子节点未继承 picker-view 的选中框的高度,需要自己设置高度并居中","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.picker-view.picker-view-column)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/picker-view.html#picker-view-column)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=picker-view-column&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=picker-view-column&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=picker-view-column&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=picker-view-column&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=picker-view-column&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=picker-view-column)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=picker-view-column&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)\n"},"picker-view":{"name":"## picker-view","description":"> 组件类型:UniPickerViewElement \n\n 嵌入页面的滚动选择器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| value | array\\<number> | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | picker-view-column 选择的第几项 |\n| indicator-style | string([string.CSSString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设置选择器中间选中框的样式 |\n| indicator-class | string([string.ClassString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 设置选择器中间选中框的类名 |\n| mask-style | string([string.CSSString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 设置蒙层的样式 |\n| mask-top-style | string([string.CSSString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设置蒙层上半部分的样式 |\n| mask-bottom-style | string([string.CSSString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 设置蒙层下半部分的样式 |\n| mask-class | string([string.ClassString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 设置蒙层的类名 |\n| @change | (event: [UniPickerViewChangeEvent](#unipickerviewchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当滚动选择,value 改变时触发 change 事件,event.detail = {value: value};value为数组,表示 picker-view 内的 picker-view-column 当前选择的是第几项(下标从 0 \t\t开始) |","event":"\n### 事件\n#### UniPickerViewChangeEvent\n\n##### UniPickerViewChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniPickerViewChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | Array\\<number\\> | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniPickerViewChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/picker-view/picker-view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/picker-view/picker-view\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\">\r\n 日期:{{year}}年{{month}}月{{day}}日\r\n </view>\r\n </view>\r\n <picker-view class=\"picker-view\" :indicator-style=\"indicatorStyle\" :value=\"value\" @change=\"bindChange\"\r\n :mask-top-style=\"maskTopStyle\" :mask-bottom-style=\"maskBottomStyle\">\r\n <picker-view-column class=\"picker-view-column\">\r\n <view class=\"item\" v-for=\"(item,index) in years\" :key=\"index\"><text class=\"text\">{{item}}年</text></view>\r\n </picker-view-column>\r\n <picker-view-column class=\"picker-view-column\">\r\n <view class=\"item\" v-for=\"(item,index) in months\" :key=\"index\"><text class=\"text\">{{item}}月</text>\r\n </view>\r\n </picker-view-column>\r\n <picker-view-column class=\"picker-view-column\">\r\n <view class=\"item\" v-for=\"(item,index) in days\" :key=\"index\"><text class=\"text\">{{item}}日</text></view>\r\n </picker-view-column>\r\n </picker-view>\r\n </view>\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n .picker-view {\r\n width: 100%;\r\n height: 320px;\r\n margin-top: 10px;\r\n }\r\n\r\n .item {\r\n height: 50px;\r\n }\r\n\r\n .text {\r\n line-height: 50px;\r\n text-align: center;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\n import { state, setEventCallbackNum } from '@/store/index.uts'\r\n export default {\r\n data() {\r\n const date = new Date()\r\n const _years : number[] = []\r\n const _year = date.getFullYear()\r\n const _months : number[] = []\r\n const _month : number = date.getMonth() + 1\r\n const _days : number[] = []\r\n const _day = date.getDate()\r\n for (let i = 2000; i <= _year; i++) {\r\n _years.push(i)\r\n }\r\n for (let i = 1; i <= 12; i++) {\r\n _months.push(i)\r\n }\r\n for (let i = 1; i <= 31; i++) {\r\n _days.push(i)\r\n }\r\n return {\r\n title: 'picker-view',\r\n years: _years as number[],\r\n year: _year as number,\r\n months: _months as number[],\r\n month: _month as number,\r\n days: _days as number[],\r\n day: _day as number,\r\n value: [_year - 2000, _month - 1, _day - 1] as number[],\r\n result: [] as number[],\r\n indicatorStyle: 'height: 50px;',\r\n maskTopStyle: '',\r\n maskBottomStyle: ''\r\n }\r\n },\r\n methods: {\n // 自动化测试\n getEventCallbackNum() : number {\n return state.eventCallbackNum\n },\n // 自动化测试\n setEventCallbackNum(num : number) {\n setEventCallbackNum(num)\n },\r\n bindChange(e : UniPickerViewChangeEvent) {\n // 自动化测试\n console.log(e.target?.tagName,e.type);\n if ((e.target?.tagName ?? '').includes('PICKER-VIEW')) {\n this.setEventCallbackNum(state.eventCallbackNum + 1)\n }\n if (e.type === 'change') {\n this.setEventCallbackNum(state.eventCallbackNum + 2)\n }\n\r\n const val = e.detail.value\r\n this.result = val\r\n this.year = this.years[val[0]]\r\n this.month = this.months[val[1]]\r\n this.day = this.days[val[2]]\r\n },\r\n setValue() {\r\n this.value = [0, 0, 0] as number[]\r\n },\r\n setValue1() {\r\n this.value = [10, 10, 10] as number[]\r\n },\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n - [picker-view-column](picker-view-column.md)","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.picker-view.picker-view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/picker-view.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=picker-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=picker-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=picker-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=picker-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=picker-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=picker-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=picker-view&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)\n"},"radio":{"name":"## radio","description":"> 组件类型:UniRadioElement \n\n 单选项。在1组radio-group中只能选中1个","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| disabled | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否禁用 |\n| value | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | \\<radio/> 标识。当该radio 选中时,radio-group的 change 事件会携带radio的value |\n| checked | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | \\<radio/> 当前是否选中 |\n| ~~color~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007AFF\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio的颜色 (使用foreColor替代) |\n| backgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#ffffff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio默认的背景颜色 |\n| borderColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#d1d1d1\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio默认的边框颜色 |\n| activeBackgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007AFF\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio选中时的背景颜色,优先级大于color属性 |\n| activeBorderColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio选中时的边框颜色 |\n| ~~iconColor~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#ffffff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio的图标颜色 (使用foreColor替代) |\n| foreColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#ffffff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | radio的图标颜色 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/radio/radio.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/radio/radio\n>Template\n```vue\n\r\n\r\n<template>\r\n <view class=\"main\">\r\n <radio :disabled=\"disabled_boolean\" :checked=\"checked_boolean\" :color=\"color_input\"\r\n :backgroundColor=\"backgroundColor_input\" :borderColor=\"borderColor_input\"\r\n :activeBackgroundColor=\"activeBackgroundColor_input\" :activeBorderColor=\"activeBorderColor_input\"\r\n :iconColor=\"iconColor_input\" @click=\"radio_click\" @touchstart=\"radio_touchstart\" @touchmove=\"radio_touchmove\"\r\n @touchcancel=\"radio_touchcancel\" @touchend=\"radio_touchend\" @tap=\"radio_tap\" @longpress=\"radio_longpress\">\r\n <text>uni-app-x</text>\r\n </radio>\r\n </view>\r\n\r\n <scroll-view style=\"flex: 1\">\r\n <view class=\"content\">\r\n <page-head title=\"组件属性\"></page-head>\r\n <boolean-data :defaultValue=\"false\" title=\"<radio/> 当前是否选中\" @change=\"change_checked_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"是否禁用\" @change=\"change_disabled_boolean\"></boolean-data>\r\n <input-data defaultValue=\"#007AFF\" title=\"radio的颜色\" type=\"text\" @confirm=\"confirm_color_input\"></input-data>\r\n <input-data defaultValue=\"#ffffff\" title=\"radio默认的背景颜色\" type=\"text\"\r\n @confirm=\"confirm_backgroundColor_input\"></input-data>\r\n <input-data defaultValue=\"#d1d1d1\" title=\"radio默认的边框颜色\" type=\"text\"\r\n @confirm=\"confirm_borderColor_input\"></input-data>\r\n <input-data defaultValue=\"#007AFF\" title=\"radio选中时的背景颜色,优先级大于color属性\" type=\"text\"\r\n @confirm=\"confirm_activeBackgroundColor_input\"></input-data>\r\n <input-data defaultValue=\"\" title=\"radio选中时的边框颜色\" type=\"text\"\r\n @confirm=\"confirm_activeBorderColor_input\"></input-data>\r\n <input-data defaultValue=\"#ffffff\" title=\"radio的图标颜色\" type=\"text\" @confirm=\"confirm_iconColor_input\"></input-data>\r\n </view>\r\n\r\n <view>\r\n <page-head title=\"默认及使用\"></page-head>\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 <radio-group class=\"uni-flex uni-row radio-group\" @change=\"testChange\" style=\"flex-wrap: wrap\">\r\n <radio id=\"trigger-change\" value=\"r\" :checked=\"checked\" :color=\"color\" style=\"margin-right: 15px\"\r\n class=\"radio r\">选中\r\n </radio>\r\n <radio value=\"r1\" style=\"margin-right: 15px\" class=\"radio r1\">{{\r\n text\r\n }}</radio>\r\n <radio value=\"r2\" :disabled=\"disabled\" class=\"radio r2\">禁用</radio>\r\n <radio value=\"r3\" class=\"radio r3\" style=\"margin-top: 10px\">{{\r\n wrapText\r\n }}</radio>\r\n </radio-group>\r\n </view>\r\n\r\n <view class=\"uni-padding-wrap\">\r\n <view class=\"uni-title uni-common-mt\">\r\n <text class=\"uni-title-text\"> 不同颜色和尺寸的radio </text>\r\n </view>\r\n <radio-group class=\"uni-flex uni-row radio-group\">\r\n <radio value=\"r1\" :checked=\"true\" color=\"#FFCC33\" style=\"transform: scale(0.7); margin-right: 15px\"\r\n class=\"radio\">选中\r\n </radio>\r\n <radio value=\"r2\" color=\"#FFCC33\" style=\"transform: scale(0.7)\" class=\"radio\">未选中</radio>\r\n </radio-group>\r\n </view>\r\n\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\" class=\"radio-group\">\r\n <radio class=\"uni-list-cell uni-list-cell-pd radio recommand\" 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 </scroll-view>\r\n</template>\r\n\r\n<style>\r\n .main {\r\n max-height: 250px;\r\n padding: 5px 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n .main .list-item {\r\n width: 100%;\r\n height: 100px;\r\n border: 1px solid #666;\r\n }\r\n\r\n .uni-list-cell {\r\n justify-content: flex-start;\r\n }\r\n</style>\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 items: [\r\n {\r\n value: 'CHN',\r\n name: '中国',\r\n },\r\n {\r\n value: 'USA',\r\n name: '美国',\r\n },\r\n\r\n {\r\n value: 'BRA',\r\n name: '巴西',\r\n },\r\n {\r\n value: 'JPN',\r\n name: '日本',\r\n },\r\n {\r\n value: 'ENG',\r\n name: '英国',\r\n },\r\n {\r\n value: 'FRA',\r\n name: '法国',\r\n },\r\n ] as ItemType[],\r\n current: 0,\r\n eventTest: false,\r\n\r\n value: '',\r\n text: '未选中',\r\n wrapText: 'uni-app x,终极跨平台方案\\nuts,大一统语言',\r\n disabled: true,\r\n checked: true,\r\n color: '#007aff',\r\n // 组件属性 autotest\r\n checked_boolean: false,\r\n disabled_boolean: false,\r\n color_input: \"#007AFF\",\r\n backgroundColor_input: \"#ffffff\",\r\n borderColor_input: \"#d1d1d1\",\r\n activeBackgroundColor_input: \"#007AFF\",\r\n activeBorderColor_input: \"\",\r\n iconColor_input: \"#ffffff\"\r\n }\r\n },\r\n\r\n methods: {\r\n radioChange(e : UniRadioGroupChangeEvent) {\r\n\r\n // 自动化测试\r\n console.log('test: radio event detail', e.target?.tagName, e.type)\r\n if ((e.target?.tagName ?? '') == 'RADIO-GROUP' && e.type == 'change') {\r\n this.eventTest = true\r\n }\r\n\r\n const selected = this.items.find((item) : boolean => {\r\n return item.value == e.detail.value\r\n })\r\n uni.showToast({\r\n icon: 'none',\r\n title: '当前选中:' + selected?.name,\r\n })\r\n },\r\n testChange(e : UniRadioGroupChangeEvent) {\r\n\r\n this.value = e.detail.value\r\n },\r\n radio_click() { console.log(\"组件被点击时触发\") },\r\n radio_touchstart() { console.log(\"手指触摸动作开始\") },\r\n radio_touchmove() { console.log(\"手指触摸后移动\") },\r\n radio_touchcancel() { console.log(\"手指触摸动作被打断,如来电提醒,弹窗\") },\r\n radio_touchend() { console.log(\"手指触摸动作结束\") },\r\n radio_tap() { console.log(\"手指触摸后马上离开\") },\r\n radio_longpress() { console.log(\"如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\") },\r\n change_checked_boolean(checked : boolean) { this.checked_boolean = checked },\r\n change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },\r\n confirm_color_input(value : string) { this.color_input = value },\r\n confirm_backgroundColor_input(value : string) { this.backgroundColor_input = value },\r\n confirm_borderColor_input(value : string) { this.borderColor_input = value },\r\n confirm_activeBackgroundColor_input(value : string) { this.activeBackgroundColor_input = value },\r\n confirm_activeBorderColor_input(value : string) { this.activeBorderColor_input = value },\r\n confirm_iconColor_input(value : string) { this.iconColor_input = value }\r\n }\r\n }\r\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.radio.radio)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/radio.html#radio)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=radio&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=radio&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=radio&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=radio&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=radio&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=radio)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=radio&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)\n"},"radio-group":{"name":"## radio-group","description":"> 组件类型:UniRadioGroupElement \n\n 单选框组","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| @change | (event: [UniRadioGroupChangeEvent](#uniradiogroupchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio-group 中的选中项发生变化时触发 change 事件,event.detail = {value: 选中项radio的value} |","event":"\n### 事件\n#### UniRadioGroupChangeEvent\n\n##### UniRadioGroupChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniRadioGroupChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniRadioGroupChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"","children":"### 子组件 @children-tags \n - [radio](radio.md)","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.radio.radio-group)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/radio.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=radio-group&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=radio-group&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=radio-group&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=radio-group&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=radio-group&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=radio-group)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=radio-group&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)\n"},"slider":{"name":"## slider","description":"> 组件类型:UniSliderElement \n\n 滑动选择器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| disabled | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否禁用 |\n| min | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | slider 最小值 |\n| max | number | 100 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | slider 最大值 |\n| step | number | 1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | slider 步长,取值必须大于 0,并且可被(max - min)整除 |\n| value | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio当前取值 |\n| activeBackgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007aff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | slider 滑块左侧已选择部分的线条颜色 |\n| ~~activeColor~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#007aff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | slider 滑块左侧已选择部分的线条颜色 |\n| backgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#e9e9e9\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio背景条的颜色 |\n| block-size | number | 28 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | radio滑块的大小,取值范围为 12 - 28 |\n| ~~block-color~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | \"#ffffff\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 滑块颜色 (使用foreColor替代) |\n| foreColor | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | slider 的滑块背景颜色 |\n| show-value | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示当前 value |\n| @change | (event: [UniSliderChangeEvent](#unisliderchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 完成一次拖动后触发的事件,event.detail = {value: value} |\n| @changing | (event: [UniSliderChangeEvent](#unisliderchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 拖动过程中触发的事件,event.detail = {value: value} |","event":"\n### 事件\n#### UniSliderChangeEvent\n\n##### UniSliderChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniSliderChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | number | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniSliderChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/slider/slider.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/slider/slider\n>Template\n```vue\n\n\n<template>\n <view class=\"main\">\n <slider :disabled=\"disabled_boolean\" :min=\"min_input\" :max=\"max_input\" :step=\"step_input\" :value=\"value_input\"\n :activeColor=\"activeColor_input\" :backgroundColor=\"backgroundColor_input\" :block-size=\"block_size_input\"\n :block-color=\"block_color_input\" :show-value=\"show_value_boolean\" :valueColor=\"valueColor\" @click=\"slider_click\"\n @touchstart=\"slider_touchstart\" @touchmove=\"slider_touchmove\" @touchcancel=\"slider_touchcancel\"\n @touchend=\"slider_touchend\" @tap=\"slider_tap\" @longpress=\"slider_longpress\" @change=\"slider_change\"\n @changing=\"slider_changing\" style=\"width: 90%\"><text>uni-app-x</text></slider>\n </view>\n\n <scroll-view style=\"flex: 1\">\n <view class=\"content\">\n <page-head title=\"组件属性\"></page-head>\n <boolean-data :defaultValue=\"false\" title=\"是否显示当前 value\" @change=\"change_show_value_boolean\"></boolean-data>\n <boolean-data :defaultValue=\"false\" title=\"是否禁用\" @change=\"change_disabled_boolean\"></boolean-data>\n <input-data defaultValue=\"0\" title=\"最小值(min)\" type=\"number\" @confirm=\"confirm_min_input\"></input-data>\n <input-data defaultValue=\"100\" title=\"最大值(max)\" type=\"number\" @confirm=\"confirm_max_input\"></input-data>\n <input-data defaultValue=\"1\" title=\"步长(step),取值必须大于 0,并且可被(max - min)整除\" type=\"number\"\n @confirm=\"confirm_step_input\"></input-data>\n <input-data defaultValue=\"0\" title=\"当前取值(value)\" type=\"number\" @confirm=\"confirm_value_input\"></input-data>\n <input-data defaultValue=\"#007aff\" title=\"滑块左侧已选择部分的线条颜色(active-color)\" type=\"text\"\n @confirm=\"confirm_activeColor_input\"></input-data>\n <input-data defaultValue=\"#e9e9e9\" title=\"背景条的颜色(background-color)\" type=\"text\"\n @confirm=\"confirm_backgroundColor_input\"></input-data>\n <input-data defaultValue=\"28\" title=\"滑块的大小(block-size),取值范围为 12 - 28\" type=\"number\"\n @confirm=\"confirm_block_size_input\"></input-data>\n <input-data defaultValue=\"#ffffff\" title=\"滑块颜色(block-color)\" type=\"text\"\n @confirm=\"confirm_block_color_input\"></input-data>\n <input-data defaultValue=\"#888888\" title=\"Value颜色(value-color)\" type=\"text\"\n @confirm=\"confirm_value_color_input\"></input-data>\n </view>\n\n <view class=\"uni-padding-wrap\">\n <page-head title=\"默认及使用\"></page-head>\n <view class=\"uni-title\">显示当前value</view>\n <view>\n <slider @change=\"sliderChange\" :value=\"50\" :show-value=\"true\" />\n </view>\n\n <view class=\"uni-title\">设置步进:step=10跳动</view>\n <view>\n <view class=\"uni-row\">\n <text>0</text>\n <text class=\"m-l-a\">100</text>\n </view>\n <slider @change=\"sliderChange\" :value=\"60\" :step=\"10\" />\n </view>\n\n <view class=\"uni-title\">浮点步进:step=0.01跳动</view>\n <view>\n <slider :value=\"0.5\" :min=\"0\" :max=\"1\" :step=\"0.01\" :show-value=\"true\" />\n </view>\n\n <view class=\"uni-title\">设置最小/最大值</view>\n <view>\n <slider @change=\"sliderChange\" :value=\"100\" :min=\"50\" :max=\"200\" :show-value=\"true\" />\n </view>\n\n <view class=\"uni-title\">不同颜色和大小的滑块</view>\n <view>\n <slider id=\"slider-custom-color-and-size\" @change=\"sliderChange\" :value=\"sliderValue\"\n :backgroundColor=\"sliderBackgroundColor\"\n :activeColor=\"sliderActiveColor\"\n :activeBackgroundColor=\"sliderActiveColor\"\n :blockColor=\"sliderBlockColor\"\n :foreColor=\"sliderBlockColor\"\n :block-size=\"sliderBlockSize\" />\n </view>\n <view class=\"uni-title\">暗黑模式</view>\n <view>\n <slider :show-value=\"true\"\n backgroundColor=\"rgba(32,32,32,0.5)\" valueColor=\"#555\" />\n </view>\n\n <navigator url=\"./slider-in-swiper\">\n <button>slider in swiper</button>\n </navigator>\n </view>\n </scroll-view>\n</template>\n\n<style>\n .main {\n padding: 5px 0;\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\n flex-direction: row;\n justify-content: center;\n }\n\n .main .list-item {\n width: 100%;\n height: 100px;\n border: 1px solid #666;\n }\n\n .m-l-a {\n margin-left: auto;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n sliderValue: 50,\n sliderBlockSize: 20,\n sliderBackgroundColor: \"#000000\",\n sliderActiveColor: \"#FFCC33\",\n sliderBlockColor: \"#8A6DE9\",\n // 组件属性 autotest\n show_value_boolean: false,\n disabled_boolean: false,\n min_input: 0,\n max_input: 100,\n step_input: 1,\n value_input: 0,\n activeColor_input: \"#007aff\",\n backgroundColor_input: \"#e9e9e9\",\n block_size_input: 28,\n block_color_input: \"#ffffff\",\n valueColor: \"#888888\",\n };\n },\n methods: {\n sliderChange(e : UniSliderChangeEvent) {\n console.log(\"value 发生变化:\" + e.detail.value);\n },\n slider_click() {\n console.log(\"组件被点击时触发\");\n },\n slider_touchstart() {\n console.log(\"手指触摸动作开始\");\n },\n slider_touchmove() {\n console.log(\"手指触摸后移动\");\n },\n slider_touchcancel() {\n console.log(\"手指触摸动作被打断,如来电提醒,弹窗\");\n },\n slider_touchend() {\n console.log(\"手指触摸动作结束\");\n },\n slider_tap() {\n console.log(\"手指触摸后马上离开\");\n },\n slider_longpress() {\n console.log(\n \"如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\"\n );\n },\n slider_change() {\n console.log(\"完成一次拖动后触发的事件,event.detail = {value: value}\");\n },\n slider_changing() {\n console.log(\"拖动过程中触发的事件,event.detail = {value: value}\");\n },\n change_show_value_boolean(checked : boolean) {\n this.show_value_boolean = checked;\n },\n change_disabled_boolean(checked : boolean) {\n this.disabled_boolean = checked;\n },\n confirm_min_input(value : number) {\n this.min_input = value;\n },\n confirm_max_input(value : number) {\n this.max_input = value;\n },\n confirm_step_input(value : number) {\n this.step_input = value;\n },\n confirm_value_input(value : number) {\n this.value_input = value;\n },\n confirm_activeColor_input(value : string) {\n this.activeColor_input = value;\n },\n confirm_backgroundColor_input(value : string) {\n this.backgroundColor_input = value;\n },\n confirm_block_size_input(value : number) {\n this.block_size_input = value;\n },\n confirm_block_color_input(value : string) {\n this.block_color_input = value;\n },\n confirm_value_color_input(value : string) {\n this.valueColor = value;\n },\n },\n };\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.slider)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/slider.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=slider&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=slider&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=slider&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=slider&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=slider&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=slider)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=slider&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)\n"},"switch":{"name":"## switch","description":"> 组件类型:UniSwitchElement \n\n 开关选择器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| checked | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否选中 |\n| type | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 样式,有效值:switch, checkbox |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| switch | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | - |\n@| checkbox | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | - |\n| ~~color~~ | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | switch 的颜色,同 css 的 color (使用foreColor替代) |\n| backgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | switch 的关闭状态背景颜色 |\n| activeBackgroundColor | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | switch 的开启状态背景颜色 |\n| foreColor | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | switch 的滑块背景颜色 |\n| activeForeColor | string([string.ColorString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.18\",\"4.18\",\"4.18\"]]}' /> | switch 的开启状态下的滑块背景颜色 |\n| disabled | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否禁用 |\n| @change | (event: [UniSwitchChangeEvent](#uniswitchchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | checked 改变时触发 change 事件,event.detail={ value:checked} |","event":"\n### 事件\n#### UniSwitchChangeEvent\n\n##### UniSwitchChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniSwitchChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | boolean | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniSwitchChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/switch/switch.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/switch/switch\n>Template\n```vue\n<template>\n <view>\n <view class=\"uni-padding-wrap uni-common-mt\">\n <view class=\"uni-title\">默认样式</view>\n <view class=\"flex-row\">\n <switch class=\"switch-checked\" :checked=\"checked\" @change=\"switch1Change\" />\n <switch @change=\"switch2Change\" />\n </view>\n <view class=\"uni-title\">暗黑样式</view>\n <view class=\"flex-row\">\n <switch id=\"darkChecked\" background-color=\"#1f1f1f\" activeBackgroundColor=\"#007aff\" foreColor=\"#f0f0f0\" activeForeColor=\"#ffffff\" :checked=\"checked\" />\n <switch id=\"dark\" background-color=\"#1f1f1f\" activeBackgroundColor=\"#007aff\" foreColor=\"#f0f0f0\" activeForeColor=\"#ffffff\" />\n </view>\n <view class=\"uni-title\">禁用样式</view>\n <view class=\"flex-row\">\n <switch class=\"switch-checked\" :checked=\"checked\" :disabled=\"true\" />\n <switch :disabled=\"true\" />\n </view>\n <view class=\"uni-title\">不同颜色和尺寸的switch</view>\n <view class=\"flex-row\">\n <switch class=\"switch-color-checked\" :color=\"color\" style=\"transform:scale(0.7)\" :checked=\"true\" />\n <switch class=\"switch-color\" :color=\"color\" style=\"transform:scale(0.7)\" />\n </view>\n <view class=\"uni-title\">推荐展示样式</view>\n </view>\n <view class=\"uni-list\">\n <view class=\"uni-list-cell uni-list-cell-padding\">\n <view class=\"uni-list-cell-db\">开启中</view>\n <switch :checked=\"true\" />\n </view>\n <view class=\"uni-list-cell uni-list-cell-padding\">\n <view class=\"uni-list-cell-db\">关闭</view>\n <switch />\n </view>\n </view>\n </view>\n</template>\n\n\n\n<style>\n .flex-row {\n flex-direction: row;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'switch 开关',\n checked: true,\n color: '#FFCC33',\n clickCheckedValue: true,\n testVerifyEvent: false,\n }\n },\n methods: {\n switch1Change: function (e : UniSwitchChangeEvent) {\n this.clickCheckedValue = e.detail.value\n console.log('switch1 发生 change 事件,携带值为', e.detail.value)\n\n // 仅测试\n this.testVerifyEvent = (e.type == 'change' && (e.target?.tagName ?? '') == \"SWITCH\")\n },\n switch2Change: function (e : UniSwitchChangeEvent) {\n console.log('switch2 发生 change 事件,携带值为', e.detail.value)\n }\n }\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.switch)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/switch.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=switch&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=switch&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=switch&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=switch&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=switch&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=switch)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=switch&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)\n"},"textarea":{"name":"## textarea","description":"> 组件类型:[UniTextareaElement](#unitextareaelement) \n\n 多行输入框","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| value | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框的初始内容 |\n| placeholder | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框为空时占位符 |\n| placeholder-style | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定 placeholder 的样式 |\n| placeholder-class | string([string.ClassString](/uts/data-type.md#ide-string)) | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定 placeholder 的样式类,目前仅支持color,font-size和font-weight |\n| maxlength | number | \"不限制长度\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 最大输入长度,0和正数为合法值,非法值的时候不限制最大长度 |\n| auto-focus | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 自动获取焦点,与`focus`属性对比,此属性只会首次生效。 |\n| focus | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 获取焦点 |\n| confirm-type | return \\| send \\| search \\| next \\| go \\| done | \"return\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.15\"]]}' /> | 设置键盘右下角按钮的文字 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| return | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.15\"]]}' /> | 换行 |\n@| send | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"4.15\"]]}' /> | 发送 |\n@| search | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"4.15\"]]}' /> | 搜索 |\n@| next | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"4.15\"]]}' /> | 下一个 |\n@| go | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"4.15\"]]}' /> | 前往 |\n@| done | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"4.15\"]]}' /> | 完成 |\n| cursor | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定focus时的光标位置 |\n| confirm-hold | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 点击键盘右下角按钮时是否保持键盘不收起 |\n| auto-height | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否自动增高,设置auto-height时,style.height不生效 |\n| cursor-spacing | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 指定光标与键盘的距离,单位 px 。取 textarea 距离底部的距离和 cursor-spacing 指定的距离的最小值作为光标与键盘的距离 |\n| cursor-color | string([string.ColorString](/uts/data-type.md#ide-string)) | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"3.99\",\"4.11\"]]}' /> | 指定光标颜色 |\n| selection-start | number | -1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 光标起始位置,自动聚集时有效,需与selection-end搭配使用 |\n| selection-end | number | -1 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 光标结束位置,自动聚集时有效,需与selection-satrt搭配使用 |\n| adjust-position | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 键盘弹起时,是否自动上推页面 |\n| hold-keyboard | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"4.11\"]]}' /> | focus时,点击页面的时候不收起键盘 |\n| @confirm | (event: [UniInputConfirmEvent](#uniinputconfirmevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 点击完成时, 触发 confirm 事件,event.detail = {value: value} |\n| @input | (event: [UniInputEvent](#uniinputevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当键盘输入时,触发 input 事件,event.detail = {value, cursor}, @input 处理函数的返回值并不会反映到 textarea 上 |\n| @linechange | (event: [UniTextareaLineChangeEvent](#unitextarealinechangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框行数变化时调用,event.detail = {height: 0, heightRpx: 0, lineCount: 0} |\n| @blur | (event: [UniTextareaBlurEvent](#unitextareablurevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框失去焦点时触发,event.detail = {value, cursor} |\n| @keyboardheightchange | (event: [UniInputKeyboardHeightChangeEvent](#uniinputkeyboardheightchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration} |\n| @focus | (event: [UniTextareaFocusEvent](#unitextareafocusevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度,在基础库 1.9.90 起支持 |","event":"\n### 事件\n#### UniInputConfirmEvent\n\n##### UniInputConfirmEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputConfirmEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | 输入框内容 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputConfirmEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniInputEvent\n\n##### UniInputEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | 输入框内容 |\n@| cursor | number | 是 | - | - | 光标的位置 |\n@| keyCode | number | 是 | - | - | 输入字符的Unicode值 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniTextareaLineChangeEvent\n\n##### UniTextareaLineChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniTextareaLineChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| lineCount | number | 是 | - | - | 行数 |\n@| heightRpx | number | 是 | - | - | textarea的高度 |\n@| height | number | 是 | - | - | textarea的高度 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniTextareaLineChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniTextareaBlurEvent\n\n##### UniTextareaBlurEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniTextareaBlurEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| value | string | 是 | - | - | 输入框内容 |\n@| cursor | number | 是 | - | - | 选择区域的起始位置 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniTextareaBlurEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniInputKeyboardHeightChangeEvent\n\n##### UniInputKeyboardHeightChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniInputKeyboardHeightChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| height | number | 是 | - | - | 键盘高度 |\n@| duration | number | 是 | - | - | 持续时间 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniInputKeyboardHeightChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniTextareaFocusEvent\n\n##### UniTextareaFocusEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniTextareaFocusEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| height | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 键盘高度 |\n@| value | string | 是 | - | - | 输入框内容 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniTextareaFocusEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/textarea/textarea.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/textarea/textarea\n>Template\n```vue\n\r\n\r\n<template>\r\n <!-- #ifdef APP -->\r\n <scroll-view style=\"flex: 1\">\r\n <!-- #endif -->\r\n <view class=\"main\">\r\n <textarea :value=\"default_value\" class=\"uni-textarea\" :auto-focus=\"true\" :focus=\"focus_boolean\"\r\n :confirm-hold=\"confirm_hold_boolean\" :auto-height=\"auto_height_boolean\" :fixed=\"fixed_boolean\"\r\n :show-confirm-bar=\"show_confirm_bar_boolean\" :adjust-position=\"adjust_position_boolean\"\r\n :cursor-color=\"cursor_color\" :cursor=\"cursor\" :placeholder=\"placeholder_value\"\r\n :inputmode=\"inputmode_enum[inputmode_enum_current].name\"\r\n :confirm-type=\"confirm_type_list[confirm_type_current].name\" @click=\"textarea_click\"\r\n @touchstart=\"textarea_touchstart\" @touchmove=\"textarea_touchmove\" @touchcancel=\"textarea_touchcancel\"\r\n @touchend=\"textarea_touchend\" @tap=\"textarea_tap\" @longpress=\"textarea_longpress\" @confirm=\"textarea_confirm\"\r\n @input=\"textarea_input\" @linechange=\"textarea_linechange\" @blur=\"textarea_blur\"\r\n @keyboardheightchange=\"textarea_keyboardheightchange\" @focus=\"textarea_focus\"\r\n style=\"padding: 10px; border: 1px solid #666;height: 200px\" />\r\n </view>\r\n <view class=\"content\">\r\n <boolean-data :defaultValue=\"false\" title=\"键盘弹起时,是否自动上推页面(限非 Web 平台)\"\r\n @change=\"change_adjust_position_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"是否自动增高,设置auto-height时,style.height不生效\"\r\n @change=\"change_auto_height_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"focus_boolean\" title=\"获取焦点\" @change=\"change_focus_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"true\" title=\"首次自动获取焦点\" @change=\"change_auto_focus_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"改变光标颜色为透明\" @change=\"change_cursor_color_boolean\"></boolean-data>\r\n <enum-data :items=\"confirm_type_list\" title=\"confirm-type,设置键盘右下角按钮。(Android仅支持return)\"\r\n @change=\"radio_change_confirm_type\"></enum-data>\r\n <boolean-data :defaultValue=\"false\" title=\"点击软键盘右下角按钮时是否保持键盘不收起(confirm-type为return时必然不收起)\"\r\n @change=\"change_confirm_hold_boolean\"></boolean-data>\r\n <enum-data :items=\"inputmode_enum\" title=\"input-mode,控制软键盘类型。(仅限 Web 平台符合条件的高版本浏览器或webview)。\"\r\n @change=\"radio_change_inputmode_enum\"></enum-data>\r\n <boolean-data :defaultValue=\"false\" title=\"是否显示键盘上方带有“完成”按钮那一栏(仅限小程序平台)\"\r\n @change=\"change_show_confirm_bar_boolean\"></boolean-data>\r\n <boolean-data :defaultValue=\"false\" title=\"如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true(仅限小程序平台)\"\r\n @change=\"change_fixed_boolean\"></boolean-data>\r\n\r\n\r\n <view class=\"title-wrap\">\r\n <view>maxlength 输入最大长度为10</view>\r\n </view>\r\n <view class=\"textarea-wrap\">\r\n <textarea id=\"textarea-instance-maxlength\" class=\"textarea-instance\" :value=\"textareaMaxLengthValue\"\r\n :maxlength=\"10\" />\r\n </view>\r\n\r\n <view class=\"title-wrap\">\r\n <view>cursor-spacing、placeholder-class、placeholder-style例子</view>\r\n </view>\r\n <view class=\"textarea-wrap\">\r\n <textarea id=\"textarea-height-exception\" class=\"textarea-instance\" placeholder=\"底部textarea测试键盘遮挡\"\r\n placeholder-class=\"placeholder\" placeholder-style=\"background-color:red\" :cursor-spacing=\"300\" />\r\n </view>\r\n <view class=\"title-wrap\">\r\n <view @click=\"setSelection(2, 5)\">设置输入框聚焦时光标的起始位置和结束位置(点击生效)</view>\r\n </view>\r\n <view class=\"textarea-wrap\">\r\n <textarea id=\"textarea-instance-2\" class=\"textarea-instance\" value=\"Hello UniApp X Textarea TestCase\"\r\n :selection-start=\"selectionStart\" :selection-end=\"selectionEnd\" @blur=\"onSelectionBlurChange\" />\r\n </view>\r\n\r\n <view class=\"title-wrap\">\r\n <view>设置hold-keyboard</view>\r\n <switch style=\"margin-left: 10px;\" @change=\"changeHoldKeyboard\" :checked=\"hold_keyboard\"></switch>\r\n </view>\r\n <view class=\"textarea-wrap\">\r\n <textarea class=\"textarea-instance\" :hold-keyboard=\"hold_keyboard\" />\r\n </view>\r\n\r\n <view class=\"title-wrap\">\r\n <view>同时存在 v-model 和 value</view>\r\n </view>\r\n <view class=\"textarea-wrap\">\r\n <textarea id=\"both-model-value\" class=\"textarea-instance\" v-model='defaultModel' value='456'></textarea>\r\n </view>\r\n\r\n <view class=\"title-wrap\">\r\n <view>设置adjust-position</view>\r\n <switch style=\"margin-left: 10px;\" @change=\"changeAdjustPosition\" :checked=\"adjust_position\"></switch>\r\n </view>\r\n <view class=\"textarea-wrap\">\r\n <textarea class=\"textarea-instance\" :adjust-position=\"adjust_position\" />\r\n </view>\r\n </view>\r\n <!-- #ifdef APP -->\r\n </scroll-view>\r\n <!-- #endif -->\r\n</template>\r\n\r\n<style>\r\n .main {\r\n min-height: 100px;\r\n padding: 5px 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.06);\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n .main .list-item {\r\n width: 100%;\r\n height: 100px;\r\n border: 1px solid #666;\r\n }\r\n\r\n .textarea-wrap {\r\n flex-direction: row;\r\n justify-content: center;\r\n }\r\n\r\n .title-wrap {\r\n flex-direction: row;\r\n align-items: center;\r\n margin-left: 10px;\r\n }\r\n\r\n .textarea-instance {\r\n flex: 1;\r\n border: 1 solid #666;\r\n margin: 10px;\r\n }\r\n\r\n .placeholder {\r\n background-color: yellow;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n import { ItemType } from '@/components/enum-data/enum-data'\r\n export default {\r\n data() {\r\n return {\r\n adjust_position_boolean: false,\r\n show_confirm_bar_boolean: false,\r\n fixed_boolean: false,\r\n auto_height_boolean: false,\r\n confirm_hold_boolean: false,\r\n focus_boolean: true,\r\n auto_focus_boolean: false,\r\n default_value: \"1\\n2\\n3\\n4\\n5\\n6\",\r\n inputmode_enum: [{ \"value\": 1, \"name\": \"text\" }, { \"value\": 2, \"name\": \"decimal\" }, { \"value\": 3, \"name\": \"numeric\" }, { \"value\": 4, \"name\": \"tel\" }, { \"value\": 5, \"name\": \"search\" }, { \"value\": 6, \"name\": \"email\" }, { \"value\": 7, \"name\": \"url\" }, { \"value\": 0, \"name\": \"none\" }] as ItemType[],\r\n confirm_type_list: [{ \"value\": 0, \"name\": \"return\" }, { \"value\": 1, \"name\": \"done\" }, { \"value\": 2, \"name\": \"send\" }, { \"value\": 3, \"name\": \"search\" }, { \"value\": 4, \"name\": \"next\" }, { \"value\": 5, \"name\": \"go\" }] as ItemType[],\r\n cursor_color: \"#3393E2\",\r\n cursor: 0,\r\n inputmode_enum_current: 0,\r\n confirm_type_current: 0,\r\n placeholder_value: \"请输入\",\r\n defaultModel: '123',\r\n textareaMaxLengthValue: \"\",\r\n selectionStart: -1,\r\n selectionEnd: -1,\r\n hold_keyboard: false,\r\n adjust_position: false\r\n }\r\n },\r\n\r\n methods: {\r\n textarea_click() { console.log(\"组件被点击时触发\") },\r\n textarea_touchstart() { console.log(\"手指触摸动作开始\") },\r\n textarea_touchmove() { console.log(\"手指触摸后移动\") },\r\n textarea_touchcancel() { console.log(\"手指触摸动作被打断,如来电提醒,弹窗\") },\r\n textarea_touchend() { console.log(\"手指触摸动作结束\") },\r\n textarea_tap() { console.log(\"手指触摸后马上离开\") },\r\n textarea_longpress() { console.log(\"如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。\") },\r\n textarea_confirm() { console.log(\"点击完成时, 触发 confirm 事件,event.detail = {value: value}\") },\r\n textarea_input() { console.log(\"当键盘输入时,触发 input 事件,event.detail = {value, cursor}, @input 处理函数的返回值并不会反映到 textarea 上\") },\r\n textarea_linechange() { console.log(\"输入框行数变化时调用,event.detail = {height: 0, height: 0, lineCount: 0}\") },\r\n textarea_blur() { console.log(\"输入框失去焦点时触发,event.detail = {value, cursor}\") },\r\n textarea_keyboardheightchange() { console.log(\"键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}\") },\r\n textarea_focus() { console.log(\"输入框聚焦时触发,event.detail = { value, height },height 为键盘高度\") },\r\n change_adjust_position_boolean(checked : boolean) { this.adjust_position_boolean = checked },\r\n change_show_confirm_bar_boolean(checked : boolean) { this.show_confirm_bar_boolean = checked },\r\n change_fixed_boolean(checked : boolean) { this.fixed_boolean = checked },\r\n change_auto_height_boolean(checked : boolean) { this.auto_height_boolean = checked },\r\n change_confirm_hold_boolean(checked : boolean) { this.confirm_hold_boolean = checked },\r\n change_focus_boolean(checked : boolean) { this.focus_boolean = checked },\r\n change_auto_focus_boolean(checked : boolean) { this.auto_focus_boolean = checked },\r\n change_cursor_color_boolean(checked : boolean) { if (checked) { this.cursor_color = \"transparent\" } else { this.cursor_color = \"#3393E2\" } },\r\n radio_change_inputmode_enum(checked : number) { this.inputmode_enum_current = checked },\r\n radio_change_confirm_type(checked : number) { this.confirm_type_current = checked },\r\n setSelection: function (selectionStart : number, selectionEnd : number) {\r\n uni.getElementById(\"textarea-instance-2\")?.focus()\r\n this.selectionStart = selectionStart;\r\n this.selectionEnd = selectionEnd;\r\n },\r\n onSelectionBlurChange() {\r\n this.selectionEnd = 0;\r\n },\r\n changeHoldKeyboard(event : UniSwitchChangeEvent) {\r\n const checked = event.detail.value;\r\n this.hold_keyboard = checked;\r\n },\r\n changeAdjustPosition(event : UniSwitchChangeEvent) {\r\n const checked = event.detail.value;\r\n this.adjust_position = checked;\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.form-component.textarea)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/textarea.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=textarea&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=textarea&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=textarea&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=textarea&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=textarea&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=textarea)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=textarea&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)\n","component_type":"### UniTextareaElement\ntextarea元素对象\n#### UniTextareaElement 的属性值\n| 名称 | 类型 | 必填 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| name | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 表单的控件名称,作为键值对的一部分与表单(form组件)一同提交 |\n| type | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | input的类型 |\n| disabled | boolean | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 是否禁用 |\n| autofocus | boolean | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 自动获取焦点 |\n| value | string | 是 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"-\",\"4.0\",\"4.11\"]]}' /> | 输入框的初始内容 |"},"navigator":{"name":"## navigator","description":"> 组件类型:UniNavigatorElement \n\n 页面链接","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| target | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在哪个目标上发生跳转,默认当前应用 |\n| url | string([string.PageURIString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当前应用内的跳转链接 |\n| open-type | string | \"navigate\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 跳转方式 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| navigate | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 对应 uni.navigateTo 或 navigateToMiniProgram 的功能 |\n@| redirect | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 对应 uni.redirectTo 的功能 |\n@| switchTab | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 对应 uni.switchTab 的功能 |\n@| reLaunch | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 对应 uni.reLaunch 的功能 |\n@| navigateBack | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 对应 uni.navigateBack 的功能 |\n| delta | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当 open-type 为 navigateBack 时有效,表示回退的层数 |\n| app-id | string | - | - | 当target=\"miniProgram\"时有效,要打开的小程序 appId |\n| path | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 当target=\"miniProgram\"时有效,打开的页面路径,如果为空则打开首页 |\n| extra-data | object | - | - | 当target=\"miniProgram\"时有效,需要传递给目标应用的数据,目标应用可在 App.onLaunch(),App.onShow() 中获取到这份数据 |\n| version | string | - | - | 当target=\"miniProgram\"时有效,要打开的小程序版本,有效值 develop(开发版),trial(体验版),release(正式版),仅在当前小程序为开发版或体验版时此参数有效;如果当前小程序是体验版或正式版,则打开的小程序必定是正式版 |\n| animation-type | string | \"pop-in/out\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.18\",\"4.11\"]]}' /> | 当 open-type=\"navigateTo\" 或 open-type=\"navigateBack\" 时有效,窗口的显示/关闭的动画类型。 |\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@| pop-in | - | 从右侧平移入栈动画效果 |\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@| pop-out | - | 从右侧平移出栈动画效果 |\n| animation-duration | number | 300 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当 open-type=\"navigateTo\" 或 open-type=\"navigateBack\" 时有效,窗口的显示/关闭动画的持续时间。 |\n| hover-class | string | - | - | 指定按下去的样式类。当 hover-class=\"none\" 时,没有点击态效果 |\n| hover-stop-propagation | boolean | - | - | 指定是否阻止本节点的祖先节点出现点击态 |\n| hover-start-time | number | - | - | 按住后多久出现点击态,单位毫秒 |\n| hover-stay-time | number | - | - | 手指松开后点击态保留时间,单位毫秒 |\n| render-link | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否给 navigator 组件加一层 a 标签控制 ssr 渲染 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/navigator/navigator.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/navigator/navigator\n>Template\n```vue\n<template>\n <page-head :title=\"title\"></page-head>\n <view class=\"uni-padding-wrap uni-common-mt\">\n <navigator id=\"navigate\" class=\"navigator\" url=\"navigate?title=navigate\">\n <button type=\"default\">跳转到新页面</button>\n </navigator>\n <navigator id=\"redirect\" class=\"navigator\" url=\"redirect?title=redirect\" open-type=\"redirect\">\n <button type=\"default\">在当前页打开redirect</button>\n </navigator>\n <navigator id=\"switchTab\" class=\"navigator\" url=\"/pages/tabBar/template\" open-type=\"switchTab\">\n <button type=\"default\">切换到模板选项卡switchTab</button>\n </navigator>\n <navigator id=\"reLaunch\" class=\"navigator\" url=\"/pages/tabBar/component\" open-type=\"reLaunch\">\n <button type=\"default\">关闭所有页面回首页reLaunch</button>\n </navigator>\n <navigator id=\"reLaunch\" class=\"navigator\" open-type=\"navigateBack\">\n <button type=\"default\">返回上一页navigateBack</button>\n </navigator>\n <!-- <navigator id=\"reLaunch\" class=\"navigator\" open-type=\"exit\">\n <button type=\"default\">退出应用(仅Android和小程序生效)</button>\n </navigator> -->\n <navigator id=\"navigateToErrorPage\" class=\"navigator\" url=\"/pages/error-page/error-page\" >\n <button type=\"default\"> 打开不存在的页面 </button>\n </navigator>\n <navigator id=\"navigateToErrorPage\" class=\"navigator\">\n <button type=\"default\"> 未指定URL的跳转 </button>\n </navigator>\n <navigator style=\"flex-direction: row;justify-content: space-between;\">\n <text>两端对齐样式测试</text>\n <view style=\"width: 20px;height: 20px; background-color: aqua;\"></view>\n </navigator>\n </view>\n</template>\n\n\n\n<style>\n .navigator {\n margin-bottom: 15px;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n title: 'navigator'\n }\n }\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.navigation.navigator)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/navigator.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=navigator&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=navigator&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=navigator&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=navigator&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=navigator&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=navigator)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=navigator&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)\n"},"image":{"name":"## image","description":"> 组件类型:UniImageElement \n\n 图片","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| src | string([string.ImageURIString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 图片资源地址 |\n| mode | string | \"scaleToFill\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 图片裁剪、缩放的模式 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| scaleToFill | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不保持纵横比缩放图片,使图片的宽高完全拉伸至填满 image 元素 |\n@| aspectFit | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 保持纵横比缩放图片,使图片的长边能完全显示出来。也就是说,可以完整地将图片显示出来。 |\n@| aspectFill | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 保持纵横比缩放图片,只保证图片的短边能完全显示出来。也就是说,图片通常只在水平或垂直方向是完整的,另一个方向将会发生截取 |\n@| widthFix | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 宽度不变,高度自动变化,保持原图宽高比不变 |\n@| heightFix | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 高度不变,宽度自动变化,保持原图宽高比不变 |\n@| top | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的顶部区域 |\n@| bottom | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的底部区域 |\n@| center | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的中间区域 |\n@| left | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的左边区域 |\n@| right | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的右边区域 |\n@| top left | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的左上边区域 |\n@| top right | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的右上边区域 |\n@| bottom left | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的左下边区域 |\n@| bottom right | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 不缩放图片,只显示图片的右下边区域 |\n| lazy-load | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"x\",\"4.11\"]]}' /> | 图片懒加载。只针对page与scroll-view下的image有效 |\n| fade-show | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"x\"]]}' /> | 图片显示动画效果 |\n| draggable | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 鼠标长按是否能拖动图片(仅H5平台) |\n| @error | (event: [UniImageErrorEvent](#uniimageerrorevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 图片加载错误时触发,event.detail = { errMsg } |\n| @load | (event: [UniImageLoadEvent](#uniimageloadevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 图片加载完成时触发,event.detail = { width: '图片宽度px', height: '图片高度px' } |","event":"\n### 事件\n#### UniImageErrorEvent\n\n##### UniImageErrorEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniImageErrorEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| errMsg | string | 是 | - | - | 错误信息 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniImageErrorEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniImageLoadEvent\n\n##### UniImageLoadEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniImageLoadEventDetail** | 是 | - | - | |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| width | number | 是 | - | - | 图片宽度 |\n@| height | number | 是 | - | - | 图片高度 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniImageLoadEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/image/image.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/image/image\n>Template\n```vue\n<template>\r\n <view style=\"flex: 1;\">\r\n <page-head :title=\"title\"></page-head>\r\n <view class=\"uni-padding-wrap uni-common-mt\">\r\n <view class=\"uni-center\" style=\"background:#FFFFFF;\">\r\n <image class=\"image\" :fade-show=\"true\" mode=\"widthFix\" :src=\"imageSrc\" @error=\"error\" @load=\"load\"></image>\r\n </view>\r\n <view class=\"uni-btn-v\">\r\n <button type=\"primary\" @tap=\"imageFormat\">图片格式示例</button>\r\n </view>\r\n <view class=\"uni-btn-v\">\r\n <button type=\"primary\" @tap=\"imageMode\">图片缩放模式示例</button>\r\n </view>\r\n <view class=\"uni-btn-v\">\r\n <button type=\"primary\" @tap=\"imagePath\">图片路径示例</button>\r\n </view>\r\n <view class=\"uni-btn-v\">\r\n <button type=\"primary\" @tap=\"imageLarge\">大图示例</button>\r\n </view>\r\n </view>\n <view v-if=\"autoTest\">\n <image :src=\"setCookieImage\"></image>\n <image :src=\"verifyCookieImage\" @error=\"error\"></image>\n </view>\r\n </view>\r\n</template>\r\n\r\n<style>\r\n .image {\r\n margin: 20px auto;\r\n width: 100px;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n export default {\r\n data() {\r\n return {\r\n title: 'image',\r\n imageSrc: \"/static/test-image/logo.png\" as string.ImageURIString,\r\n loadError: false,\n // 自动化测试\n autoTest: false,\n setCookieImage: \"\",\n verifyCookieImage: \"\",\n eventLoad: null as UTSJSONObject | null,\n eventError: null as UTSJSONObject | null\r\n }\r\n },\r\n methods: {\r\n error(event : ImageErrorEvent) {\r\n this.loadError = true\r\n console.log(event.type, event.detail);\n if (this.autoTest) {\n this.eventError = {\n \"tagName\": event.target?.tagName,\n \"type\": event.type,\n // \"errMsg\": event.detail.errMsg\n };\n }\r\n },\r\n load(event : ImageLoadEvent) {\r\n console.log(event.type, event.detail);\n if (this.autoTest) {\n this.eventLoad = {\n \"tagName\": event.target?.tagName,\n \"type\": event.type,\n \"width\": event.detail.width,\n \"height\": event.detail.height\n };\n }\r\n },\r\n imageFormat() {\r\n uni.navigateTo({\r\n url: '/pages/component/image/image-format'\r\n });\r\n },\r\n imageMode() {\r\n uni.navigateTo({\r\n url: '/pages/component/image/image-mode'\r\n });\r\n },\r\n imagePath() {\r\n uni.navigateTo({\r\n url: '/pages/component/image/image-path'\r\n });\r\n },\r\n imageLarge() {\r\n uni.navigateTo({\r\n url: '/pages/component/image/image-large'\r\n });\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.media.image)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/image.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=image&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=image&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=image&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=image&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=image&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=image)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=image&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)\n"},"video":{"name":"## video","description":"> 组件类型:[UniVideoElement](#univideoelement) \n\n 视频","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| loop | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否循环播放 |\n| src | string([string.VideoURIString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 视频资源地址 |\n| initial-time | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定视频初始播放位置 |\n| duration | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 指定视频长度 |\n| controls | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示默认播放控件(播放/暂停按钮、播放进度、时间) |\n| danmu-list | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 弹幕列表 |\n| danmu-btn | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示弹幕按钮,只在初始化时有效,不能动态变更 |\n| enable-danmu | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否展示弹幕,只在初始化时有效,不能动态变更 |\n| autoplay | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否自动播放 |\n| muted | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否静音播放 |\n| page-gesture | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在非全屏模式下,是否开启亮度与音量调节手势 |\n| direction | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 设置全屏时视频的方向,不指定则根据宽高比自动判断。有效值为 0(正常竖向), 90(屏幕逆时针90度), -90(屏幕顺时针90度) |\n| show-progress | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 若不设置,宽度大于240时才会显示 |\n| show-fullscreen-btn | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示全屏按钮 |\n| show-play-btn | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示视频底部控制栏的播放按钮 |\n| show-center-play-btn | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示视频中间的播放按钮 |\n| show-loading | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示loading控件 |\n| enable-progress-gesture | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否开启控制进度的手势 |\n| objectFit | string | \"contain\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当视频大小与 video 容器大小不一致时,视频的表现形式。 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| contain | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 包含 |\n@| fill | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 填充 |\n@| cover | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 覆盖 |\n| poster | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 视频封面的图片网络资源地址,如果 controls 属性值为 false 则设置 poster 无效 |\n| show-mute-btn | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否显示静音按钮 |\n| title | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 视频的标题,全屏时在顶部展示 |\n| play-btn-position | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 播放按钮的位置 |\n| enable-play-gesture | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 是否开启播放手势,即双击切换播放、暂停 |\n| auto-pause-if-navigate | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 当跳转到其它页面时,是否自动暂停本页面的视频 |\n| auto-pause-if-open-native | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 当跳转到其它小程序宿主原生页面时,是否自动暂停本页面的视频 |\n| vslide-gesture | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在非全屏模式下,是否开启亮度与音量调节手势(同 page-gesture) |\n| vslide-gesture-in-fullscreen | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 在全屏模式下,是否开启亮度与音量调节手势 |\n| poster-for-crawler | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 用于给搜索等场景作为视频封面展示,建议使用无播放 icon 的视频封面图,只支持网络地址 |\n| codec | string | \"hardware\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 解码器选择 |\n| http-cache | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 是否对 http、https 视频源开启本地缓存 |\n| play-strategy | number | 0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 播放策略 |\n| is-live | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否为直播源 |\n| @loadedmetadata | (event: [UniVideoLoadedMetadataEvent](#univideoloadedmetadataevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 视频元数据加载完成时触发 |\n| @play | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当开始/继续播放时触发 |\n| @pause | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当暂停播放时触发 |\n| @ended | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当播放到视频末尾时触发 |\n| @timeupdate | (event: [UniVideoTimeUpdateEvent](#univideotimeupdateevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 播放进度变化时触发,event.detail = { currentTime, duration }。触发频率 250ms 一次 |\n| @fullscreenchange | (event: [UniVideoFullScreenChangeEvent](#univideofullscreenchangeevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 当视频进入和退出全屏时触发,event.detail = { fullScreen, direction },direction取为 vertical 或 horizontal |\n| @waiting | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 视频出现缓冲时触发 |\n| @error | (event: [UniVideoErrorEvent](#univideoerrorevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 播放出错时触发 |\n| @progress | (event: [UniVideoProgressEvent](#univideoprogressevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 加载进度变化时触发,只支持一段加载。event.detail = { buffered },百分比 |\n| @fullscreenclick | (event: [UniVideoFullScreenClickEvent](#univideofullscreenclickevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 视频全屏播放时点击屏幕触发。event.detail = { screenX, screenY, screenWidth, screenHeight } |\n| @controlstoggle | (event: [UniVideoControlsToggleEvent](#univideocontrolstoggleevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | 切换 controls 显示隐藏时触发。event.detail = { show } |","event":"\n### 事件\n#### UniVideoTimeUpdateEvent\ntimeupdate 事件\n播放进度变化时触发\n##### UniVideoTimeUpdateEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniVideoTimeUpdateEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| currentTime | number | 是 | - | - | 当前进度 |\n@| duration | number | 是 | - | - | 总进度 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | Long | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniVideoTimeUpdateEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | - | 阻止当前事件的默认行为 |\n\n#### UniVideoFullScreenChangeEvent\nfullscreenchange 事件\n当视频进入和退出全屏是触发\n##### UniVideoFullScreenChangeEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniVideoFullScreenChangeEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| fullScreen | boolean | 是 | - | - | 是否全屏 |\n@| direction | string | 是 | - | - | 横竖屏,取值 vertical 或 horizontal |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | Long | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniVideoFullScreenChangeEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | - | 阻止当前事件的默认行为 |\n\n#### UniVideoErrorEvent\nerror 事件\n视频播放出错时触发\n##### UniVideoErrorEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **VideoError** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| errCode | 100001 \\| 200001 \\| 300001 | 是 | - | - | 统一错误码<br/>100001 网络错误<br/>200001 内部错误<br/>300001 SDK错误 |\n@| errSubject | string | 是 | - | - | 统一错误主题(模块)名称 |\n@| data | any \\| null | 否 | - | - | 错误信息中包含的数据 |\n@| cause | [Error](https://uniapp.dcloud.net.cn/tutorial/err-spec.html#unierror) \\| null | 否 | - | - | 源错误信息,可以包含多个错误,详见SourceError |\n@| errMsg | string | 是 | - | - | - |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | Long | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniVideoErrorEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | - | 阻止当前事件的默认行为 |\n\n#### UniVideoProgressEvent\nprogress 事件\n加载进度变化时触发\n##### UniVideoProgressEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniVideoProgressEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| buffered | number | 是 | - | - | 加载进度百分比 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | Long | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniVideoProgressEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | - | 阻止当前事件的默认行为 |\n\n#### UniVideoFullScreenClickEvent\nfullscreenclick 事件\n视频播放全屏播放时点击事件\n##### UniVideoFullScreenClickEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniVideoFullScreenClickEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| screenX | number | 是 | - | - | 点击点相对于屏幕左侧边缘的 X 轴坐标 |\n@| screenY | number | 是 | - | - | 点击点相对于屏幕顶部边缘的 Y 轴坐标 |\n@| screenWidth | number | 是 | - | - | 屏幕总宽度 |\n@| screenHeight | number | 是 | - | - | 屏幕总高度 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | Long | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniVideoFullScreenClickEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | - | 阻止当前事件的默认行为 |\n\n#### UniVideoControlsToggleEvent\ncontrolstoggle 事件\n切换播放控件显示隐藏时触发\n##### UniVideoControlsToggleEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| detail | **UniVideoControlsToggleEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| show | boolean | 是 | - | - | 是否显示 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| type | string | 是 | - | - | 事件类型 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | Long | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniVideoControlsToggleEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | - | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/video/video.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/video/video\n>Template\n```vue\n<template>\n <view class=\"uni-flex-item\">\n <video class=\"video\" ref=\"video\" id=\"video\" :header=\"header\" :src=src :autoplay=\"autoplay\" :loop=\"loop\"\n :muted=\"muted\" :initial-time=\"initialTime\" :duration=\"duration\" :controls=\"controls\" :danmu-btn=\"danmuBtn\"\n :enable-danmu=\"enableDanmu\" :page-gesture=\"pageGesture\" :direction=\"direction\" :show-progress=\"showProgress\"\n :show-fullscreen-btn=\"showFullscreenBtn\" :show-play-btn=\"showPlayBtn\" :show-center-play-btn=\"showCenterPlayBtn\"\n :show-loading=\"showLoading\" :enable-progress-gesture=\"enableProgressGesture\" :object-fit=\"objectFit\"\n :poster=\"poster\" :show-mute-btn=\"showMuteBtn\" :title=\"title\" :enable-play-gesture=\"enablePlayGesture\"\n :vslide-gesture=\"vslideGesture\" :vslide-gesture-in-fullscreen=\"vslideGestureInFullscreen\" :codec=\"codec\"\n :http-cache=\"httpCache\" :play-strategy=\"playStrategy\" :danmu-list=\"danmuList\" @play=\"onPlay\" @pause=\"onPause\"\n @ended=\"onEnded\" @timeupdate=\"onTimeUpdate\" @waiting=\"onWaiting\" @error=\"onError\" @progress=\"onProgress\"\n @fullscreenclick=\"onFullScreenClick\" @controlstoggle=\"onControlsToggle\" @fullscreenchange=\"onFullScreenChange\">\n </video>\n <scroll-view class=\"uni-padding-wrap uni-common-mt uni-flex-item\">\n <view class=\"uni-btn-v\">\n <navigator url=\"/pages/component/video/video-format\">\n <button type=\"primary\" @click=\"pause\">视频格式示例</button>\n </navigator>\n </view>\n <view class=\"uni-title\">\n <text class=\"uni-title-text\">API示例</text>\n </View>\n <view class=\"uni-btn-v\">\n <button type=\"primary\" @click=\"play\">播放</button>\n </view>\n <view class=\"uni-btn-v\">\n <button type=\"primary\" @click=\"pause\">暂停</button>\n </view>\n <view class=\"uni-btn-v\">\n <input class=\"input\" placeholder=\"输入要跳转的位置,单位s\" type=\"number\" @input=\"onSeekInput\"></input>\n <button type=\"primary\" @click=\"seek\">跳转到指定位置</button>\n </view>\n <view class=\"uni-btn-v\">\n <enum-data title=\"选择进入全屏时的视频方向\" :items=\"directionItemTypes\" @change=\"onRequestFullScreenDirectionChange\"></enum-data>\n <button type=\"primary\" @click=\"requestFullScreen\">进入全屏</button>\n </view>\n <view class=\"uni-btn-v\">\n <button type=\"primary\" @click=\"exitFullScreen\">退出全屏</button>\n </view>\n <view class=\"uni-btn-v\">\n <button type=\"primary\" @click=\"stop\">停止</button>\n </view>\n <view class=\"uni-btn-v\">\n <input class=\"input\" placeholder=\"输入弹幕\" value=\"{ 'text': '要显示的文本', 'color': '#FF0000' }\" type=\"string\" @input=\"onSendDanmuInput\"></input>\n <button type=\"primary\" :disabled=\"!enableDanmu\" @click=\"sendDanmu\">发送弹幕</button>\n </view>\n <view class=\"uni-btn-v\">\n <enum-data title=\"选择倍速\" :items=\"rateItemTypes\" @change=\"onPlaybackRateChange\"></enum-data>\n <button type=\"primary\" @click=\"playbackRate\">设置倍速</button>\n </view>\n <view class=\"uni-title\">\n <text class=\"uni-title-text\">属性示例</text>\n </view>\n <input class=\"input margin-10\" type=\"string\" placeholder=\"设置播放资源\" @confirm=\"onSrcComfirm\"></input>\n <input class=\"input margin-10\" type=\"number\" placeholder=\"设置初始播放位置(播放前设置有效)\" @confirm=\"onInitialTimeComfirm\"></input>\n <input class=\"input margin-10\" type=\"number\" placeholder=\"设置视频时长(播放前设置有效)\" @confirm=\"onDurationComfirm\"></input>\n <input class=\"input margin-10\" type=\"string\" placeholder=\"设置视频封面\" @confirm=\"onPosterComfirm\"></input>\n <input class=\"input margin-10\" type=\"string\" placeholder=\"设置视频标题(仅限非 Web 平台)\" @confirm=\"onTitleComfirm\"></input>\n <input class=\"input margin-10\" type=\"string\" placeholder=\"设置header(json格式)\" @confirm=\"onHeaderComfirm\"></input>\n <boolean-data title=\"设置是否展示弹幕(播放前设置有效)\" :defaultValue=\"enableDanmu\" @change=\"onEnableDanmuChange\"></boolean-data>\n <boolean-data title=\"设置是否自动播放(播放前设置有效)\" :defaultValue=\"autoplay\" @change=\"onAutoplayChange\"></boolean-data>\n <boolean-data title=\"设置是否循环播放(播放完成后生效)\" :defaultValue=\"loop\" @change=\"onLoopChange\"></boolean-data>\n <boolean-data title=\"设置是否静音播放\" :defaultValue=\"muted\" @change=\"onMutedChange\"></boolean-data>\n <boolean-data title=\"设置是否显示默认播放控件\" :defaultValue=\"controls\" @change=\"onControlsChange\"></boolean-data>\n <boolean-data title=\"设置是否显示弹幕按钮\" :defaultValue=\"danmuBtn\" @change=\"onDanmuBtnChange\"></boolean-data>\n <boolean-data title=\"设置是否显示进度条\" :defaultValue=\"showProgress\" @change=\"onShowProgressChange\"></boolean-data>\n <boolean-data title=\"设置是否显示全屏按钮\" :defaultValue=\"showFullscreenBtn\" @change=\"onShowFullscreenBtnChange\"></boolean-data>\n <boolean-data title=\"设置是否显示视频底部控制栏的播放按钮\" :defaultValue=\"showPlayBtn\" @change=\"onShowPlayBtnChange\"></boolean-data>\n <boolean-data title=\"设置是否显示静音按钮(仅限非 Web 平台)\" :defaultValue=\"showMuteBtn\" @change=\"onShowMuteBtnChange\"></boolean-data>\n <enum-data title=\"设置全屏时视频的方向\" :items=\"directionItemTypes\" @change=\"onDirectionChange\"></enum-data>\n <boolean-data title=\"设置是否显示视频中间的播放按钮\" :defaultValue=\"showCenterPlayBtn\" @change=\"onShowCenterPlayBtnChange\"></boolean-data>\n <boolean-data title=\"设置是否显示loading控件\" :defaultValue=\"showLoading\" @change=\"onShowLoadingChange\"></boolean-data>\n <boolean-data title=\"设置是否开启控制进度的手势\" :defaultValue=\"enableProgressGesture\" @change=\"onEnableProgressGestureChange\"></boolean-data>\n <boolean-data title=\"设置是否开启播放手势(仅限非 Web 平台)\" :defaultValue=\"enablePlayGesture\" @change=\"onEnablePlayGestureChange\"></boolean-data>\n <!-- #ifndef WEB -->\n <boolean-data title=\"非全屏模式下,设置是否开启亮度与音量调节手势\" :defaultValue=\"pageGesture\" @change=\"onPageGestureChange\"></boolean-data>\n <!-- #endif -->\n <boolean-data title=\"非全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)\" :defaultValue=\"vslideGesture\" @change=\"onVslideGestureChange\"></boolean-data>\n <boolean-data title=\"全屏模式下,设置是否开启亮度与音量调节手势(仅限非 Web 平台)\" :defaultValue=\"vslideGestureInFullscreen\" @change=\"onVslideGestureInFullscreenChange\"></boolean-data>\n <boolean-data title=\"设置是否对http、https视频源开启本地缓存(仅 App 平台,播放前设置有效)\" :defaultValue=\"httpCache\" @change=\"onHttpCacheChange\"></boolean-data>\n <enum-data title=\"设置视频大小与video容器大小不一致时,视频的表现形式\" :items=\"objectFitItemTypes\" @change=\"onObjectFitChange\"></enum-data>\n <enum-data title=\"设置解码器(仅 App 平台,播放前设置有效)\" :items=\"codecItemTypes\" @change=\"onCodecChange\"></enum-data>\n <enum-data title=\"设置播放策略(仅 App 平台,播放前设置有效)\" :items=\"playStrategyItemTypes\" @change=\"onPlayStrategyChange\"></enum-data>\n </scroll-view>\n </view>\n</template>\n\n\n\n<style>\n .video {\n width: 100%;\n height: 200px;\n }\n\n .input {\n height: 40px;\n background: #FFF;\n padding: 8px 13px;\n }\n\n .margin-10 {\n margin: 10px;\n }\n</style>\n\n```\n>Script\n```uts\n\n import { ItemType } from '@/components/enum-data/enum-data';\n export default {\n onReady() {\n this.videoContext = uni.createVideoContext('video');\n // this.videoContext = uni.createVideoContext('video', this);\n },\n data() {\n return {\n videoContext: null as VideoContext | null,\n // 属性\n src: \"https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4\",\n autoplay: false,\n loop: false,\n muted: false,\n initialTime: 0,\n duration: 0,\n controls: true,\n danmuList: [{\n text: '要显示的文本',\n color: '#FF0000',\n time: 3\n }, {\n text: '要显示的文本2',\n color: '#31ff23',\n time: 5\n }, {\n text: '要显示的文本3',\n color: '#f13ef8',\n time: 7\n }, {\n text: '要显示的文本4',\n color: '#4972f8',\n time: 9\n }, {\n text: '要显示的文本5',\n color: '#000000',\n time: 11\n }] as Array<Danmu>,\n danmuBtn: false,\n enableDanmu: true,\n pageGesture: false,\n direction: -1,\n directionItemTypes: [{ \"value\": 0, \"name\": \"0(正常竖向)\" }, { \"value\": 1, \"name\": \"90(屏幕逆时针90度)\" }, { \"value\": 2, \"name\": \"-90(屏幕顺时针90度)\" }] as ItemType[],\n directionItems: [0, 90, -90],\n showProgress: true,\n showFullscreenBtn: true,\n showPlayBtn: true,\n showCenterPlayBtn: true,\n showLoading: true,\n enableProgressGesture: true,\n objectFit: \"contain\",\n objectFitItemTypes: [{ \"value\": 0, \"name\": \"contain(包含)\" }, { \"value\": 1, \"name\": \"fill(填充)\" }, { \"value\": 2, \"name\": \"cover(覆盖)\" }] as ItemType[],\n objectFitItems: [\"contain\", \"fill\", \"cover\"],\n poster: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni-android.png\",\n showMuteBtn: false,\n title: \"video-component\",\n enablePlayGesture: false,\n vslideGesture: false,\n vslideGestureInFullscreen: true,\n codec: \"hardware\",\n codecItemTypes: [{ \"value\": 0, \"name\": \"hardware(硬解码)\" }, { \"value\": 1, \"name\": \"software(软解码)\" }] as ItemType[],\n codecItems: [\"hardware\", \"software\"],\n httpCache: true,\n playStrategy: 0,\n playStrategyItemTypes: [{ \"value\": 0, \"name\": \"0(普通模式)\" }, { \"value\": 1, \"name\": \"1(平滑播放模式)\" }, { \"value\": 1, \"name\": \"2(M3U8优化模式)\" }] as ItemType[],\n playStrategyItems: [0, 1, 2],\n header: {\n 'User-Agent': 'User-Agent test',\n 'header': 'header test',\n 'cookie': 'cookie test'\n } as UTSJSONObject,\n // API\n pos: 0,\n requestFullScreenOptions: null as RequestFullScreenOptions | null,\n danmu: {\n text: '要显示的文本',\n color: '#FF0000'\n } as Danmu,\n rate: 1,\n rateItemTypes: [{ \"value\": 0, \"name\": \"0.5\" }, { \"value\": 1, \"name\": \"0.8\" }, { \"value\": 2, \"name\": \"1.0\" }, { \"value\": 3, \"name\": \"1.25\" }, { \"value\": 4, \"name\": \"1.5\" }] as ItemType[],\n rateItems: [0.5, 0.8, 1.0, 1.25, 1.5],\n // 自动化测试\n autoTest: false,\n isPlaying: false,\n isPause: false,\n isError: false,\n eventPlay: null as UTSJSONObject | null,\n eventPause: null as UTSJSONObject | null,\n eventEnded: null as UTSJSONObject | null,\n eventTimeupdate: null as UTSJSONObject | null,\n eventFullscreenchange: null as UTSJSONObject | null,\n eventWaiting: null as UTSJSONObject | null,\n eventError: null as UTSJSONObject | null,\n eventProgress: null as UTSJSONObject | null,\n eventFullscreenclick: null as UTSJSONObject | null,\n eventControlstoggle: null as UTSJSONObject | null\n }\n },\n onLoad() {\n },\n methods: {\n // API\n play: function () {\n console.log(\"play\");\n this.videoContext?.play();\n },\n pause: function () {\n console.log(\"pause\");\n (uni.getElementById(\"video\") as UniVideoElement).pause(); //as写法测试。注意id不对时as会崩溃\n // this.videoContext?.pause();\n },\n seek: function () {\n console.log(\"seek -> \" + this.pos);\n this.videoContext?.seek(this.pos);\n },\n onSeekInput: function (event : UniInputEvent) {\n this.pos = parseInt(event.detail.value);\n },\n requestFullScreen: function () {\n console.log(\"requestFullScreen -> \" + this.requestFullScreenOptions);\n this.videoContext?.requestFullScreen(this.requestFullScreenOptions);\n },\n exitFullScreen: function () {\n console.log(\"exitFullScreen\");\n this.videoContext?.exitFullScreen();\n },\n stop: function () {\n console.log(\"stop\");\n uni.getElementById<UniVideoElement>(\"video\")?.stop(); //泛型写法测试\n // this.videoContext?.stop();\n },\n sendDanmu: function () {\n console.log(\"sendDanmu -> \" + this.danmu);\n this.videoContext?.sendDanmu(this.danmu);\n },\n onSendDanmuInput: function (event : UniInputEvent) {\n let json = JSON.parse<Danmu>(event.detail.value)\n if (json == null) return;\n this.danmu = json as Danmu;\n },\n playbackRate: function () {\n console.log(\"playbackRate -> \" + this.rate);\n this.videoContext?.playbackRate(this.rate);\n },\n onPlaybackRateChange: function (value : number) {\n this.rate = this.rateItems[value];\n },\n // 属性\n onSrcComfirm: function (event : UniInputConfirmEvent) {\n let value = event.detail.value;\n if (value == '') return;\n this.src = value;\n console.log(\"src -> \" + this.src)\n },\n onAutoplayChange: function (value : boolean) {\n this.autoplay = value;\n console.log(\"autoplay -> \" + this.autoplay)\n },\n onLoopChange: function (value : boolean) {\n this.loop = value;\n console.log(\"loop -> \" + this.loop)\n },\n onMutedChange: function (value : boolean) {\n this.muted = value;\n console.log(\"muted -> \" + this.muted)\n },\n onInitialTimeComfirm: function (event : UniInputConfirmEvent) {\n let value = parseInt(event.detail.value)\n if (isNaN(value)) value = 0;\n this.initialTime = value;\n console.log(\"initialTime -> \" + this.initialTime)\n },\n onDurationComfirm: function (event : UniInputConfirmEvent) {\n let value = parseInt(event.detail.value)\n if (isNaN(value)) value = 0;\n this.duration = value;\n console.log(\"duration -> \" + this.duration)\n },\n onControlsChange: function (value : boolean) {\n this.controls = value;\n console.log(\"controls -> \" + this.controls)\n },\n onEnableDanmuChange: function (value : boolean) {\n this.enableDanmu = value;\n console.log(\"enableDanmu -> \" + this.enableDanmu)\n },\n onDanmuBtnChange: function (value : boolean) {\n this.danmuBtn = value;\n console.log(\"danmuBtn -> \" + this.danmuBtn)\n },\n onPageGestureChange: function (value : boolean) {\n this.pageGesture = value;\n console.log(\"pageGesture -> \" + this.pageGesture)\n },\n onRequestFullScreenDirectionChange: function (value : number) {\n let direction = this.directionItems[value];\n this.requestFullScreenOptions = {\n direction\n } as RequestFullScreenOptions;\n },\n onDirectionChange: function (value : number) {\n this.direction = this.directionItems[value];\n console.log(\"direction -> \" + this.direction)\n },\n onShowProgressChange: function (value : boolean) {\n this.showProgress = value;\n console.log(\"showProgress -> \" + this.showProgress)\n },\n onShowFullscreenBtnChange: function (value : boolean) {\n this.showFullscreenBtn = value;\n console.log(\"showFullscreenBtn -> \" + this.showFullscreenBtn)\n },\n onShowPlayBtnChange: function (value : boolean) {\n this.showPlayBtn = value;\n console.log(\"showPlayBtn -> \" + this.showPlayBtn)\n },\n onShowCenterPlayBtnChange: function (value : boolean) {\n this.showCenterPlayBtn = value;\n console.log(\"showCenterPlayBtn -> \" + this.showCenterPlayBtn)\n },\n onShowLoadingChange: function (value : boolean) {\n this.showLoading = value;\n console.log(\"showLoading -> \" + this.showLoading)\n },\n onEnableProgressGestureChange: function (value : boolean) {\n this.enableProgressGesture = value;\n console.log(\"enableProgressGesture -> \" + this.enableProgressGesture)\n },\n onObjectFitChange: function (value : number) {\n this.objectFit = this.objectFitItems[value];\n console.log(\"objectFit -> \" + this.objectFit)\n },\n onPosterComfirm: function (event : UniInputConfirmEvent) {\n let value = event.detail.value;\n if (value == '') return;\n this.poster = value;\n console.log(\"poster -> \" + this.poster)\n },\n onShowMuteBtnChange: function (value : boolean) {\n this.showMuteBtn = value;\n console.log(\"showMuteBtn -> \" + this.showMuteBtn)\n },\n onTitleComfirm: function (event : UniInputConfirmEvent) {\n let value = event.detail.value;\n if (value == '') return;\n this.title = value;\n console.log(\"title -> \" + this.title)\n },\n onEnablePlayGestureChange: function (value : boolean) {\n this.enablePlayGesture = value;\n console.log(\"enablePlayGesture -> \" + this.enablePlayGesture)\n },\n onVslideGestureChange: function (value : boolean) {\n this.vslideGesture = value;\n console.log(\"vslideGesture -> \" + this.vslideGesture)\n },\n onVslideGestureInFullscreenChange: function (value : boolean) {\n this.vslideGestureInFullscreen = value;\n console.log(\"vslideGestureInFullscreen -> \" + this.vslideGestureInFullscreen)\n },\n onCodecChange: function (value : number) {\n this.codec = this.codecItems[value];\n console.log(\"codec -> \" + this.codec)\n },\n onHttpCacheChange: function (value : boolean) {\n this.httpCache = value;\n console.log(\"httpCache -> \" + this.httpCache)\n },\n onPlayStrategyChange: function (value : number) {\n this.playStrategy = this.playStrategyItems[value];\n console.log(\"playStrategy -> \" + this.playStrategy)\n },\n onHeaderComfirm: function (event : UniInputConfirmEvent) {\n let json = JSON.parse(event.detail.value)\n if (json == null) return;\n this.header = json as UTSJSONObject;\n console.log(\"header -> \" + JSON.stringify(this.header))\n },\n // 事件\n onPlay: function (res : UniEvent) {\n console.log(res.type);\n this.isPlaying = true;\n this.isPause = false;\n if (this.autoTest) {\n this.eventPlay = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type\n };\n }\n },\n onPause: function (res : UniEvent) {\n console.log(res.type);\n this.isPlaying = false;\n this.isPause = true;\n if (this.autoTest) {\n this.eventPause = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type\n };\n }\n },\n onEnded: function (res : UniEvent) {\n console.log(res.type);\n if (this.autoTest) {\n this.eventEnded = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type\n };\n }\n },\n onTimeUpdate: function (res : UniVideoTimeUpdateEvent) {\n console.log(res.type + \" -> \" + JSON.stringify(res.detail));\n if (this.autoTest) {\n this.eventTimeupdate = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type,\n \"currentTime\": Math.trunc(res.detail.currentTime),\n \"duration\": Math.trunc(res.detail.duration)\n };\n }\n },\n onFullScreenChange: function (res : UniVideoFullScreenChangeEvent) {\n console.log(res.type + \" -> \" + JSON.stringify(res.detail));\n if (this.autoTest) {\n this.eventFullscreenchange = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type,\n \"fullScreen\": res.detail.fullScreen,\n \"direction\": res.detail.direction\n };\n }\n },\n onWaiting: function (res : UniEvent) {\n console.log(res.type);\n if (this.autoTest) {\n this.eventWaiting = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type\n };\n }\n },\n onError: function (res : UniVideoErrorEvent) {\n console.log(res.type + \" -> \" + JSON.stringify(res.detail));\n this.isError = true;\n if (this.autoTest) {\n this.eventError = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type,\n \"errCode\": res.detail.errCode\n };\n }\n },\n onProgress: function (res : UniVideoProgressEvent) {\n console.log(res.type + \" -> \" + JSON.stringify(res.detail));\n if (this.autoTest) {\n this.eventProgress = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type,\n \"isBufferedValid\": res.detail.buffered > 0\n };\n }\n },\n onFullScreenClick: function (res : UniVideoFullScreenClickEvent) {\n console.log(res.type + \" -> \" + JSON.stringify(res.detail));\n if (this.autoTest) {\n this.eventFullscreenclick = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type,\n \"screenX\": Math.trunc(res.detail.screenX),\n \"screenY\": Math.trunc(res.detail.screenY),\n \"screenWidth\": Math.trunc(res.detail.screenWidth),\n \"screenHeight\": Math.trunc(res.detail.screenHeight)\n };\n }\n },\n onControlsToggle: function (res : UniVideoControlsToggleEvent) {\n console.log(res.type + \" -> \" + JSON.stringify(res.detail));\n if (this.autoTest) {\n this.eventControlstoggle = {\n \"tagName\": res.target?.tagName,\n \"type\": res.type,\n \"show\": res.detail.show\n };\n }\n },\n // 自动化测试\n downloadSource() {\n uni.downloadFile({\n url: 'https://qiniu-web-assets.dcloud.net.cn/video/sample/2minute-demo.mp4',\n success: (res) => {\n this.src = res.tempFilePath;\n },\n fail: (_) => {\n this.isError = true;\n }\n })\n }\n }\n }\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.media.video)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/video.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=video&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=video&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=video&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=video&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=video&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=video)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=video&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)\n","component_type":"### UniVideoElement\nvideo元素对象\n#### UniVideoElement 的方法\n##### play() @play\n播放\n\n\n###### play 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### pause() @pause\n暂停\n\n\n###### pause 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### seek(position) @seek\n跳转到指定位置\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| position | number | 是 | - | - | 跳转到指定位置(秒) | \n\n\n###### seek 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### stop() @stop\n停止视频\n\n\n###### stop 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### sendDanmu(danmu) @senddanmu\n发送弹幕\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| danmu | **Danmu** | 是 | - | - | 弹幕数据 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| text | string \\| null | 否 | - | - | 弹幕文字 |\n@| color | string \\| null | 否 | - | - | 弹幕颜色 |\n@| time | number \\| null | 否 | - | - | 显示时刻 | \n\n\n###### sendDanmu 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### playbackRate(rate) @playbackrate\n设置倍速播放\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| rate | number | 是 | - | - | 支持倍率 0.5/0.8/1.0/1.25/1.5 | \n\n\n###### playbackRate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### requestFullScreen(direction?) @requestfullscreen\n进入全屏\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| direction | **RequestFullScreenOptions** | 否 | - | - | 0\\|正常竖向, 90\\|屏幕逆时针90度, -90\\|屏幕顺时针90度 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| direction | number \\| null | 否 | - | - | direction<br/>- 0: 正常竖向<br/>- 90: 屏幕逆时针90度<br/>- -90: 屏幕顺时针90度 | \n\n\n###### requestFullScreen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### exitFullScreen() @exitfullscreen\n退出全屏\n\n\n###### exitFullScreen 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n"},"animation-view":{"name":"## animation-view","description":"Lottie 动画\n> 本 Component 是 uni ext component,需下载插件:[animation-view](https://ext.dcloud.net.cn/plugin?name=uni-animation-view)\n","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| path | string | \"\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 动画资源地址,目前只支持绝对路径 |\n| loop | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 动画是否循环播放 |\n| autoplay | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 动画是否自动播放 |\n| action | string | \"stop\" | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 动画操作,可取值 play、pause、stop |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| play | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 播放 |\n@| pause | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 暂停 |\n@| stop | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 停止 |\n| hidden | boolean | false | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 是否隐藏动画 |\n| @ended | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | - |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/animation-view/animation-view.uvue) \n >\n> 该组件不支持 Web,请运行 hello uni-app x 到 App 平台体验 \n```uvue\n<template>\n <div>\n <button @tap=\"changeUrl\">播放本地动画资源</button>\n <button @tap=\"changeServerUrl\">播放远程动画资源</button>\n <button @tap=\"changeAutoPlay\">测试AutoPlay</button>\n <button @tap=\"changeLoop\">测试Loop</button>\n <button @tap=\"changeAction(1)\">测试action play</button>\n <button @tap=\"changeAction(2)\">测试action pause</button>\n <button @tap=\"changeAction(3)\">测试action stop</button>\n <animation-view ref=\"animView\" :path=\"animUrl\" :autoplay=\"autoplay\" :loop=\"loop\" :action=\"action\"\n :hidden=\"hidden\" @bindended=\"testAnimEnd\"\n :style=\"{width:widthNum+'rpx',height:heightNum+'px',background:yanse}\">\n </animation-view>\n\n </div>\n</template>\n\n<script>\n\n export default {\n data() {\n return {\n hidden: false,\n autoplay: false,\n action: \"play\",\n loop: false,\n yanse: \"red\",\n widthNum: 750,\n heightNum: 200,\n comShow: true,\n animUrl: \"/static/anim_a.json\"\n }\n },\n\n methods: {\n\n changeAutoPlay: function() {\n this.autoplay = !this.autoplay\n },\n changeUrl: function() {\n if (this.animUrl == \"/static/anim_a.json\") {\n this.animUrl = \"/static/anim_b.json\"\n } else {\n this.animUrl = \"/static/anim_a.json\"\n }\n },\n\n changeServerUrl: function() {\n this.animUrl = \"https://b.bdstatic.com/miniapp/images/lottie_example_one.json\"\n },\n changeAction: function(type:number) {\n if (type == 1) {\n this.action = \"play\"\n } else if (type == 2) {\n this.action = \"pause\"\n } else if (type == 3) {\n this.action = \"stop\"\n }\n },\n changeLoop: function() {\n this.loop = !this.loop\n },\n testAnimEnd: function() {\n console.log(\"testAnimEnd\");\n }\n\n\n }\n }\n</script>\n\n```","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.media.animation-view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/animation-view.html)\n- [插件市场](https://ext.dcloud.net.cn/plugin?id=10674)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=animation-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=animation-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=animation-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=animation-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=animation-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=animation-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=animation-view&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)\n"},"map":{"name":"## map","description":"地图","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| longitude | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 中心经度 |\n| latitude | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 中心纬度 |\n| scale | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 缩放级别,取值范围为5-18 |\n| markers | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 标记点 |\n| covers | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 即将移除,请使用 markers |\n| polyline | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 路线 |\n| circles | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 圆 |\n| controls | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 控件 |\n| include-points | array | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 缩放视野以包含所有给定的坐标点 |\n| show-location | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 显示带有方向的当前定位点 |\n| @markertap | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击标记点时触发 |\n| @callouttap | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击标记点对应的气泡时触发 |\n| @controltap | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击控件时触发 |\n| @regionchange | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 视野发生变化时触发 |\n| @updated | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 在地图渲染更新完成时触发 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/map/map.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/map/map\n>Template\n```vue\n<template>\n <view class=\"content\">\n <map class=\"map\" id=\"map1\" ref=\"map1\" :longitude=\"location.longitude\" :latitude=\"location.latitude\" :scale=\"scale\" :markers=\"markers\" :include-points=\"includePoints\" :polyline=\"polyline\" :polygons=\"polygons\" :circles=\"circles\" :controls=\"controls\" :show-location=\"showLocation\"\n :enable-3D=\"enable3D\" :rotate=\"rotate\" :skew=\"skew\"\n :show-compass=\"showCompass\" :enable-overlooking=\"enableOverlooking\" :enable-zoom=\"enableZoom\"\n :enable-scroll=\"enableScroll\" :enable-rotate=\"enableRotate\" :enable-satellite=\"enableSatellite\"\n :enable-traffic=\"enableTraffic\"\n @markertap=\"onmarkertap\" @callouttap=\"oncallouttap\" @controltap=\"oncontroltap\" @regionchange=\"onregionchange\" @tap=\"maptap\"\n @updated=\"onupdated\" @poitap=\"onpoitap\"></map>\n <scroll-view class=\"scrollview\" scroll-y=\"true\">\n <view class=\"uni-title\">\n <text class=\"uni-title-text\">属性示例</text>\n </View>\n <input-data defaultValue=\"13\" title=\"scale: 缩放级别,取值范围为5-18\" type=\"number\" @confirm=\"confirm_scale_input\"></input-data>\n <boolean-data :defaultValue=\"showLocation\" title=\"开启显示带有方向的当前定位点\" @change=\"change_show_location\"></boolean-data>\n\n <button class=\"button\" @click=\"addControls\">控件</button>\n <button class=\"button\" @click=\"addMarkers\">标记点</button>\n <button class=\"button\" @click=\"addMarkersLabel\">为标记点旁边增加标签</button>\n <button class=\"button\" @click=\"addPolyline\">路线</button>\n <button class=\"button\" @click=\"addPolygons\">多边形</button>\n <button class=\"button\" @click=\"addCircles\">圆</button>\n <button class=\"button\" @click=\"includePoint\">缩放视野以包含所有给定的坐标点</button>\n <view class=\"uni-title\">\n <text class=\"uni-title-text\">方法示例</text>\n </View>\n <button class=\"button\" @click=\"handleGetCenterLocation\">获取当前地图中心的经纬度</button>\n <button class=\"button\" @click=\"handleGetRegion\">获取当前地图的视野范围</button>\n <button class=\"button\" @click=\"handleTranslateMarker\">平移marker</button>\n <button class=\"button\" @click=\"handleMoveToLocation\">将地图中心移动到当前定位点</button>\n <button class=\"button\" @click=\"handleGetScale\">获取当前地图的缩放级别</button>\n\n </scroll-view>\n </view>\n</template>\n\n\n\n<style>\n .content {\n flex: 1;\n }\n\n .map {\n width: 100%;\n height: 300px;\n background-color: #f0f0f0;\n }\n\n .scrollview {\n flex: 1;\n padding: 10px;\n }\n\n .list-item {\n flex-direction: row;\n flex-wrap: nowrap;\n align-items: center;\n padding: 5px 0px;\n }\n\n .list-text {\n flex: 1;\n }\n\n .button {\n margin-top: 5px;\n margin-bottom: 5px;\n }\n</style>\n\n```\n>Script\n```uts\n\n type Anchor = {\n x : number,\n y : number\n }\n\n type Callout = {\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 type Label = {\n content : string,\n color : string,\n fontSize : number,\n x : number,\n y : number,\n borderColor: string\n borderWidth : number,\n borderRadius: number,\n bgColor : string,\n padding:number\n }\n\n type Markers = {\n id : number,\n latitude : number,\n longitude : number,\n title ?: string,\n iconPath : string,\n zIndex ?: string,\n rotate ?: number,\n width ?: number,\n height ?: number,\n label?:Label,\n anchor ?: Anchor,\n callout ?: Callout\n }\n\n type Points = {\n latitude : number,\n longitude : number\n }\n\n type Polyline = {\n points : Points[],\n color : string,\n width : number,\n dottedLine : boolean,\n arrowLine : boolean,\n borderColor : string,\n borderWidth : number\n }\n\n type Polygons = {\n points : Points[];\n fillColor : string;\n strokeWidth : number;\n strokeColor : string;\n zIndex : number;\n }\n\n type Circles = {\n latitude : number;\n longitude : number;\n radius : number;\n strokeWidth : number;\n color : string;\n fillColor : string;\n }\n\n type PositionType = {\n \tleft: number,\n \ttop: number,\n \twidth: number,\n \theight: number\n }\n\n type ControlsType = {\n \tid?: number;\n \tposition: PositionType;\n iconPath:string;\n \tclickable?: boolean;\n }\n\n type TypeJestResult = {\n translateMarkerMsg:string,\n animationEnd:boolean,\n centerPoints: Points,\n southwest: Points,\n northeast: Points,\n moveToLocationMsg:string,\n scale:number\n }\n\n const testMarkers = [{\n id: 0,\n latitude: 39.989631,\n longitude: 116.481018,\n title: '方恒国际 阜通东大街6号',\n zIndex: '1',\n iconPath: '../../../static/location.png',\n rotate: 0,\n width: 20,\n height: 20,\n anchor: {\n x: 0.5,\n y: 1\n },\n callout: {\n content: '方恒国际 阜通东大街6号',\n color: '#00BFFF',\n fontSize: 10,\n borderRadius: 4,\n borderWidth: 1,\n borderColor: '#333300',\n bgColor: '#CCFF99',\n padding: 5,\n display: 'ALWAYS'\n }\n },\n {\n id: 1,\n latitude: 39.9086920000,\n longitude: 116.3974770000,\n title: '天安门',\n zIndex: '1',\n iconPath: '../../../static/location.png',\n width: 40,\n height: 40,\n anchor: {\n x: 0.5,\n y: 1\n },\n callout: {\n content: '首都北京\\n天安门',\n color: '#00BFFF',\n fontSize: 12,\n borderRadius:10,\n borderWidth: 2,\n borderColor: '#333300',\n bgColor: '#CCFF11',\n padding: 5,\n display: 'ALWAYS'\n }\n }\n ];\n\n\n const testPolyline = [{\n points: [{\n latitude: 39.925539,\n longitude: 116.279037\n },\n {\n latitude: 39.925539,\n longitude: 116.520285\n }],\n color: '#FFCCFF',\n width:7,\n dottedLine: true,\n arrowLine: true,\n borderColor: '#000000',\n borderWidth: 2\n },\n {\n points: [{\n latitude: 39.938698,\n longitude: 116.275177\n },\n {\n latitude: 39.966069,\n longitude: 116.289253\n },\n {\n latitude: 39.944226,\n longitude: 116.306076\n },\n {\n latitude: 39.966069,\n longitude: 116.322899\n },\n {\n latitude: 39.938698,\n longitude: 116.336975\n }],\n color: '#CCFFFF',\n width: 5,\n dottedLine: false,\n arrowLine: true,\n borderColor: '#CC0000',\n borderWidth: 3\n }\n ];\n\n const testPolygons = [{\n points: [{\n latitude: 39.781892,\n longitude: 116.293413\n },\n {\n latitude: 39.787600,\n longitude: 116.391842\n },\n {\n latitude: 39.733187,\n longitude: 116.417932\n },\n {\n latitude: 39.704653,\n longitude: 116.338255\n }],\n fillColor: '#FFCCFF',\n strokeWidth: 3,\n strokeColor: '#CC99CC',\n zIndex: 11\n },\n {\n points: [{\n latitude: 39.887600,\n longitude: 116.518932\n },\n {\n latitude: 39.781892,\n longitude: 116.518932\n },\n {\n latitude: 39.781892,\n longitude: 116.428932\n },\n {\n latitude: 39.887600,\n longitude: 116.428932\n }\n ],\n fillColor: '#CCFFFF',\n strokeWidth: 5,\n strokeColor: '#CC0000',\n zIndex: 3\n }\n ];\n\n const testCircles = [{\n latitude: 39.996441,\n longitude: 116.411146,\n radius: 15000,\n strokeWidth: 5,\n color: '#CCFFFF',\n fillColor: '#CC0000'\n },\n {\n latitude: 40.096441,\n longitude: 116.511146,\n radius: 12000,\n strokeWidth: 3,\n color: '#CCFFFF',\n fillColor: '#FFCCFF'\n },\n {\n latitude: 39.896441,\n longitude: 116.311146,\n radius: 9000,\n strokeWidth: 1,\n color: '#CCFFFF',\n fillColor: '#CC0000'\n }\n ];\n\n const testIncludePoints = [{\n latitude: 39.989631,\n longitude: 116.481018,\n },\n {\n latitude: 39.9086920000,\n longitude: 116.3974770000,\n }\n ];\n\n\n const map = ref(null as MapContext | null);\n const location = ref({ longitude: 116.39742, latitude: 39.909 });\n const rotate = ref(0);\n const skew = ref(0);\n // 自动化测试\n const autoTest = ref(false);\n const updateAutoTest = (value: boolean) => {\n autoTest.value = value\n }\n\n\n const jestResult = reactive({\n translateMarkerMsg:\"\",\n animationEnd:false,\n centerPoints: {\n latitude : 0,\n longitude : 0\n },\n southwest: {\n latitude : 0,\n longitude : 0\n },\n northeast: {\n latitude : 0,\n longitude : 0\n },\n moveToLocationMsg:\"\",\n scale:0,\n } as TypeJestResult);\n\n\n onReady(() => {\n map.value = uni.createMapContext(\"map1\", getCurrentInstance()!.proxy!)\n });\n\n const scale = ref(13);\n const confirm_scale_input = (value: number) => {\n scale.value = value\n };\n\n const controls = ref([]as ControlsType[]);\n const addControls = () => {\n controls.value.push({\n id: 1,\n position: {\n left: 5,\n top: 180,\n width: 30,\n height: 30\n },\n iconPath: '../../../static/uni.png',\n clickable: true\n })\n }\n\n const showLocation = ref(false);\n const change_show_location = (checked : boolean)=>{\n showLocation.value = checked\n }\n\n const includePoints = ref([] as Points[]);\n const includePoint = () => {\n includePoints.value = testIncludePoints;\n };\n\n\n const markers = reactive([] as Markers[]);\n const addMarkers = () => {\n markers.push(...testMarkers);\n };\n\n const addMarkersLabel = () => {\n markers.forEach((marker, index) => {\n marker.label = {\n content: 'Hello Label'+ (index + 1),\n color: '#aa00ff',\n fontSize: 12,\n x: 5,\n y: 0,\n borderColor:'#333300',\n borderWidth:2,\n borderRadius: 20,\n bgColor: '#aaffff',\n padding: 10\n };\n });\n };\n\n\n const polyline = ref([] as Polyline[]);\n const addPolyline = () => {\n scale.value = 12;\n polyline.value = testPolyline;\n };\n\n\n const polygons = ref([] as Polygons[]);\n const addPolygons = () => {\n scale.value = 10;\n polygons.value = testPolygons;\n };\n\n\n const circles = ref([] as Circles[]);\n const addCircles = () => {\n scale.value = 10;\n circles.value = testCircles;\n };\n\n const showCompass = ref(true);\n const enable3D = ref(true);\n const enableOverlooking = ref(true);\n const enableZoom = ref(true);\n const enableScroll = ref(true);\n const enableRotate = ref(true);\n const enableSatellite = ref(false);\n const enableTraffic = ref(false);\n\n const enableThreeD = (e)=>{\n enable3D.value = e.detail.value;\n }\n const changeShowCompass = (e)=>{\n showCompass.value = e.detail.value;\n }\n const changeEnableOverlooking = (e) => {\n enableOverlooking.value = e.detail.value;\n };\n\n const changeEnableZoom = (e) => {\n enableZoom.value = e.detail.value;\n };\n\n const changeEnableScroll = (e) => {\n enableScroll.value = e.detail.value;\n };\n\n const changeEnableRotate = (e) => {\n enableRotate.value = e.detail.value;\n };\n\n const changeEnableSatellite = (e) => {\n enableSatellite.value = e.detail.value;\n };\n\n const changeEnableTraffic = (e) => {\n enableTraffic.value = e.detail.value;\n };\n\n\n const handleGetCenterLocation = () => {\n if (map.value) {\n map.value.getCenterLocation({\n success: ret => {\n // console.log('getCenterLocation',ret);\n jestResult.centerPoints = ret;\n if(!autoTest.value){\n uni.showModal({\n content: JSON.stringify(ret)\n });\n }\n }\n });\n }\n };\n\n const handleGetRegion = () => {\n if (map.value) {\n map.value.getRegion({\n success: ret => {\n // console.log('getRegion',JSON.stringify(ret));\n jestResult.southwest = ret.southwest;\n jestResult.northeast = ret.northeast\n if(!autoTest.value){\n uni.showModal({\n content: JSON.stringify(ret)\n });\n }\n }\n });\n }\n };\n\n\n const handleTranslateMarker = () => {\n if (map.value) {\n map.value.translateMarker({\n markerId: 1,\n destination: {\n latitude: 39.989631,\n longitude: 116.481018\n },\n autoRotate:true,\n rotate:10,\n duration: 2000,\n animationEnd: () => {\n // console.log('动画结束');\n jestResult.animationEnd = true;\n },\n success: ret => {\n // console.log('handleTranslateMarker',JSON.stringify(ret));\n jestResult.translateMarkerMsg = ret.errMsg;\n },\n fail: error => {\n console.log(error)\n }\n });\n }\n };\n\n\n const handleGetScale = () => {\n if (map.value) {\n map.value.getScale({\n success: res => {\n // console.log('getScale',res);\n scale.value = res.scale\n jestResult.scale = res.scale\n if(!autoTest.value){\n uni.showModal({\n content: '当前地图的缩放级别为:'+ res.scale\n });\n }\n },\n fail: error => {\n console.log(error)\n },\n });\n }\n };\n\n const handleMoveToLocation = () => {\n if (map.value) {\n map.value.moveToLocation({\n latitude: 39.909,\n longitude: 116.39742,\n success: res => {\n // console.log('moveToLocation',res);\n jestResult.moveToLocationMsg = res.errMsg;\n if(!autoTest.value){\n uni.showModal({\n content: JSON.stringify(res)\n });\n }\n },\n fail: error => {\n console.log(error)\n }\n });\n }\n };\n\n const maptap = (e:UniEvent) => {\n // console.log('点击地图时触发',e)\n uni.showModal({\n content: JSON.stringify(e)\n });\n };\n\n const onmarkertap = (e:UniEvent) => {\n // console.log('点击标记点时触发',e)\n uni.showModal({\n content: JSON.stringify(e)\n });\n };\n\n const oncontroltap = (e:UniEvent) => {\n // console.log('点击控件时触发',e)\n uni.showModal({\n content: JSON.stringify(e)\n });\n };\n\n const oncallouttap = (e:UniEvent) => {\n // console.log('点击标记点对应的气泡时触发',e)\n uni.showModal({\n content: JSON.stringify(e)\n });\n };\n\n const onupdated = (e:UniEvent) => {\n console.log('在地图渲染更新完成时触发',e)\n };\n\n const onregionchange = (e:UniEvent) => {\n console.log('视野发生变化时触发',e)\n };\n\n const onpoitap = (e:UniEvent) => {\n // console.log('点击地图poi点时触发',e)\n uni.showModal({\n content: JSON.stringify(e)\n });\n };\n\n defineExpose({\n jestResult,\n autoTest,\n updateAutoTest,\n addControls,\n addMarkers,\n addMarkersLabel,\n addPolyline,\n addPolygons,\n addCircles,\n includePoint,\n handleGetCenterLocation,\n handleGetRegion,\n handleTranslateMarker,\n handleMoveToLocation,\n handleGetScale\n })\n\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.map.map)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/map.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=map&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=map&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=map&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=map&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=map&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=map)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=map&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)\n"},"canvas":{"name":"## canvas","description":"> 组件类型:[UniCanvasElement](#unicanvaselement) \n\n 画布","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n","attribute":"","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/canvas/canvas.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/canvas/canvas\n>Template\n```vue\n<template>\r\n <view class=\"page\" id=\"page-canvas\">\r\n <canvas id=\"canvas\" class=\"canvas-element\"></canvas>\r\n <scroll-view class=\"scroll-view\">\r\n <view class=\"grid-view\">\r\n <view class=\"grid-item\" v-for=\"(name, index) in names\" :key=\"index\">\r\n <button class=\"canvas-drawing-button\" @click=\"handleCanvasButton(name)\">{{name}}</button>\r\n </view>\r\n </view>\r\n </scroll-view>\r\n </view>\r\n</template>\r\n\r\n\r\n\r\n<style>\r\n .page {\r\n flex: 1;\r\n height: 100%;\r\n overflow: hidden;\r\n }\r\n\r\n .scroll-view {\r\n flex: 1;\r\n padding-bottom: 50px;\r\n }\r\n\r\n .canvas-element {\r\n width: 100%;\r\n height: 250px;\r\n background-color: #ffffff;\r\n }\r\n\r\n .grid-view {\r\n padding: 10px;\r\n flex-direction: row;\r\n flex-wrap: wrap;\r\n }\r\n\r\n .grid-item {\r\n width: 50%;\r\n padding: 5px;\r\n }\r\n\r\n .btn-to-image {\r\n margin: 10px;\r\n }\r\n</style>\n\n```\n>Script\n```uts\n\r\n function hidpi(canvas : UniCanvasElement) {\r\n const context = canvas.getContext(\"2d\")!;\r\n const dpr = uni.getDeviceInfo().devicePixelRatio ?? 1;\r\n canvas.width = canvas.offsetWidth * dpr;\r\n canvas.height = canvas.offsetHeight * dpr;\r\n context.scale(dpr, dpr);\r\n }\r\n\r\n export default {\r\n data() {\r\n const API_PATH = [\"arc\", \"arcTo\", \"bezierCurveTo\", \"quadraticCurve\", \"moveTo\", \"lineTo\", \"rect\", \"clip\", \"pattern\"]\r\n const API_DRAW = [\"stroke\", \"strokeRect\", \"strokeText\", \"fill\", \"fillRect\", \"fillText\", \"drawImage\", \"drawImageLocal\", \"clearRect\"]\r\n const API_STATE = [\"beginPath\", \"closePath\", \"restore\", \"reset\", \"setTransform\", \"transform\", \"rotate\", \"resetTransform\", \"save\", \"scale\", \"translate\"]\r\n const API_PROPERTIES = [\"setLineCap\", \"setLineJoin\", \"setLineWidth\", \"setMiterLimit\", \"setFillStyle\", \"setStrokeStyle\", \"setGlobalAlpha\", \"lineDash\", \"linearGradient\", \"radialGradient\", \"textAlign\"]\r\n return {\r\n title: 'Context2D',\r\n names: [...API_PATH, ...API_DRAW, ...API_STATE, ...API_PROPERTIES, \"measureText\"] as string[],\r\n canvasContext: null as CanvasRenderingContext2D | null,\r\n canvasWidth: 0,\r\n canvasHeight: 0,\r\n image: null as Image | null,\r\n // 仅测试\r\n testToBlobResult: false,\r\n testToDataURLResult: false\r\n }\r\n },\r\n onReady() {\r\n let canvas = uni.getElementById(\"canvas\") as UniCanvasElement\r\n this.canvasContext = canvas.getContext(\"2d\");\r\n hidpi(canvas);\r\n this.canvasWidth = this.canvasContext!.canvas.width;\r\n this.canvasHeight = this.canvasContext!.canvas.height;\r\n\r\n // #ifdef WEB\r\n canvas.toBlob((blob : Blob) => {\r\n this.testToBlobResult = (blob.size > 0 && blob.type == 'image/jpeg')\r\n }, 'image/jpeg', 0.95)\r\n this.testToDataURLResult = canvas.toDataURL().startsWith('data:image/png;base64')\r\n // #endif\r\n },\r\n methods: {\r\n handleCanvasButton(name : string) {\r\n switch (name) {\r\n case \"arc\":\r\n this.arc();\r\n break;\r\n case \"arcTo\":\r\n this.arcTo();\r\n break;\r\n case \"beginPath\":\r\n this.beginPath();\r\n break;\r\n case \"bezierCurveTo\":\r\n this.bezierCurveTo();\r\n break;\r\n case \"clearRect\":\r\n this.clearRect();\r\n break;\r\n case \"clip\":\r\n this.clip();\r\n break;\r\n case \"closePath\":\r\n this.closePath();\r\n break;\r\n case \"pattern\":\r\n this.pattern()\r\n break;\r\n case \"linearGradient\":\r\n this.createLinearGradient();\r\n break;\r\n case \"radialGradient\":\r\n this.createRadialGradient();\r\n break;\r\n case \"fill\":\r\n this.fill();\r\n break;\r\n case \"fillRect\":\r\n this.fillRect();\r\n break;\r\n case \"fillText\":\r\n this.fillText();\r\n break;\r\n case \"lineTo\":\r\n this.lineTo();\r\n break;\r\n case \"moveTo\":\r\n this.moveTo();\r\n break;\r\n case \"quadraticCurve\":\r\n this.quadraticCurveTo();\r\n break;\r\n case \"rect\":\r\n this.rect();\r\n break;\r\n case \"reset\":\r\n this.reset();\r\n break;\r\n case \"resetTransform\":\r\n this.resetTransform();\r\n break;\r\n case \"restore\":\r\n this.restore();\r\n break;\r\n case \"rotate\":\r\n this.rotate();\r\n break;\r\n case \"save\":\r\n this.save();\r\n break;\r\n case \"scale\":\r\n this.scale();\r\n break;\r\n case \"setTransform\":\r\n this.setTransform();\r\n break;\r\n case \"stroke\":\r\n this.stroke();\r\n break;\r\n case \"strokeRect\":\r\n this.strokeRect();\r\n break;\r\n case \"strokeText\":\r\n this.strokeText();\r\n break;\r\n case \"transform\":\r\n this.transform();\r\n break;\r\n case \"translate\":\r\n this.translate();\r\n break;\r\n case \"drawImageLocal\":\r\n this.drawImageLocal()\r\n break;\r\n case \"drawImage\":\r\n this.drawImage();\r\n break;\r\n case \"measureText\":\r\n this.measureText();\r\n break;\r\n case \"setFillStyle\":\r\n this.setFillStyle();\r\n break;\r\n case \"setStrokeStyle\":\r\n this.setStrokeStyle();\r\n break;\r\n case \"setGlobalAlpha\":\r\n this.setGlobalAlpha();\r\n break;\r\n case \"setFontSize\":\r\n this.setFontSize();\r\n break;\r\n case \"setLineCap\":\r\n this.setLineCap();\r\n break;\r\n case \"setLineJoin\":\r\n this.setLineJoin();\r\n break;\r\n case \"lineDash\":\r\n this.lineDash();\r\n break;\r\n case \"setLineWidth\":\r\n this.setLineWidth();\r\n break;\r\n case \"setMiterLimit\":\r\n this.setMiterLimit();\r\n break;\r\n case \"textAlign\":\r\n this.textAlign();\r\n default:\r\n break;\r\n }\r\n },\r\n arc() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.lineWidth = 2\r\n context.arc(75, 75, 50, 0, Math.PI * 2, true)\r\n context.moveTo(110, 75)\r\n context.arc(75, 75, 35, 0, Math.PI, false)\r\n context.moveTo(65, 65)\r\n context.arc(60, 65, 5, 0, Math.PI * 2, true)\r\n context.moveTo(95, 65)\r\n context.arc(90, 65, 5, 0, Math.PI * 2, true)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n arcTo() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.moveTo(150, 20)\r\n context.arcTo(150, 100, 50, 20, 30)\r\n context.stroke()\r\n\r\n context.fillStyle = \"blue\"\r\n // base point\r\n context.fillRect(150, 20, 10, 10)\r\n\r\n context.fillStyle = \"red\"\r\n // control point one\r\n context.fillRect(150, 100, 10, 10)\r\n // control point two\r\n context.fillRect(50, 20, 10, 10)\r\n //\r\n context.setLineDash([5, 5])\r\n context.moveTo(150, 20)\r\n context.lineTo(150, 100)\r\n context.lineTo(50, 20)\r\n context.stroke()\r\n context.beginPath()\r\n context.arc(120, 38, 30, 0, 2 * Math.PI, true)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n beginPath() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // First path\r\n context.beginPath()\r\n context.strokeStyle = \"blue\"\r\n context.moveTo(20, 20)\r\n context.lineTo(200, 20)\r\n context.stroke()\r\n\r\n // Second path\r\n context.beginPath()\r\n context.strokeStyle = \"green\"\r\n context.moveTo(20, 20)\r\n context.lineTo(120, 120)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n textAlign() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.moveTo(150, 0)\r\n context.lineTo(150, 150)\r\n context.stroke()\r\n\r\n context.font = \"30px serif\"\r\n\r\n context.textAlign = \"left\"\r\n context.fillText(\"left-aligned\", 150, 40)\r\n\r\n context.textAlign = \"center\"\r\n context.fillText(\"center-aligned\", 150, 85)\r\n\r\n context.textAlign = \"right\"\r\n context.fillText(\"right-aligned\", 150, 130)\r\n\r\n context.restore()\r\n },\r\n bezierCurveTo() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.moveTo(50, 20)\r\n context.bezierCurveTo(230, 30, 150, 60, 50, 100)\r\n context.stroke()\r\n\r\n context.fillStyle = \"blue\"\r\n // start point\r\n context.fillRect(50, 20, 10, 10)\r\n // end point\r\n context.fillRect(50, 100, 10, 10)\r\n\r\n context.fillStyle = \"red\"\r\n // control point one\r\n context.fillRect(230, 30, 10, 10)\r\n // control point two\r\n context.fillRect(150, 70, 10, 10)\r\n\r\n context.restore()\r\n },\r\n clearRect() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // 绘制黄色背景\r\n context.beginPath()\r\n context.fillStyle = \"#ff6\"\r\n context.fillRect(0, 0, 300, 150)\r\n\r\n // 绘制蓝色三角形\r\n context.beginPath()\r\n context.fillStyle = \"blue\"\r\n context.moveTo(20, 20)\r\n context.lineTo(180, 20)\r\n context.lineTo(130, 130)\r\n context.closePath()\r\n context.fill()\r\n\r\n // 清除一部分画布\r\n context.clearRect(10, 10, 120, 100)\r\n\r\n context.restore()\r\n },\r\n clip() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Create circular clipping region\r\n context.beginPath();\r\n context.arc(100, 75, 50, 0, Math.PI * 2, true)\r\n context.clip()\r\n\r\n // Draw stuff that gets clipped\r\n context.fillStyle = \"blue\"\r\n context.fillRect(0, 0, 300, 150)\r\n context.fillStyle = \"orange\"\r\n context.fillRect(0, 0, 100, 100)\r\n\r\n context.restore()\r\n },\r\n closePath() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.lineWidth = 10\r\n context.moveTo(20, 20)\r\n context.lineTo(20, 100)\r\n context.lineTo(70, 100)\r\n context.closePath()\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n pattern() {\r\n const context = this.canvasContext!\r\n\r\n this.image = new Image(100, 100)\r\n this.image!.src = 'https://web-ext-storage.dcloud.net.cn/uni-app-x/hello-uniappx-qrcode.png';\r\n // this.image!.src = 'https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern/canvas_createpattern.png';\r\n // Only use the image after it's loaded\r\n this.image!.onload = () => {\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n const pattern = context.createPattern(this.image!, \"repeat\")\r\n context.fillStyle = pattern\r\n context.fillRect(0, 0, 64, 64)\r\n context.restore()\r\n };\r\n },\r\n createLinearGradient() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Create a linear gradient\r\n // The start gradient point is at x=20, y=0\r\n // The end gradient point is at x=220, y=0\r\n const gradient = context.createLinearGradient(20, 0, 220, 0)\r\n\r\n // Add three color stops\r\n gradient.addColorStop(0, \"green\")\r\n gradient.addColorStop(0.5, \"cyan\")\r\n gradient.addColorStop(1, \"green\")\r\n\r\n // Set the fill style and draw a rectangle\r\n context.fillStyle = gradient\r\n context.fillRect(20, 20, 200, 100)\r\n\r\n context.restore()\r\n },\r\n createRadialGradient() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Create a radial gradient\r\n // The inner circle is at x=110, y=90, with radius=30\r\n // The outer circle is at x=100, y=100, with radius=70\r\n const gradient = context.createRadialGradient(110, 90, 30, 100, 100, 70)\r\n\r\n // Add three color stops\r\n gradient.addColorStop(0, \"pink\")\r\n gradient.addColorStop(0.9, \"white\")\r\n gradient.addColorStop(1, \"green\")\r\n\r\n // Set the fill style and draw a rectangle\r\n context.fillStyle = gradient\r\n context.fillRect(20, 20, 160, 160)\r\n\r\n context.restore()\r\n },\r\n fill() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.rect(20, 20, 150, 100)\r\n context.strokeStyle = '#00ff00'\r\n context.fill()\r\n\r\n context.restore()\r\n },\r\n fillRect() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.fillStyle = \"green\"\r\n context.fillRect(20, 10, 150, 100)\r\n\r\n context.restore()\r\n },\r\n fillText() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n console.log(\"fillText\")\r\n context.strokeStyle = '#ff0000'\r\n\r\n context.beginPath()\r\n context.moveTo(0, 10)\r\n context.lineTo(300, 10)\r\n context.stroke()\r\n // context.save()\r\n // context.scale(1.5, 1.5)\r\n // context.translate(20, 20)\r\n // context.setFontSize(10)\r\n context.fillText('Hello World', 0, 30, 300)\r\n // context.setFontSize(20)\r\n context.fillText('Hello World', 100, 30, 300)\r\n\r\n // context.restore()\r\n\r\n context.beginPath()\r\n context.moveTo(0, 30)\r\n context.lineTo(300, 30)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n moveTo() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.moveTo(0, 0)\r\n context.lineTo(300, 150)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n lineTo() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.moveTo(20, 20)\r\n context.lineTo(20, 100)\r\n context.lineTo(70, 100)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n stroke() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.moveTo(20, 20)\r\n context.lineTo(20, 100)\r\n context.lineTo(70, 100)\r\n context.strokeStyle = '#00ff00'\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n strokeRect() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.strokeStyle = \"green\"\r\n context.strokeRect(20, 10, 160, 100)\r\n\r\n context.restore()\r\n },\r\n strokeText() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.font = \"10px serif\"\r\n context.strokeText(\"Hello world\", 50, 90)\r\n\r\n context.font = \"30px serif\"\r\n context.strokeStyle = \"blue\"\r\n context.strokeText(\"Hello world\", 50, 100)\r\n\r\n context.restore()\r\n },\r\n setTransform() {\r\n },\r\n rotate() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Point of transform origin\r\n context.arc(0, 0, 5, 0, 2 * Math.PI, true)\r\n context.fillStyle = \"blue\"\r\n context.fill()\r\n\r\n // Non-rotated rectangle\r\n context.fillStyle = \"gray\"\r\n context.fillRect(100, 0, 80, 20)\r\n // Rotated rectangle\r\n context.rotate((45 * Math.PI) / 180)\r\n context.fillStyle = \"red\"\r\n context.fillRect(100, 0, 80, 20)\r\n\r\n // Reset transformation matrix to the identity matrix\r\n context.setTransform(1, 0, 0, 1, 0, 0)\r\n\r\n context.restore()\r\n },\r\n scale() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Scaled rectangle\r\n context.scale(9, 3)\r\n context.fillStyle = \"red\"\r\n context.fillRect(10, 10, 8, 20)\r\n\r\n // Reset current transformation matrix to the identity matrix\r\n context.setTransform(1, 0, 0, 1, 0, 0)\r\n\r\n // Non-scaled rectangle\r\n context.fillStyle = \"gray\"\r\n context.fillRect(10, 10, 8, 20)\r\n\r\n context.restore()\r\n },\r\n reset() {\r\n const context = this.canvasContext!\r\n\r\n // Set line width\r\n context.lineWidth = 10\r\n context.strokeStyle = '#00ff00'\r\n // Stroke rect outline\r\n context.strokeRect(50, 50, 150, 100)\r\n\r\n // Create filled text\r\n context.font = \"50px serif\";\r\n context.fillText(\"Rect!\", 70, 110)\r\n\r\n\r\n context.lineWidth = 5\r\n\r\n // Stroke out circle\r\n context.beginPath();\r\n context.arc(300, 100, 50, 0, 2 * Math.PI)\r\n context.stroke();\r\n\r\n // Create filled text\r\n context.font = \"25px sans-serif\"\r\n context.fillText(\"Circle!\", 265, 100)\r\n context.reset()\r\n\r\n hidpi(uni.getElementById(\"canvas\") as UniCanvasElement)\r\n },\r\n translate() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Moved square\r\n context.translate(110, 30)\r\n context.fillStyle = \"red\"\r\n context.fillRect(0, 0, 80, 80)\r\n\r\n // Reset current transformation matrix to the identity matrix\r\n context.setTransform(1, 0, 0, 1, 0, 0)\r\n\r\n // Unmoved square\r\n context.fillStyle = \"gray\"\r\n context.fillRect(0, 0, 80, 80)\r\n\r\n context.restore()\r\n },\r\n save() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.beginPath()\r\n context.strokeStyle = '#00ff00'\r\n context.scale(2, 2)\r\n context.strokeStyle = '#ff0000'\r\n context.rect(0, 0, 100, 100)\r\n context.stroke()\r\n context.restore()\r\n\r\n context.save()\r\n context.rect(0, 0, 50, 50)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n restore() {\r\n const context = this.canvasContext!;\r\n [3, 2, 1].forEach((item) => {\r\n context.save()\r\n context.beginPath()\r\n context.scale(item, item)\r\n context.rect(10, 10, 100, 100)\r\n context.stroke()\r\n context.restore()\r\n })\r\n },\r\n drawImageLocal() {\r\n const context = this.canvasContext!\r\n\r\n let image = new Image(100, 100)\r\n image.src = '../../static/1.jpg'\r\n image.onload = () => {\r\n context.drawImage(image, 0, 0, 100, 100)\r\n }\r\n },\r\n drawImage() {\r\n const context = this.canvasContext!\r\n\r\n let image = new Image(100, 100);\r\n image.src = 'https://web-ext-storage.dcloud.net.cn/uni-app-x/hello-uniappx-qrcode.png'\r\n image.onload = () => {\r\n context.drawImage(image, 0, 0, 100, 100)\r\n uni.getElementById(\"page-canvas\")?.appendChild(image)\r\n }\r\n },\r\n rect() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.beginPath()\r\n context.rect(20, 20, 150, 100)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n quadraticCurveTo() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Quadratic Bézier curve\r\n context.beginPath()\r\n context.moveTo(50, 20)\r\n context.quadraticCurveTo(230, 30, 50, 100)\r\n context.stroke()\r\n\r\n // Start and end points\r\n context.fillStyle = \"blue\"\r\n context.beginPath()\r\n context.arc(50, 20, 5, 0, 2 * Math.PI, true) // Start point\r\n context.arc(50, 100, 5, 0, 2 * Math.PI, true) // End point\r\n context.fill();\r\n\r\n // Control point\r\n context.fillStyle = \"red\"\r\n context.beginPath()\r\n context.arc(230, 30, 5, 0, 2 * Math.PI, true)\r\n context.fill()\r\n\r\n context.restore()\r\n },\r\n resetTransform() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n // Draw a rotated rectangle\r\n context.rotate((45 * Math.PI) / 180)\r\n context.fillRect(60, 0, 100, 30)\r\n\r\n // Reset transformation matrix to the identity matrix\r\n context.resetTransform()\r\n context.fillStyle = \"red\"\r\n context.fillRect(60, 0, 100, 30)\r\n\r\n context.restore()\r\n },\r\n transform() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.transform(1, 0.2, 0.8, 1, 0, 0)\r\n context.fillRect(0, 0, 100, 100)\r\n\r\n context.restore()\r\n },\r\n setFillStyle() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\r\n ['#fef957', 'rgb(242,159,63)', 'rgb(242,117,63)', '#e87e51'].forEach((item : string, index : number) => {\r\n context.fillStyle = item\r\n context.beginPath()\r\n context.rect(0 + 75 * index, 0, 50, 50)\r\n context.fill()\r\n })\r\n\r\n context.restore()\r\n },\r\n setStrokeStyle() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\r\n ['#fef957', 'rgb(242,159,63)', 'rgb(242,117,63)', '#e87e51'].forEach((item : string, index : number) => {\r\n context.strokeStyle = item\r\n context.beginPath()\r\n context.rect(0 + 75 * index, 0, 50, 50)\r\n context.stroke()\r\n })\r\n\r\n context.restore()\r\n },\r\n setGlobalAlpha() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.fillStyle = '#000000';\r\n [1, 0.5, 0.1].forEach((item : number, index : number) => {\r\n context.globalAlpha = item\r\n context.beginPath()\r\n context.rect(0 + 75 * index, 0, 50, 50)\r\n context.fill()\r\n })\r\n context.globalAlpha = 1\r\n\r\n context.restore()\r\n },\r\n setFontSize() {\r\n const context = this.canvasContext!\r\n\r\n context.save();\r\n [10, 20, 30, 40].forEach((item : number, index : number) => {\r\n // context.fontSize(item)\r\n context.fillText('Hello, world', 20, 20 + 40 * index)\r\n })\r\n\r\n context.restore()\r\n },\r\n setLineCap() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.lineWidth = 10;\r\n ['butt', 'round', 'square'].forEach((item : string, index : number) => {\r\n context.beginPath()\r\n context.lineCap = item\r\n context.moveTo(20, 20 + 20 * index)\r\n context.lineTo(100, 20 + 20 * index)\r\n context.stroke()\r\n })\r\n\r\n context.restore()\r\n },\r\n setLineJoin() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.lineWidth = 10;\r\n ['bevel', 'round', 'miter'].forEach((item : string, index : number) => {\r\n context.beginPath()\r\n context.lineJoin = item\r\n context.moveTo(20 + 80 * index, 20)\r\n context.lineTo(100 + 80 * index, 50)\r\n context.lineTo(20 + 80 * index, 100)\r\n context.stroke()\r\n })\r\n\r\n context.restore()\r\n },\r\n setLineWidth() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\r\n [2, 4, 6, 8, 10].forEach((item : number, index : number) => {\r\n context.beginPath()\r\n context.lineWidth = item\r\n context.moveTo(20, 20 + 20 * index)\r\n context.lineTo(100, 20 + 20 * index)\r\n context.stroke()\r\n })\r\n\r\n context.restore()\r\n },\r\n lineDash() {\r\n const context = this.canvasContext!\r\n\r\n context.save();\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.setLineDash([4, 16])\r\n\r\n // Dashed line with no offset\r\n context.beginPath()\r\n context.moveTo(0, 50)\r\n context.lineTo(300, 50)\r\n context.stroke()\r\n\r\n // Dashed line with offset of 4\r\n context.beginPath()\r\n context.strokeStyle = \"red\"\r\n context.lineDashOffset = 4\r\n context.moveTo(0, 100)\r\n context.lineTo(300, 100)\r\n context.stroke()\r\n\r\n context.restore()\r\n },\r\n setMiterLimit() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n context.lineWidth = 4;\r\n [2, 4, 6, 8, 10].forEach((item : number, index : number) => {\r\n context.beginPath()\r\n context.miterLimit = item\r\n context.moveTo(20 + 80 * index, 20)\r\n context.lineTo(100 + 80 * index, 50)\r\n context.lineTo(20 + 80 * index, 100)\r\n context.stroke()\r\n })\r\n\r\n context.restore()\r\n },\r\n measureText() {\r\n const context = this.canvasContext!\r\n\r\n context.save()\r\n context.clearRect(0, 0, this.canvasWidth, this.canvasHeight)\r\n const text = \"uni-app x,是下一代 uni-app,是一个跨平台应用开发引擎\"\r\n\r\n context.font = \"20px 宋体\"\r\n\r\n context.fillStyle = \"red\"\r\n context.fillText(text, 0, 60)\r\n const textMetrics = context.measureText(text)\r\n context.strokeText(text, 40, 100)\r\n context.fillText(\"measure text width:\" + textMetrics.width, 40, 80)\r\n\r\n context.restore()\r\n }\r\n }\r\n }\r\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.canvas.canvas)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/canvas.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=canvas&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=canvas&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=canvas&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=canvas&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=canvas&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=canvas)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=canvas&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)\n","component_type":"### UniCanvasElement\ncanvas元素对象\n#### UniCanvasElement 的属性值\n| 名称 | 类型 | 必填 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| width | number | 是 | - | Canvas宽度 |\n| height | number | 是 | - | Canvas高度 |\n#### UniCanvasElement 的方法\n##### getContext(contentType) @getcontext\n返回 Canvas 的绘图上下文\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| contentType | string | 是 | - | - | - | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [CanvasRenderingContext2D](#canvasrenderingcontext2d-values) \\| null | 否 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| canvas | [UniCanvasElement](#unicanvaselement-values) | 是 | - | - | 是对与给定上下文关联的HTMLCanvasElement对象的只读引用 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- | :-: | :- |\n@@| width | number | 是 | - | - | Canvas宽度 |\n@@| height | number | 是 | - | - | Canvas高度 |\n@@| classList | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的的 class 属性的动态集合。 |\n@@| firstChild | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的的第一个子元素,如果元素是无子元素,则返回 null。 |\n@@| lastChild | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的最后一个子元素,如果没有子元素,则返回 null。 |\n@@| parentElement | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素在 DOM 树中的父元素,如果没有父元素(如未添加到DOM树中),则返回null。 |\n@@| previousSibling | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的前一个同级元素,没有则返回null。 |\n@@| nextElementSibling | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取在 DOM 树中紧跟在其后面的同级元素,如果指定的元素为最后一个元素,则返回 null。 |\n@@| children | Array\\<[UniElement](/dom/unielement.md)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素包含的子元素的集合 |\n@@| tagName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的标签名 |\n@@| nodeName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的元素名称 |\n@@| dataset | Map\\<string, any \\| null> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取元素上自定义数据属性(data-*)的集合 |\n@@| attributes | Map\\<string, any \\| null> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取元素上所有属性元素的集合 |\n@@| style | [CSSStyleDeclaration](/dom/cssstyledeclaration.md) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取元素的CSS样式对象 |\n@@| scrollWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取可滚动元素内容的总宽度,仅scroll-view、list-view组件支持,其他组件返回视图宽度 |\n@@| scrollHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取可滚动元素内容的总高度,仅scroll-view、list-view组件支持,其他组件返回视图高度 |\n@@| scrollLeft | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 获取或修改元素滚动条到元素左边的距离像素数,仅scroll-view、list-view组件支持。其他组件返回0 |\n@@| scrollTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 获取或修改元素滚动条到元素顶部的距离像素数,仅scroll-view、list-view组件支持。其他组件返回0 |\n@@| offsetLeft | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的左边界偏移值 单位px |\n@@| offsetTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的顶部边界偏移值 单位px |\n@@| offsetWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的布局宽度,宽度包含border、padding的数据值 单位px |\n@@| offsetHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的布局高度,高度包含border、padding的数据值 单位px |\n@@| ext | Map\\<string, any \\| null> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 扩展属性 |\n@| direction | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 描述当前文本方向 |\n@| fillStyle | [CanvasGradient](#canvasgradient-values) \\| string | 是 | #000 (黑色) | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置填充颜色 |\n@| filter | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 提供模糊、灰度等过滤效果的属性。它类似于 CSS filter 属性,并且接受相同的函数 |\n@| font | string | 是 | 10px | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置字体大小 |\n@| fontStretch | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 指定绘制文本时字体如何被扩展或压缩。该属性对应于 CSS 中的 font-stretch 属性,当使用关键字时(百分比值不支持) |\n@| globalAlpha | number | 是 | 1.0 | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 用来描述在 canvas 上绘图之前,设置图形和图片透明度的属性。数值的范围从 0.0(完全透明)到 1.0(完全不透明) |\n@| globalCompositeOperation | \"\" \\| \"source-over\" \\| \"source-atop\" \\| \"source-in\" \\| \"source-out\" \\| \"destination-over\" \\| \"destination-atop\" \\| \"destination-in\" \\| \"destination-out\" \\| \"lighter\" \\| \"copy\" \\| \"xor\" | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 在绘制新形状时应用的合成操作的类型,其中 type 是用于标识要使用的合成或混合模式操作的字符串 |\n@| imageSmoothingEnabled | boolean | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 属性用于设置是否对缩放后的图片进行平滑处理,true 表示进行平滑处理(默认值),false 表示不进行 |\n@| imageSmoothingQuality | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 用于设置图像平滑度,要使此属性生效,imageSmoothingEnabled 属性必须为 true |\n@| letterSpacing | string \\| number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 用于指定绘制文本时字母之间的间距。这对应于 CSS 中的 letter-spacing 属性 |\n@| lineCap | \"\" \\| \"butt\" \\| \"round\" \\| \"square\" | 是 | butt | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 指定如何绘制每一条线条末端的属性,可选值:`butt`线段末端以方形结束;`round`线段末端以圆形结束;`square`线段末端以方形结束,但是会增加一个一半宽度的矩形区域。 |\n@| lineDashOffset | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置虚线偏移量 |\n@| lineJoin | \"\" \\| \"round\" \\| \"bevel\" \\| \"miter\" | 是 | miter | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置 2 个长度不为 0 的线条相连部分如何连接在一起的属性,可选值:`bevel`斜角;`round`圆角;`miter`尖角。 |\n@| lineWidth | number | 是 | 1px | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置线条的宽度 |\n@| miterLimit | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置斜接面限制比例的属性。当获取属性值时,会返回当前的值(默认值是10.0 )。当给属性赋值时,0、负数、 Infinity 和 NaN 都会被忽略;除此之外都会被赋予一个新值。 |\n@| shadowBlur | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 用于描述模糊效果程度,其中 0 表示没有模糊,数字越大表示模糊程度越高。这个值不对应于像素数量,并且不受当前变换矩阵的影响。默认值为 0。负数、Infinity 和 NaN 将被忽略 |\n@| shadowColor | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 描述阴影颜色,可以转换成 CSS \\<color> 值的DOMString 字符串。默认值是 fully-transparent black |\n@| shadowOffsetX | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 指定阴影在水平方向上的偏移距离。正值向右偏移,负值向左偏移。默认值为 0(无水平偏移)。Infinity 和 NaN 值将被忽略 |\n@| shadowOffsetY | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 指定阴影在垂直方向上的偏移距离。正值向右偏移,负值向左偏移。默认值为 0(无水平偏移)。Infinity 和 NaN 值将被忽略 |\n@| strokeStyle | [CanvasGradient](#canvasgradient-values) \\| string | 是 | #000 (黑色) | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置边框的颜色 |\n@| textAlign | \"\" \\| \"left\" \\| \"right\" \\| \"center\" \\| \"start\" \\| \"end\" | 是 | left | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 设置文本的对齐方式,可取值:`left`左对齐;`center`居中对齐;`right`右对齐。 |\n@| textBaseline | \"\" \\| \"top\" \\| \"hanging\" \\| \"middle\" \\| \"alphabetic\" \\| \"ideographic\" \\| \"bottom\" | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"√\",\"√\"]]}' /> | 描述绘制文本时,当前文本基线的属性 |\n@| textRendering | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.21\",\"x\",\"x\"]]}' /> | 用于在渲染文本时向渲染引擎提供应该如何优化的相关信息 |\n###### UniCanvasElement 的方法 @unicanvaselement-values \n\n###### getContext(contentType) @getcontext\n返回 Canvas 的绘图上下文\n###### getContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| contentType | string | 是 | - | - | - | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [CanvasRenderingContext2D](#canvasrenderingcontext2d-values) \\| null | 否 |\n \n\n###### takeSnapshot(options) @takesnapshot\n对当前组件进行截图,调用此方法会将当前组件(包含子节点)渲染结果导出成图片。\n成功会返回图片对应的临时文件路径,目前默认png格式\n\n###### takeSnapshot 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.03 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| options | [TakeSnapshotOptions](#takesnapshotoptions-values) | 是 | - | - | 组件截图的参数对象 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| type | string \\| null | 否 | \"file\" | - | 截图导出类型,目前仅支持 'file' 保存到临时文件目录 |\n@| format | string \\| null | 否 | \"png\" | - | 截图文件格式,目前仅支持 'png' |\n@| success | (res: [TakeSnapshotSuccess](#takesnapshotsuccess-values)) => void \\| null | 否 | - | - | 成功回调函数定义 |\n@| fail | (res: [TakeSnapshotFail](#takesnapshotfail-values)) => void \\| null | 否 | - | - | 失败回调函数定义 |\n@| complete | (res: any) => void \\| null | 否 | - | - | 完成回调函数定义 | \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) @appendchild\n将一个元素添加到指定父元素的子元素列表的末尾处。如果将被插入的元素已经存在于当前文档的文档树中,那么将会它从原先的位置移动到新的位置。\n###### appendChild 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| aChild | [UniElement](/dom/unielement.md) | 是 | - | - | 插入子元素对象 | \n\n\n###### insertBefore(newChild, refChild?) @insertbefore\n在参考元素之前插入一个拥有指定父元素的子元素。如果给定的子元素是对文档中现有元素的引用,insertBefore() 会将其从当前位置移动到新位置。\n###### insertBefore 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| newChild | [UniElement](/dom/unielement.md) | 是 | - | - | 插入子元素对象 |\n| refChild | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 已存在父元素的子元素对象 | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) \\| null | 否 |\n \n\n###### setAttribute(key, value) @setattribute\n设置指定元素上的某个属性值。如果设置的属性已经存在,则更新该属性值;否则使用指定的名称和值添加一个新的属性。\n###### setAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 |\n| value | string | 是 | - | - | 属性值域 | \n\n\n###### getAttribute(key) @getattribute\n获取元素指定的属性值,如果指定的属性不存在则返回null。\n###### getAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| string \\| null | 否 |\n \n\n###### hasAttribute(key) @hasattribute\n返回改元素是否包含有指定的属性,属性存在则返回true,否则返回false。\n###### hasAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### removeAttribute(key) @removeattribute\n从元素中删除一个属性,如果指定的属性不存在,则不做任何操作,也不会产生错误。\n###### removeAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n\n###### getBoundingClientRect() @getboundingclientrect\n获取元素的大小及其相对于窗口的位置信息。\n###### getBoundingClientRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| [DOMRect](/dom/domrect.md) |\n \n\n###### getDrawableContext() @getdrawablecontext\n获取组件的绘制对象,仅uvue页面中的 view 组件支持,其它组件不支持则返回null。\n###### getDrawableContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.11 |\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [DrawableContext](/dom/drawablecontext.md) \\| null | 否 |\n \n\n###### removeChild(aChild) @removechild\n从元素中删除一个子元素,返回删除的元素。\n###### removeChild 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| aChild | [UniElement](/dom/unielement.md) | 是 | - | - | 被删除子元素对象 | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) \\| null | 否 |\n \n\n###### remove() @remove\n把元素对象从它所属的 DOM 树中删除。\n###### remove 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n\n###### scrollTo(x, y) @scrollto\n使界面滚动到给定元素的指定坐标位置 仅scroll-view、list-view组件支持\n###### scrollTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | x轴要滚动到坐标位置(单位px) |\n| y | number | 是 | - | - | y轴要滚动到坐标位置(单位px) | \n\n\n###### scrollBy(x, y) @scrollby\n使得元素滚动一段特定距离 仅scroll-view、list-view组件支持\n###### scrollBy 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | x轴要滚动的距离(单位px) |\n| y | number | 是 | - | - | y轴要滚动的距离(单位px) | \n\n\n###### querySelector(selector) @queryselector\n返回文档中与指定选择器或选择器组匹配的第一个 Element对象。如果找不到匹配项,则返回null\n###### querySelector 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\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) \\| null | 否 |\n \n\n###### querySelectorAll(selector) @queryselectorall\n返回与指定的选择器组匹配的文档中的元素列表\n###### querySelectorAll 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\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)\\> \\| null | 否 |\n \n\n###### focus() @focus\n使元素获取焦点 仅input、Textarea组件支持\n###### focus 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n\n###### blur() @blur\n使元素丢失焦点 仅input、Textarea组件支持\n###### blur 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n\n###### getAndroidView() @getandroidview\n获取元素android原生view\n###### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.25 | x |\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| View \\| null | 否 |\n \n\n###### getAndroidActivity() @getandroidactivity\n获取元素android原生activity\n###### getAndroidActivity 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.25 | x |\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| Activity \\| null | 否 |\n \n\n###### CanvasGradient 的方法 @canvasgradient-values \n\n###### addColorStop(stop, color) @addcolorstop\n添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染\n###### addColorStop 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | 4.25 | 4.25 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stop | number | 是 | - | - | 表示渐变中开始与结束之间的位置,范围 0-1 |\n| color | string | 是 | - | - | 渐变点的颜色 | \n\n\n###### CanvasRenderingContext2D 的方法 @canvasrenderingcontext2d-values \n\n###### arc(x, y, radius, startAngle, endAngle, anticlockwise) @arc\n绘制一段弧线\n###### arc 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 圆弧中心(圆心)的 x 轴坐标 |\n| y | number | 是 | - | - | 圆弧中心(圆心)的 y 轴坐标 |\n| radius | number | 是 | - | - | 圆弧的半径 |\n| startAngle | number | 是 | - | - | 圆弧的起始点,x 轴方向开始计算,单位为弧度 |\n| endAngle | number | 是 | - | - | 圆弧的终点,单位为弧度 |\n| anticlockwise | boolean | 是 | true | - | 圆弧绘制方向,true:逆时针绘制,false:顺时针绘制。 | \n\n\n###### arcTo(x1, y1, x2, y2, radius) @arcto\n根据控制点和半径绘制圆弧路径,使用当前的描点 (前一个 moveTo 或 lineTo 等函数的止点)。根据当前描点与给定的控制点 1 连接的直线,和控制点 1 与控制点 2 连接的直线,作为使用指定半径的圆的切线,画出两条切线之间的弧线路径\n###### arcTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x1 | number | 是 | - | - | 第一个控制点的 x 轴坐标 |\n| y1 | number | 是 | - | - | 第一个控制点的 y 轴坐标 |\n| x2 | number | 是 | - | - | 第二个控制点的 x 轴坐标 |\n| y2 | number | 是 | - | - | 第二个控制点的 y 轴坐标 |\n| radius | number | 是 | - | - | 圆弧的半径 | \n\n\n###### beginPath() @beginpath\n开始创建一个路径。需要调用 fill 或者 stroke 才会使用路径进行填充或描边\n###### beginPath 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) @beziercurveto\n绘制三次贝赛尔曲线路径\n###### bezierCurveTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| cp1x | number | 是 | - | - | 第一个控制点的 x 轴坐标 |\n| cp1y | number | 是 | - | - | 第一个控制点的 y 轴坐标 |\n| cp2x | number | 是 | - | - | 第二个控制点的 x 轴坐标 |\n| cp2y | number | 是 | - | - | 第二个控制点的 y 轴坐标 |\n| x | number | 是 | - | - | 结束点的 x 轴坐标 |\n| y | number | 是 | - | - | 结束点的 y 轴坐标 | \n\n\n###### clearRect(x, y, width, height) @clearrect\n清除画布上在该矩形区域内的内容\n###### clearRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 矩形起点的 x 轴坐标 |\n| y | number | 是 | - | - | 矩形起点的 y 轴坐标 |\n| width | number | 是 | - | - | 矩形的宽度 |\n| height | number | 是 | - | - | 矩形的高度 | \n\n\n###### clip() @clip\n将当前创建的路径设置为当前剪切路径\n###### clip 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### closePath() @closepath\n关闭一个路径\n###### closePath 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### createImageData(width, height) @createimagedata\n创建一个新的、空白的、指定大小的 ImageData 对象。所有的像素在新对象中都是透明的黑色\n###### createImageData 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| width | number | 是 | - | - | - |\n| height | number | 是 | - | - | - | \n\n\n###### createPattern(image, repetition) @createpattern\n对指定的图像创建模式的方法,可在指定的方向上重复元图像\n###### createPattern 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| image | [UniImageElement](#uniimageelement-values) | 是 | - | - | 重复的图像源,支持代码包路径和本地临时路径 (本地路径) |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| classList | Array\\<string\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的的 class 属性的动态集合。 |\n@| firstChild | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的的第一个子元素,如果元素是无子元素,则返回 null。 |\n@| lastChild | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的最后一个子元素,如果没有子元素,则返回 null。 |\n@| parentElement | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素在 DOM 树中的父元素,如果没有父元素(如未添加到DOM树中),则返回null。 |\n@| previousSibling | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的前一个同级元素,没有则返回null。 |\n@| nextElementSibling | [UniElement](/dom/unielement.md) \\| null | 否 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取在 DOM 树中紧跟在其后面的同级元素,如果指定的元素为最后一个元素,则返回 null。 |\n@| children | Array\\<[UniElement](/dom/unielement.md)\\> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素包含的子元素的集合 |\n@| tagName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的标签名 |\n@| nodeName | string | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取当前元素的元素名称 |\n@| dataset | Map\\<string, any \\| null> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取元素上自定义数据属性(data-*)的集合 |\n@| attributes | Map\\<string, any \\| null> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取元素上所有属性元素的集合 |\n@| style | [CSSStyleDeclaration](/dom/cssstyledeclaration.md) | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取元素的CSS样式对象 |\n@| scrollWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取可滚动元素内容的总宽度,仅scroll-view、list-view组件支持,其他组件返回视图宽度 |\n@| scrollHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 获取可滚动元素内容的总高度,仅scroll-view、list-view组件支持,其他组件返回视图高度 |\n@| scrollLeft | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 获取或修改元素滚动条到元素左边的距离像素数,仅scroll-view、list-view组件支持。其他组件返回0 |\n@| scrollTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 获取或修改元素滚动条到元素顶部的距离像素数,仅scroll-view、list-view组件支持。其他组件返回0 |\n@| offsetLeft | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的左边界偏移值 单位px |\n@| offsetTop | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的顶部边界偏移值 单位px |\n@| offsetWidth | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的布局宽度,宽度包含border、padding的数据值 单位px |\n@| offsetHeight | number | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 元素的布局高度,高度包含border、padding的数据值 单位px |\n@| ext | Map\\<string, any \\| null> | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"4.0\",\"4.11\"]]}' /> | 只读属性 扩展属性 |\n| repetition | string | 是 | - | - | 如何重复图像 | \n\n###### UniImageElement 的方法 @uniimageelement-values \n\n###### takeSnapshot(options) @takesnapshot\n对当前组件进行截图,调用此方法会将当前组件(包含子节点)渲染结果导出成图片。\n成功会返回图片对应的临时文件路径,目前默认png格式\n\n###### takeSnapshot 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.03 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| options | [TakeSnapshotOptions](#takesnapshotoptions-values) | 是 | - | - | 组件截图的参数对象 | \n\n\n###### appendChild(aChild) @appendchild\n将一个元素添加到指定父元素的子元素列表的末尾处。如果将被插入的元素已经存在于当前文档的文档树中,那么将会它从原先的位置移动到新的位置。\n###### appendChild 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| aChild | [UniElement](/dom/unielement.md) | 是 | - | - | 插入子元素对象 | \n\n\n###### insertBefore(newChild, refChild?) @insertbefore\n在参考元素之前插入一个拥有指定父元素的子元素。如果给定的子元素是对文档中现有元素的引用,insertBefore() 会将其从当前位置移动到新位置。\n###### insertBefore 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| newChild | [UniElement](/dom/unielement.md) | 是 | - | - | 插入子元素对象 |\n| refChild | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 已存在父元素的子元素对象 | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) \\| null | 否 |\n \n\n###### setAttribute(key, value) @setattribute\n设置指定元素上的某个属性值。如果设置的属性已经存在,则更新该属性值;否则使用指定的名称和值添加一个新的属性。\n###### setAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 |\n| value | string | 是 | - | - | 属性值域 | \n\n\n###### getAttribute(key) @getattribute\n获取元素指定的属性值,如果指定的属性不存在则返回null。\n###### getAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| string \\| null | 否 |\n \n\n###### hasAttribute(key) @hasattribute\n返回改元素是否包含有指定的属性,属性存在则返回true,否则返回false。\n###### hasAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### removeAttribute(key) @removeattribute\n从元素中删除一个属性,如果指定的属性不存在,则不做任何操作,也不会产生错误。\n###### removeAttribute 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| key | string | 是 | - | - | 属性名称 | \n\n\n###### getBoundingClientRect() @getboundingclientrect\n获取元素的大小及其相对于窗口的位置信息。\n###### getBoundingClientRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| [DOMRect](/dom/domrect.md) |\n \n\n###### getDrawableContext() @getdrawablecontext\n获取组件的绘制对象,仅uvue页面中的 view 组件支持,其它组件不支持则返回null。\n###### getDrawableContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| x | 4.0 | 4.11 |\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [DrawableContext](/dom/drawablecontext.md) \\| null | 否 |\n \n\n###### removeChild(aChild) @removechild\n从元素中删除一个子元素,返回删除的元素。\n###### removeChild 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| aChild | [UniElement](/dom/unielement.md) | 是 | - | - | 被删除子元素对象 | \n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| [UniElement](/dom/unielement.md) \\| null | 否 |\n \n\n###### remove() @remove\n把元素对象从它所属的 DOM 树中删除。\n###### remove 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n\n###### scrollTo(x, y) @scrollto\n使界面滚动到给定元素的指定坐标位置 仅scroll-view、list-view组件支持\n###### scrollTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | x轴要滚动到坐标位置(单位px) |\n| y | number | 是 | - | - | y轴要滚动到坐标位置(单位px) | \n\n\n###### scrollBy(x, y) @scrollby\n使得元素滚动一段特定距离 仅scroll-view、list-view组件支持\n###### scrollBy 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | x轴要滚动的距离(单位px) |\n| y | number | 是 | - | - | y轴要滚动的距离(单位px) | \n\n\n###### querySelector(selector) @queryselector\n返回文档中与指定选择器或选择器组匹配的第一个 Element对象。如果找不到匹配项,则返回null\n###### querySelector 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\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) \\| null | 否 |\n \n\n###### querySelectorAll(selector) @queryselectorall\n返回与指定的选择器组匹配的文档中的元素列表\n###### querySelectorAll 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\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)\\> \\| null | 否 |\n \n\n###### focus() @focus\n使元素获取焦点 仅input、Textarea组件支持\n###### focus 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n\n###### blur() @blur\n使元素丢失焦点 仅input、Textarea组件支持\n###### blur 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n\n###### getAndroidView() @getandroidview\n获取元素android原生view\n###### getAndroidView 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.25 | x |\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| View \\| null | 否 |\n \n\n###### getAndroidActivity() @getandroidactivity\n获取元素android原生activity\n###### getAndroidActivity 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | 4.25 | x |\n\n\n###### 返回值 兼容性 \n\n| 类型 | 必备 |\n| :- | :- |\n| Activity \\| null | 否 |\n \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| CanvasPattern |\n \n\n###### createLinearGradient(x0, y0, x1, y1) @createlineargradient\n创建一个线性的渐变颜色。返回的CanvasGradient对象需要使用 CanvasGradient.addColorStop() 来指定渐变点,至少要两个\n###### createLinearGradient 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x0 | number | 是 | - | - | 起点的 x 坐标 |\n| y0 | number | 是 | - | - | 起点的 y 坐标 |\n| x1 | number | 是 | - | - | 终点的 x 坐标 |\n| y1 | number | 是 | - | - | 终点的 y 坐标 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| [CanvasGradient](#canvasgradient-values) |\n \n\n###### createRadialGradient(x0, y0, r0, x1, y1, r01) @createradialgradient\n根据参数确定两个圆的坐标,绘制放射性渐变\n###### createRadialGradient 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x0 | number | 是 | - | - | 开始圆形的 x 轴坐标 |\n| y0 | number | 是 | - | - | 开始圆形的 y 轴坐标 |\n| r0 | number | 是 | - | - | 开始圆形的半径 |\n| x1 | number | 是 | - | - | 结束圆形的 x 轴坐标 |\n| y1 | number | 是 | - | - | 结束圆形的 y 轴坐标 |\n| r01 | number | 是 | - | - | 结束圆形的半径 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| [CanvasGradient](#canvasgradient-values) |\n \n\n###### draw() @draw\n将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中\n###### draw 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) @drawimage\n绘制图像到画布\n###### drawImage 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| imageResource | [UniImageElement](#uniimageelement-values) | 是 | - | - | 所要绘制的图片资源 |\n| sx | number | 是 | - | - | 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 |\n| sy | number | 是 | - | - | 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 |\n| sWidth | number | 是 | - | - | 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 |\n| sHeight | number | 是 | - | - | 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 |\n| dx | number | 是 | - | - | imageResource的左上角在目标 canvas 上 x 轴的位置 |\n| dy | number | 是 | - | - | imageResource的左上角在目标 canvas 上 y 轴的位置 |\n| dWidth | number | 是 | - | - | 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 |\n| dHeight | number | 是 | - | - | 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 | \n\n\n###### ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) @ellipse\n添加椭圆路径。椭圆的圆心在(x,y)位置,半径分别是radiusX 和 radiusY,按照anticlockwise(默认顺时针)指定的方向,从 startAngle 开始绘制,到 endAngle 结束\n###### ellipse 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | - |\n| y | number | 是 | - | - | - |\n| radiusX | number | 是 | - | - | - |\n| radiusY | number | 是 | - | - | - |\n| rotation | number | 是 | - | - | - |\n| startAngle | number | 是 | - | - | - |\n| endAngle | number | 是 | - | - | - |\n| anticlockwise | boolean | 是 | - | - | - | \n\n\n###### fill() @fill\n对当前路径中的内容进行填充\n###### fill 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### fillRect(x, y, width, height) @fillrect\n填充一个矩形。用 setFillStyle 设置矩形的填充色,如果没设置默认是黑色\n###### fillRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 矩形起点的 x 轴坐标 |\n| y | number | 是 | - | - | 矩形起点的 y 轴坐标 |\n| width | number | 是 | - | - | 矩形的宽度 |\n| height | number | 是 | - | - | 矩形的高度 | \n\n\n###### fillText(text, x, y, maxWidth) @filltext\n在画布上绘制文本\n###### fillText 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| text | string | 是 | - | - | 要渲染的文本字符串 |\n| x | number | 是 | - | - | 开始绘制文本的点的 X 轴坐标 |\n| y | number | 是 | - | - | 开始绘制文本的点的 X 轴坐标 |\n| maxWidth | number | 是 | - | - | 需要绘制的最大宽度 | \n\n\n###### getImageData(sx, sy, sw, sh) @getimagedata\n返回一个ImageData对象,用来描述 canvas 区域隐含的像素数据,这个区域通过矩形表示,起始点为*(sx, sy)、宽为sw、高为sh。\n###### getImageData 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| sx | number | 是 | - | - | 将要被提取的图像数据矩形区域的左上角 x 坐标 |\n| sy | number | 是 | - | - | 将要被提取的图像数据矩形区域的左上角 y 坐标 |\n| sw | number | 是 | - | - | 将要被提取的图像数据矩形区域的宽度 |\n| sh | number | 是 | - | - | 将要被提取的图像数据矩形区域的高度 | \n\n###### 返回值 兼容性 \n\n| 类型 | 描述 |\n| :- | :- |\n| **ImageData** | 包含像素值的数组对象 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| width | number | 是 | - | - | - |\n@| height | number | 是 | - | - | - | \n\n###### isContextLost() @iscontextlost\n返回一个Boolean 标记上下文是否已经丢失\n###### isContextLost 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| Boolean |\n \n\n###### isPointInPath(x, y) @ispointinpath\n判断在当前路径中是否包含检测点\n###### isPointInPath 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 检测点的 X 坐标 |\n| y | number | 是 | - | - | 检测点的 Y 坐标 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### isPointInStroke(x, y) @ispointinstroke\n检测某点是否在路径的描边线\n###### isPointInStroke 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 检测点的 X 坐标 |\n| y | number | 是 | - | - | 检测点的 Y 坐标 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### getLineDash() @getlinedash\n在填充线时使用虚线模式, 它使用一组值来指定描述模式的线和间隙的交替长度。\n###### getLineDash 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| Array\\<number\\> |\n \n\n###### lineTo(x, y) @lineto\n增加一个新点,然后创建一条从上次指定点到目标点的线。用 stroke 方法来画线条\n###### lineTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 目标位置的 x 坐标 |\n| y | number | 是 | - | - | 目标位置的 y 坐标 | \n\n\n###### measureText(text) @measuretext\n测量文本尺寸信息。目前仅返回文本宽度\n###### measureText 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| text | string | 是 | - | - | 要渲测量的文本字符串 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| **TextMetrics** |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| width | number | 是 | - | - | - | \n\n###### moveTo(x, y) @moveto\n把路径移动到画布中的指定点\n###### moveTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 目标位置的 x 坐标 |\n| y | number | 是 | - | - | 目标位置的 y 坐标 | \n\n\n###### putImageData(imageData, x, y) @putimagedata\n将数据从已有的 ImageData 对象绘制到位图的方法。如果提供了一个绘制过的矩形,则只绘制该矩形的像素。此方法不受画布转换矩阵的影响\n###### putImageData 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| imageData | [ImageData](#imagedata-values) | 是 | - | - | 包含像素值的数组对象 |\n| x | number | 是 | - | - | 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) |\n| y | number | 是 | - | - | 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### quadraticCurveTo(cpx, cpy, x, y) @quadraticcurveto\n创建二次贝塞尔曲线路径\n###### quadraticCurveTo 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| cpx | number | 是 | - | - | 贝塞尔控制点的 x 坐标 |\n| cpy | number | 是 | - | - | 贝塞尔控制点的 y 坐标 |\n| x | number | 是 | - | - | 结束点的 x 坐标 |\n| y | number | 是 | - | - | 结束点的 y 坐标 | \n\n\n###### rect(x, y, width, height) @rect\n创建一个矩形路径\n###### rect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 矩形路径起点的 x 轴坐标 |\n| y | number | 是 | - | - | 矩形路径起点的 y 轴坐标 |\n| width | number | 是 | - | - | 矩形路径的宽度 |\n| height | number | 是 | - | - | 矩形路径的高度 | \n\n\n###### resetTransform() @resettransform\n使用单位矩阵重新设置当前变换\n###### resetTransform 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### restore() @restore\n恢复之前保存的绘图上下文\n###### restore 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### rotate(rotate) @rotate\n以原点为中心顺时针旋转当前坐标轴\n###### rotate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| rotate | number | 是 | - | - | ,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 | \n\n\n###### roundRect(x, y, width, height, radii) @roundrect\n在当前路径中添加一个圆角矩形\n###### roundRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | x | x |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 包含像素值的数组对象 |\n| y | number | 是 | - | - | 矩形起点的 x 轴坐标,以像素为单位 |\n| width | number | 是 | - | - | 矩形起点的 y 轴坐标,以像素为单位 |\n| height | number | 是 | - | - | 矩形的宽度。正值向右,负值向左 |\n| radii | any | 是 | - | - | 矩形的高度。正值向下,负值向上 | \n\n###### 返回值 兼容性 \n\n| 类型 |\n| :- |\n| boolean |\n \n\n###### save() @save\n保存绘图上下文\n###### save 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### scale(x, y) @scale\n缩放变换\n###### scale 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | |\n| y | number | 是 | - | - | | \n\n\n###### setLineDash(segments) @setlinedash\n在填充线时使用虚线模式, 它使用一组值来指定描述模式的线和间隙的交替长度。\n###### setLineDash 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| segments | Array\\<number\\> | 是 | - | - | \\<number>一组描述交替绘制线段和间距(坐标空间单位)长度的数字 | \n\n\n###### setTransform(scaleX, skewY, skewX, scaleY, translateX, translateY) @settransform\n使用单位矩阵重新设置(覆盖)当前的变换并调用变换\n###### setTransform 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| scaleX | Number | 是 | - | - | 水平缩放 |\n| skewY | Number | 是 | - | - | 垂直倾斜 |\n| skewX | Number | 是 | - | - | 水平倾斜 |\n| scaleY | Number | 是 | - | - | 垂直缩放 |\n| translateX | Number | 是 | - | - | 水平移动 |\n| translateY | Number | 是 | - | - | 垂直移动 | \n\n\n###### stroke() @stroke\n画出当前路径的边框。默认颜色色为黑色\n###### stroke 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n\n\n###### strokeRect(x, y, width, height) @strokerect\n画一个矩形(非填充)\n###### strokeRect 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| x | number | 是 | - | - | 矩形起点的 x 轴坐标 |\n| y | number | 是 | - | - | 矩形起点的 y 轴坐标 |\n| width | number | 是 | - | - | 矩形的宽度 |\n| height | number | 是 | - | - | 矩形的高度 | \n\n\n###### strokeText(text, x, y, maxWidth) @stroketext\n文本描边\n###### strokeText 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| text | string | 是 | - | - | 要渲染的文本字符串 |\n| x | number | 是 | - | - | 开始绘制文本的点的 X 轴坐标 |\n| y | number | 是 | - | - | 开始绘制文本的点的 X 轴坐标 |\n| maxWidth | number | 是 | - | - | 需要绘制的最大宽度 | \n\n\n###### transform(scaleX, skewY, skewX, scaleY, translateX, translateY) @transform\n使用矩阵多次叠加当前变换,矩阵由方法的参数进行描述。可以缩放、旋转、移动和倾斜上下文\n###### transform 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| scaleX | Number | 是 | - | - | 水平缩放 |\n| skewY | number | 是 | - | - | 垂直倾斜 |\n| skewX | number | 是 | - | - | 水平倾斜 |\n| scaleY | number | 是 | - | - | 垂直缩放 |\n| translateX | number | 是 | - | - | 水平移动 |\n| translateY | number | 是 | - | - | 垂直移动 | \n\n\n###### translate(translateX, translateY) @translate\n当前网格添加平移变换\n###### translate 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.21 | √ | √ |\n\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| translateX | number | 是 | - | - | 水平方向的移动距离 |\n| translateY | number | 是 | - | - | 垂直方向的移动距离 | \n\n \n\n###### getContext 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n"},"web-view":{"name":"## web-view","description":"> 组件类型:[UniWebViewElement](#uniwebviewelement) \n\n 承载网页的容器","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.9 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| src | string([string.HTMLURIString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"4.11\"]]}' /> | webview 指向网页的链接 |\n| allow | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 用于为 [iframe](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/iframe) 指定其[特征策略](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/策略特征) |\n| sandbox | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 该属性对呈现在 [iframe](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/iframe) 框架中的内容启用一些额外的限制条件。 |\n| fullscreen | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否铺满整个页面,默认值:`true`。 |\n| webview-styles | **WebViewStyles** | {\"progress\":{\"color\":\"#00FF00\"}} | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | webview 网络地址页面加载进度条样式 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| progress | **WebViewProgressStyles** \\| boolean | 是 | false | - | 网络地址页面加载进度条样式,设置为 false 时表示不显示加载进度条。 |\n@@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@@| :- | :- | :- | :- | :-: | :- |\n@@| color | [string.ColorString](/uts/data-type.md#ide-string) | 是 | - | - | 网页加载进度条颜色,默认值为 #00FF00 。 |\n@\n| horizontalScrollBarAccess | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.13\"]]}' /> | 设置是否显示横向滚动条 |\n| verticalScrollBarAccess | boolean | true | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.11\",\"4.13\"]]}' /> | 设置是否显示纵向滚动条 |\n| @message | (event: [UniWebViewMessageEvent](#uniwebviewmessageevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 网页向应用 postMessage 时触发。e.detail = { data } |\n| @error | (event: [UniWebViewErrorEvent](#uniwebviewerrorevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 网页加载错误时触发。e.detail = { errSubject, errCode, errMsg, url, fullUrl, src } |\n| @load | (event: [UniWebViewLoadEvent](#uniwebviewloadevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"4.0\",\"4.11\"]]}' /> | 网页加载完成后触发。e.detail = { url, src } |\n| @loading | (event: [UniWebViewLoadingEvent](#uniwebviewloadingevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 网页加载中触发。e.detail = { url, src } |\n| @download | (event: [UniWebViewDownloadEvent](#uniwebviewdownloadevent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"x\",\"3.9\",\"4.11\"]]}' /> | 点击网页中可下载链接时触发。e.detail = { url, userAgent, contentDisposition, mimetype, contentLength } |","event":"\n### 事件\n#### UniWebViewMessageEvent\n\n##### UniWebViewMessageEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| type | string | 是 | - | - | 事件类型,固定值message |\n| detail | **UniWebViewMessageEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| data | UTSJSONObject[\\] | 是 | - | - | 消息包含的数据,4.13版本之前类型为Map\\<string, any \\| null> \\| null,4.13版本(含)之后类型为Array\\<UTSJSONObject> |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniWebViewMessageEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniWebViewErrorEvent\n\n##### UniWebViewErrorEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| type | string | 是 | - | - | 事件类型,固定值error |\n| detail | **UniWebViewErrorEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| errSubject | string | 是 | - | - | 统一错误主题(模块)名称,固定值uni-web-view |\n@| errCode | 100001 \\| 100002 \\| 100003 | 是 | - | - | 统一错误码<br/>100001 ssl error<br/>100002 page error<br/>100003 http error |\n@| errMsg | string | 是 | - | - | 统一错误描述信息 |\n@| url | string | 是 | - | - | 加载错误的网页链接,非完整链接,仅包含scheme://authority部分,4.13版本起支持 |\n@| fullUrl | string | 是 | - | - | 加载错误的网页链接,完整链接,4.13版本起支持 |\n@| src | string | 是 | - | - | 加载错误的网页链接,完整链接,4.13版本起支持 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniWebViewErrorEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniWebViewLoadEvent\n\n##### UniWebViewLoadEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| type | string | 是 | - | - | 事件类型,固定值load |\n| detail | **UniWebViewLoadEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| ~~url~~ | string | 是 | - | - | 加载完成的网页链接 **4.13版本起废弃,请改用src** |\n@| src | string | 是 | - | - | 加载完成的网页链接,4.13版本起支持 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniWebViewLoadEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniWebViewLoadingEvent\n\n##### UniWebViewLoadingEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| type | string | 是 | - | - | 事件类型,固定值loading |\n| detail | **UniWebViewLoadingEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| ~~url~~ | string | 是 | - | - | 加载中的网页链接 **4.13版本起废弃,请改用src** |\n@| src | string | 是 | - | - | 加载中的网页链接,4.13版本起支持 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniWebViewLoadingEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n\n#### UniWebViewDownloadEvent\n\n##### UniWebViewDownloadEvent 的属性值\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| type | string | 是 | - | - | 事件类型,固定值download |\n| detail | **UniWebViewDownloadEventDetail** | 是 | - | - | - |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| url | string | 是 | - | - | 下载链接 |\n@| userAgent | string | 是 | - | - | 用户代理 |\n@| contentDisposition | string | 是 | - | - | 指示回复的内容该以何种形式展示,是以内联的形式(即网页或者页面的一部分),还是以附件的形式下载并保存到本地 |\n@| mimetype | string | 是 | - | - | 媒体类型 |\n@| contentLength | number | 是 | - | - | 文件大小 |\n| bubbles | boolean | 是 | - | - | 是否冒泡 |\n| cancelable | boolean | 是 | - | - | 是否可以取消 |\n| target | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 触发事件的组件 |\n| currentTarget | [UniElement](/dom/unielement.md) \\| null | 否 | - | - | 当前组件 |\n| timeStamp | number | 是 | - | - | 事件发生时的时间戳 |\n\n\n##### UniWebViewDownloadEvent 的方法\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| stopPropagation | () => void | 是 | - | - | 阻止当前事件的进一步传播 |\n| preventDefault | () => void | 是 | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.9\",\"x\"]]}' /> | 阻止当前事件的默认行为 |\n","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/web-view/web-view.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/web-view/web-view\n>Template\n```vue\n<template>\n <scroll-view class=\"uni-flex-item\">\n <web-view id=\"web-view\" class=\"uni-flex-item\" :style=\"{ 'pointer-events': pointerEvents }\" :src=\"src\"\n :webview-styles=\"webview_styles\" :horizontalScrollBarAccess=\"horizontalScrollBarAccess\"\n :verticalScrollBarAccess=\"verticalScrollBarAccess\" @message=\"message\" @error=\"error\" @loading=\"loading\"\n @load=\"load\" @download=\"download\" @touchstart=\"touchstart\" @tap=\"tap\">\n </web-view>\n <!-- #ifdef APP -->\n <view class=\"uni-padding-wrap uni-common-mt\">\n <view class=\"uni-btn-v\">\n <input class=\"uni-input\" confirmType=\"go\" placeholder=\"输入网址跳转\" @confirm=\"confirm\" maxlength=\"-1\"/>\n </view>\n <view class=\"uni-row uni-btn-v\">\n <button class=\"uni-flex-item\" type=\"primary\" @click=\"back\">后退</button>\n <button class=\"margin-left-5 uni-flex-item\" type=\"primary\" @click=\"forward\">前进</button>\n </view>\n <view class=\"uni-row uni-btn-v\">\n <button class=\"uni-flex-item\" type=\"primary\" @click=\"reload\">重新加载</button>\n <button class=\"margin-left-5 uni-flex-item\" type=\"primary\" @click=\"stop\">停止加载</button>\n </view>\n <view class=\"uni-btn-v\">\n <button type=\"primary\" @click=\"nativeToWeb\">原生和Web通信</button>\n </view>\n <!-- #ifdef APP-ANDROID -->\n <view class=\"uni-row uni-btn-v\">\n <view class=\"uni-row uni-flex-item align-items-center\">\n <text>显示横向滚动条</text>\n <switch :checked=\"true\" @change=\"changeHorizontalScrollBarAccess\"></switch>\n </view>\n <view class=\"uni-row uni-flex-item align-items-center\">\n <text>显示竖向滚动条</text>\n <switch :checked=\"true\" @change=\"changeVerticalScrollBarAccess\"></switch>\n </view>\n </view>\n <!-- #endif -->\n </view>\n <!-- #endif -->\n </scroll-view>\n</template>\n\n\n\n<style>\n .margin-left-5 {\n margin-left: 5px;\n }\n\n .align-items-center {\n align-items: center;\n }\n</style>\n\n```\n>Script\n```uts\n\n export default {\n data() {\n return {\n src: 'https://www.dcloud.io',\n webview_styles: {\n progress: {\n color: '#FF3333'\n }\n },\n webviewContext: null as WebviewContext | null,\n webviewElement: null as UniWebViewElement | null,\n loadError: false,\n horizontalScrollBarAccess: true,\n verticalScrollBarAccess: true,\n // 自动化测试\n autoTest: false,\n eventLoading: null as UTSJSONObject | null,\n eventLoad: null as UTSJSONObject | null,\n eventError: null as UTSJSONObject | null,\n eventTouchstart: null as UTSJSONObject | null,\n eventTap: null as UTSJSONObject | null,\n pointerEvents: 'auto'\n }\n },\n onReady() {\n // #ifdef APP\n // TODO web 实现createWebviewContext\n this.webviewContext = uni.createWebviewContext('web-view',this)\n this.webviewElement = uni.getElementById('web-view') as UniWebViewElement //推荐使用element,功能更丰富\n // console.log('url: ',this.webviewElement?.getAttribute(\"src\"));\n // this.webviewElement?.setAttribute(\"src\",\"https://ext.dcloud.net.cn/\")\n // #endif\n },\n methods: {\n back() {\n this.webviewContext?.back();\n },\n forward() {\n this.webviewContext?.forward();\n },\n reload() {\n this.webviewContext?.reload();\n // this.webviewElement?.reload();\n },\n stop() {\n this.webviewContext?.stop();\n },\n nativeToWeb() {\n this.webviewContext?.evalJS(\"alert('hello uni-app x')\");\n },\n message(event : UniWebViewMessageEvent) {\n console.log(JSON.stringify(event.detail));\n },\n error(event : UniWebViewErrorEvent) {\n this.loadError = true\n console.log(JSON.stringify(event.detail));\n if (this.autoTest) {\n this.eventError = {\n \"tagName\": event.target?.tagName,\n \"type\": event.type,\n \"errCode\": event.detail.errCode,\n \"errMsg\": event.detail.errMsg,\n \"url\": event.detail.url,\n \"fullUrl\": event.detail.fullUrl,\n \"src\": event.detail.src\n };\n }\n },\n loading(event : UniWebViewLoadingEvent) {\n console.log(JSON.stringify(event.detail));\n if (this.autoTest) {\n this.eventLoading = {\n \"tagName\": event.target?.tagName,\n \"type\": event.type,\n \"src\": event.detail.src\n };\n }\n },\n load(event : UniWebViewLoadEvent) {\n console.log(JSON.stringify(event.detail));\n if (this.autoTest) {\n this.eventLoad = {\n \"tagName\": event.target?.tagName,\n \"type\": event.type,\n \"src\": event.detail.src\n };\n }\n },\n download(event : UniWebViewDownloadEvent) {\n console.log(JSON.stringify(event.detail));\n uni.showModal({\n content: \"下载链接: \" + event.detail.url + \"\\n文件大小: \" + event.detail.contentLength / 1024 + \"KB\",\n showCancel: false\n });\n },\n confirm(event : UniInputConfirmEvent) {\n let url = event.detail.value;\n if (!url.startsWith('https://') && !url.startsWith('http://')) {\n url = 'https://' + url;\n }\n this.src = url;\n },\n changeHorizontalScrollBarAccess(event : UniSwitchChangeEvent) {\n this.horizontalScrollBarAccess = event.detail.value;\n },\n changeVerticalScrollBarAccess(event : UniSwitchChangeEvent) {\n this.verticalScrollBarAccess = event.detail.value;\n },\n // 自动化测试\n touchstart(event : UniTouchEvent) {\n if (this.autoTest) {\n this.eventTouchstart = {\n clientX: Math.ceil(event.touches[0].clientX),\n clientY: Math.ceil(event.touches[0].clientY)\n };\n }\n },\n tap(event : UniPointerEvent) {\n if (this.autoTest) {\n this.eventTap = {\n clientX: Math.ceil(event.clientX),\n clientY: Math.ceil(event.clientY)\n };\n }\n },\n getWindowInfo() : GetWindowInfoResult {\n return uni.getWindowInfo();\n }\n }\n }\n\n```\n:::","children":"### 子组件 @children-tags \n 不可以嵌套组件","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.web-view.web-view)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/web-view.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=web-view&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=web-view&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=web-view&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=web-view&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=web-view&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=web-view)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=web-view&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)\n","component_type":"### UniWebViewElement\nweb-view元素对象\n#### UniWebViewElement 的方法\n##### back() @back\n后退\n\n\n###### back 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n##### forward() @forward\n前进\n\n\n###### forward 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n##### reload() @reload\n重新加载\n\n\n###### reload 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n##### stop() @stop\n停止加载\n\n\n###### stop 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n\n##### evalJS(js) @evaljs\n原生和WebView通信(执行JS脚本)\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| js | string | 是 | - | - | - | \n\n\n###### evalJS 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 4.0 | 4.11 |\n\n"},"custom-tab-bar":{"name":"## custom-tab-bar","description":"自定义tabBar","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.24 | x | x |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| direction | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 选项的排列方向 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| horizontal | - | 选项的排列方向水平 |\n@| vertical | - | 选项的排列方向水平 |\n| show-icon | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 是否显示icon |\n| selected | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 选中的tabBar选项索引值 |\n| @onTabItemTap | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 点击自定义 tabBar 触发事件,detail = {index, pagePath, text} |","event":"","example":"","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.page-meta.custom-tab-bar)\n- [参见uni-app相关文档](https://uniapp.dcloud.io/component/custom-tab-bar.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=custom-tab-bar&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=custom-tab-bar&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=custom-tab-bar&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=custom-tab-bar&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=custom-tab-bar&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=custom-tab-bar)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=custom-tab-bar&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)\n"},"unicloud-db":{"name":"## unicloud-db","description":"> 组件类型:[UniCloudDBElement](#uniclouddbelement) \n\n 是一个数据库查询组件,它将clientDB的API封装为组件,进一步减少开发者使用所需的代码量。","compatibility":"\n### 兼容性\n| Web | Android | iOS |\n| :- | :- | :- |\n| 4.0 | 3.93 | 4.11 |\n","attribute":"### 属性 \n| 名称 | 类型 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| id | string([string.IDString](/uts/data-type.md#ide-string)) | - | - | 唯一标识 |\n| v-slot:default | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | {data, loading, hasMore, pagination, error} |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| data | - | 查询结果,类型为Array\\<UTSJSONObject> |\n@| loading | - | 查询中的状态。可根据此状态,在template中通过v-if显示等待内容 |\n@| hasMore | - | 是否有更多数据。可根据此状态,在template中通过v-if显示没有更多数据了 |\n@| error | - | 查询错误。可根据此状态,在template中通过v-if显示等待内容 |\n@| pagination | - | 分页属性 |\n@@| 值名称 | 兼容性 | 描述 |\n@@| :- | :-: | :- |\n@@| current | - | 当前页号 |\n@@| size | - | 分页大小 |\n@@| count | - | 数据库的总数据量, 设置 :getcount=true 时有效 |\n| collection | string([string.DBCollectionString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 表名 |\n| field | string([string.DBFieldString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 查询字段,多个字段用 `,` 分割 |\n| where | string([string.JQLString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 查询条件 |\n| orderby | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 排序字段及正序倒叙设置 |\n| groupby | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 对数据进行分组 |\n| group-field | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 对数据进行分组统计 |\n| distinct | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 是否对数据查询结果中重复的记录进行去重 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| true | - | 去重 |\n@| false | - | 不去重 |\n| page-data | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | add 多次查询的集合, replace 当前查询的集合 |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| add | - | 多次查询的集合 |\n@| replace | - | 当前查询的集合 |\n| page-current | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 当前页 |\n| page-size | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 每页数据数量 |\n| getone | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 指定查询结果是否返回数组第一条数据,默认 false。在false情况下返回的是数组,即便只有一条结果,也需要\\[0]方式获取。在true下,直接返回结果数据,少一层数组 |\n| getcount | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 是否查询总数量 |\n| gettree | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 是否查询树状结构数据 |\n| startwith | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | gettree的第一层级条件,此初始条件可以省略,不传startWith时默认从最顶级开始查询 |\n| limitlevel | number | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | gettree查询返回的树的最大层级。超过设定层级的节点不会返回。默认10级,最大15,最小1 |\n| manual | boolean | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 是否手动加载数据,默认为 false,页面onLoad时自动联网加载数据 |\n| loadtime | string | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 加载数据时机,默认auto,可选值 auto\\|onready\\|manual |\n@| 值名称 | 兼容性 | 描述 |\n@| :- | :-: | :- |\n@| auto | - | 页面就绪后或属性变化后加载数据,默认为auto |\n@| onready | - | 页面就绪后不自动加载数据,属性变化后加载。适合在onLoad中接收上个页面的参数作为where条件时 |\n@| manual | - | 手动模式,不自动加载数据。如果涉及到分页,需要先手动修改当前页,在调用加载数据 |\n| ~~action~~ | string([string.ClientDBActionString](/uts/data-type.md#ide-string)) | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"x\",\"x\"]]}' /> | 云端执行数据库查询的前或后,触发某个action函数操作,进行预处理或后处理(推荐改用JQL触发器) |\n| @load | (data : Array\\<UTSJSONObject>, ended : boolean, pagination : [UTSJSONObject](/uts/buildin-object-api/utsjsonobject.md)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 成功回调。如联网返回结果后,想修改下数据再渲染界面,则在本方法里对data进行修改 |\n| @error | (event: [UniEvent](/component/common.md#unievent)) => void | - | <CompatibilityTable table='{\"headers\":[{\"title\":\"Web\"},{\"title\":\"Android\"},{\"title\":\"iOS\"}],\"rows\":[[\"4.0\",\"3.93\",\"4.11\"]]}' /> | 失败回调 |","event":"","example":"### 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/pages/component/unicloud-db/unicloud-db.uvue) \n ::: preview https://hellouniappx.dcloud.net.cn/web/#/pages/component/unicloud-db/unicloud-db\n>Template\n```vue\n<template>\n <view class=\"content\">\n <unicloud-db ref=\"udb\" v-slot:default=\"{data, pagination, loading, error}\"\n :collection=\"collection\" :getcount=\"true\" loadtime=\"manual\">\n <list-view v-if=\"data.length>0\" ref=\"listView\" class=\"list\" :scroll-y=\"true\" @scrolltolower=\"loadMore()\">\n <list-item class=\"list-item\" v-for=\"(item, _) in data\">\n <view class=\"list-item-fill\">\n <text>{{item}}</text>\n </view>\n <view>\n <text class=\"list-item-remove\" @click=\"remove(item.getString('_id')!)\">❌</text>\n </view>\n </list-item>\n </list-view>\n <text class=\"loading\" v-if=\"loading\">Loading...</text>\n <view v-if=\"error!=null\">{{error.errMsg}}</view>\n <view class=\"pagination\" v-if=\"data.length>0\">\n <text class=\"pagination-item\">{{data.length}} / {{pagination.count}}</text>\n </view>\n </unicloud-db>\n <view class=\"btn-group\">\n <button class=\"btn\" @click=\"add()\">Add</button>\n <button class=\"btn\" @click=\"get()\">Get</button>\n </view>\n </view>\n</template>\n\n\n\n<style>\n .content {\n flex: 1;\n flex-direction: column;\n }\n\n .list {\n flex: 1;\n flex-direction: column;\n }\n\n .list-item {\n flex-direction: row;\n padding: 10px;\n }\n\n .list-item-fill {\n flex: 1;\n }\n\n .list-item-remove {\n padding: 10px;\n }\n\n .loading {\n padding: 10px;\n text-align: center;\n }\n\n .pagination {\n flex-direction: row;\n background-color: #f2f2f2;\n }\n\n .pagination-item {\n margin: auto;\n padding: 5px 10px;\n }\n\n .btn-group {\n flex-direction: row;\n }\n\n .btn {\n flex: 1;\n margin: 10px;\n }\n</style>\n\n```\n>Script\n```uts\n\n const db = uniCloud.databaseForJQL()\n\n export default {\n data() {\n return {\n collection: 'unicloud-db-test',\n collectionList: [\n db.collection('book').where('name == \"水浒传\"').getTemp(),\n ] as UTSJSONObject[],\n uniCloudElement: null as UniCloudDBElement | null,\n isTesting: false,\n addResult: {},\n updateResult: {},\n removeResult: {}\n }\n },\n onReady() {\n this.uniCloudElement = this.$refs['udb'] as UniCloudDBElement\n this.get();\n },\n onPullDownRefresh() {\n this.uniCloudElement!.loadData({\n clear: true,\n success: (_ : UniCloudDBGetResult) => {\n uni.stopPullDownRefresh()\n }\n })\n },\n methods: {\n loadMore() {\n this.uniCloudElement!.loadMore()\n },\n get() {\n this.uniCloudElement!.loadData({\n clear: true\n })\n },\n add() {\n const value = {\n title: \"title-\" + Date.now(),\n comment: \"comment\" + Date.now()\n };\n this.uniCloudElement!.add(value, {\n showToast: false,\n success: (res : UniCloudDBAddResult) => {\n this.addResult = {\n id: res.id\n };\n this.get();\n },\n fail: (err : any | null) => {\n this.showError(err)\n }\n })\n },\n update(id : string) {\n const value = {\n title: \"title-\" + Date.now(),\n comment: \"comment\" + Date.now()\n };\n this.uniCloudElement!.update(id, value, {\n showToast: false,\n needLoading: true,\n needConfirm: false,\n loadingTitle: \"正在更新...\",\n success: (res : UniCloudDBUpdateResult) => {\n this.updateResult = {\n updated: res.updated\n }\n },\n fail: (err : any | null) => {\n this.showError(err)\n }\n })\n },\n remove(id : string) {\n this.uniCloudElement!.remove(id, {\n showToast: false,\n needConfirm: false,\n needLoading: false,\n success: (res : UniCloudDBRemoveResult) => {\n this.removeResult = {\n deleted: res.deleted\n }\n },\n fail: (err : any | null) => {\n this.showError(err)\n }\n })\n },\n onQueryLoad(data : Array<UTSJSONObject>, ended : boolean, pagination : UTSJSONObject) {\n console.log(data, ended, pagination);\n },\n showError(err : any | null) {\n const error = err as UniCloudError\n uni.showModal({\n content: error.errMsg,\n showCancel: false\n })\n }\n }\n }\n\n```\n:::","children":"","reference":"\n### 参见\n- [相关 Bug](https://issues.dcloud.net.cn/?mid=component.unicloud.unicloud-db)\n- [unicloud-db组件教程](https://doc.dcloud.net.cn/uniCloud/unicloud-db.html)\n- [微信小程序文档](https://developers.weixin.qq.com/doc/search.html?source=enter&query=unicloud-db&doc_type=miniprogram)\n- [支付宝小程序文档](https://open.alipay.com/portal/zhichi/search?keyword=unicloud-db&pageIndex=1&pageSize=10&source=doc_top&type=all)\n- [百度小程序文档](https://smartprogram.baidu.com/forum/search?query=unicloud-db&scope=devdocs&source=docs)\n- [抖音小程序文档](https://developer.open-douyin.com/search-page?keyword=unicloud-db&secondType=all&type=1)\n- [飞书小程序文档](https://open.feishu.cn/search?from=header&page=1&pageSize=10&q=unicloud-db&topicFilter=)\n- [钉钉小程序文档](https://open.dingtalk.com/search?keyword=unicloud-db)\n- [QQ小程序文档](https://q.qq.com/wiki/develop/miniprogram/frame/)\n- [快手小程序文档](https://developers.kuaishou.com/page?keyword=unicloud-db&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)\n","component_type":"### UniCloudDBElement\n\n#### UniCloudDBElement 的属性值\n| 名称 | 类型 | 必填 | 兼容性 | 描述 |\n| :- | :- | :- | :-: | :- |\n| dataList | Array\\<UTSJSONObject> | 是 | - | 已加载的数据 |\n#### UniCloudDBElement 的方法\n##### loadData(options?) @loaddata\n加载数据\n当 \\<unicloud-db> 组件的 manual 属性设为 true 或者 loadtime 属性设置为 manual 时,不会在页面初始化时联网查询数据,此时需要通过本方法在需要的时候手动加载数据。\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| options | **UniCloudDBComponentLoadDataOptions** | 否 | - | - | 可选参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| clear | boolean \\| null | 否 | false | - | 是否清空数据 |\n@| current | number \\| null | 否 | - | - | 当前第几页 |\n@| success | (res?: T \\| null) => void \\| null | 否 | - | - | 成功回调 |\n@| fail | (err?: any \\| null) => void \\| null | 否 | - | - | 失败回调 |\n@| complete | () => void \\| null | 否 | - | - | 完成回调 | \n\n\n###### loadData 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### loadMore() @loadmore\n加载更多数据\n在列表的加载下一页场景下,使用ref方式访问组件方法,加载更多数据,每加载成功一次,当前页 +1\n\n\n###### loadMore 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### add(value, options?) @add\n新增数据\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| value | UTSJSONObject | 是 | - | - | 新增数据. |\n| options | **UniCloudDBComponentAddOptions** | 否 | - | - | 可选参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| showToast | boolean \\| null | 否 | true | - | 是否显示 Toast |\n@| toastTitle | string \\| null | 否 | - | - | Toast 标题 |\n@| needLoading | boolean \\| null | 否 | true | - | 是否需要 Loading |\n@| loadingTitle | string \\| null | 否 | - | - | Loading 标题 |\n@| success | (res?: T \\| null) => void \\| null | 否 | - | - | 成功回调 |\n@| fail | (err?: any \\| null) => void \\| null | 否 | - | - | 失败回调 |\n@| complete | () => void \\| null | 否 | - | - | 完成回调 | \n\n\n###### add 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### remove() @remove\n移除数据\n\n\n###### remove 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### remove() @remove\n移除数据\n\n\n###### remove 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n\n##### update(id, value, options?) @update\n更新数据\n##### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 兼容性 | 描述 |\n| :- | :- | :- | :- | :-: | :- |\n| id | string | 是 | - | - | 数据库字段的唯一标识. |\n| value | UTSJSONObject | 是 | - | - | 需要修改的新数据. |\n| options | **UniCloudDBComponentUpdateOptions** | 否 | - | - | 可选参数 |\n@| 名称 | 类型 | 必备 | 默认值 | 兼容性 | 描述 |\n@| :- | :- | :- | :- | :-: | :- |\n@| showToast | boolean \\| null | 否 | true | - | 是否显示更新后 Toast |\n@| toastTitle | string \\| null | 否 | \"\" | - | 更新成功后 Toast 标题 |\n@| confirmTitle | string \\| null | 否 | - | - | 确认框标题 |\n@| confirmContent | string \\| null | 否 | - | - | 确认框内容 |\n@| needConfirm | boolean \\| null | 否 | true | - | 是否显示更新确认框 |\n@| needLoading | boolean \\| null | 否 | true | - | 是否需要 Loading |\n@| loadingTitle | string \\| null | 否 | - | - | Loading 标题 |\n@| success | (res?: T \\| null) => void \\| null | 否 | - | - | 成功回调 |\n@| fail | (err?: any \\| null) => void \\| null | 否 | - | - | 失败回调 |\n@| complete | () => void \\| null | 否 | - | - | 完成回调 | \n\n\n###### update 兼容性 \n| Web | Android | iOS |\n| :- | :- | :- |\n| - | - | - |\n\n"}}