提交 949372f4 编写于 作者: D DCloud_LXH

feat(component): object -> native-view

上级 6a9a6d93
......@@ -23,12 +23,12 @@
* nested-scroll | 嵌套滚动```{"collapsable": false}```
* [nested-scroll-header](nested-scroll-header.md)
* [nested-scroll-body](nested-scroll-body.md)
<!-- * [object](object.md) -->
* 基础内容
* [icon | 图标](icon.md)
* [text | 文本](text.md)
* [rich-text | 富文本](rich-text.md)
* [progress | 进度条](progress.md)
<!-- * [native-view](native-view.md) -->
* 表单组件
* [button | 按钮](button.md)
* checkbox | 多选框```{"collapsable": false}```
......
## native-view
<!-- UTSCOMJSON.native-view.description -->
<!-- UTSCOMJSON.native-view.compatibility -->
<!-- UTSCOMJSON.native-view.attribute -->
<!-- UTSCOMJSON.native-view.event -->
<!-- UTSCOMJSON.native-view.component_type -->
### 使用场景
自定义元素的view层,开发各平台原生组件
### 使用教程
+ 获取 UniNativeViewElement
`object`提供 @init 监听元素初始化,通过事件[UniNativeViewInitEvent](#uninativeviewinitevent)的 detail.element 获取到 [UniNativeViewElement](../dom/uninativeviewelement.md)
+ 绑定原生view
[UniNativeViewElement](../dom/uninativeviewelement.md) 提供了[bindAndroidView](../dom/uninativeviewelement.md#bindandroidview)`object`绑定安卓原生view, [bindIOSView](../dom/uninativeviewelement.md#bindiosview)`object`绑定IOS原生view, 绑定后view则自动适配[组件全局属性](common.md#组件全局属性)
+ 分发自定义事件
[UniNativeViewElement](../dom/uninativeviewelement.md) 提供了dispatchEvent分发event事件API,注意:事件对象暂时只支持[UniNativeViewEvent](#uninativeviewevent)类型。
具体示例请参考:[native-button](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/uni_modules/native-button/components/native-button/native-button.uvue)插件,该插件使用`object`封装原生button实现的native-button。
**注意:**
+ android平台绑定的View暂时不支持[组件全局事件](common.md#组件全局事件),后续会提供相关实现方式响应组件公共事件。
+ android平台绑定的View暂时不支持[list-item复用机制](list-item.md#list-item复用机制),list-item其他子组件不受影响正常启动复用业务。
+ android平台绑定的View不能设置原生的background,会导致`object`组件的background、border、boxshadow 失效。
+ android平台`object`封装的是容器视图,不能自带子View,子组件插入时可能导致子View被其组件覆盖显示不出来。
+ android平台绑定的View不支持overflow: visible。
<!-- UTSCOMJSON.native-view.children -->
<!-- UTSCOMJSON.native-view.example -->
<!-- UTSCOMJSON.native-view.reference -->
## UniNativeViewEvent
<!-- CUSTOMTYPEJSON.UniNativeViewEvent.description -->
<!-- CUSTOMTYPEJSON.UniNativeViewEvent.extends -->
<!-- CUSTOMTYPEJSON.UniNativeViewEvent.param -->
<!-- CUSTOMTYPEJSON.UniNativeViewEvent.compatibility -->
<!-- CUSTOMTYPEJSON.UniNativeViewEvent.example -->
## object
<!-- UTSCOMJSON.object.description -->
<!-- UTSCOMJSON.object.compatibility -->
<!-- UTSCOMJSON.object.attribute -->
<!-- UTSCOMJSON.object.event -->
<!-- UTSCOMJSON.object.component_type -->
### 使用场景
自定义元素的view层,开发各平台原生组件
### 使用教程
+ 获取UniObjectElement
`object`提供 @init 监听元素初始化,通过事件[UniObjectInitEvent](#uniobjectinitevent)的 detail.element 获取到 [UniObjectElement](../dom/uniobjectelement.md)
+ 绑定原生view
[UniObjectElement](../dom/uniobjectelement.md) 提供了[bindAndroidView](../dom/uniobjectelement.md#bindandroidview)`object`绑定安卓原生view, [bindIOSView](../dom/uniobjectelement.md#bindiosview)`object`绑定IOS原生view, 绑定后view则自动适配[组件全局属性](common.md#组件全局属性)
+ 分发自定义事件
[UniObjectElement](../dom/uniobjectelement.md) 提供了dispatchEvent分发event事件API,注意:事件对象暂时只支持[UniObjectCustomEvent](#uniobjectcustomevent)类型。
具体示例请参考:[native-button](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/dev/uni_modules/uni-native-button/components/native-button/native-button.vue)插件,该插件使用`object`封装原生button实现的native-button。
**注意:**
+ android平台绑定的View暂时不支持[组件全局事件](common.md#组件全局事件),后续会提供相关实现方式响应组件公共事件。
+ android平台绑定的View暂时不支持[list-item复用机制](list-item.md#list-item复用机制),list-item其他子组件不受影响正常启动复用业务。
+ android平台绑定的View不能设置原生的background,会导致`object`组件的background、border、boxshadow 失效。
+ android平台`object`封装的是容器视图,不能自带子View,子组件插入时可能导致子View被其组件覆盖显示不出来。
+ android平台绑定的View不支持overflow: visible。
<!-- UTSCOMJSON.object.children -->
<!-- UTSCOMJSON.object.example -->
<!-- UTSCOMJSON.object.reference -->
## UniObjectCustomEvent
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.description -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.extends -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.param -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.example -->
### UniObjectCustomEvent 的方法 @uniobjectcustomevent-methods
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.stopPropagation.name -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.stopPropagation.description -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.stopPropagation.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.stopPropagation.param -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.stopPropagation.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.stopPropagation.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.preventDefault.name -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.preventDefault.description -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.preventDefault.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.preventDefault.param -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.preventDefault.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectCustomEvent.methods.preventDefault.tutorial -->
......@@ -7,8 +7,8 @@
* [UniTextElement](unitextelement.md)
* [UniVideoElement](univideoelement.md)
* [UniWebViewElement](uniwebviewelement.md)
<!-- * [UniNativeViewElement](uninativeviewelement.md) -->
* [DOMRect](domrect.md)
* [CSSStyleDeclaration](cssstyledeclaration.md)
* [DrawableContext](drawablecontext.md)
* [UniResizeObserver](uniresizeobserver.md)
<!-- * [UniObjectElement](uniobjectelement.md) -->
## UniNativeViewElement
<!-- CUSTOMTYPEJSON.UniNativeViewElement.description -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.extends -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.param -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.compatibility -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.example -->
### UniNativeViewElement 的方法 @uninativeviewelement-methods
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindAndroidView.name -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindAndroidView.description -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindAndroidView.compatibility -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindAndroidView.param -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindAndroidView.returnValue -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindAndroidView.tutorial -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindIOSView.name -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindIOSView.description -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindIOSView.compatibility -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindIOSView.param -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindIOSView.returnValue -->
<!-- CUSTOMTYPEJSON.UniNativeViewElement.methods.bindIOSView.tutorial -->
## UniObjectElement
<!-- CUSTOMTYPEJSON.UniObjectElement.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.extends -->
<!-- CUSTOMTYPEJSON.UniObjectElement.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.example -->
### UniObjectElement 的方法 @uniobjectelement-methods
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindAndroidView.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindAndroidView.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindAndroidView.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindAndroidView.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindAndroidView.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindAndroidView.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindIOSView.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindIOSView.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindIOSView.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindIOSView.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindIOSView.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.bindIOSView.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.takeSnapshot.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.takeSnapshot.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.takeSnapshot.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.takeSnapshot.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.takeSnapshot.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.takeSnapshot.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.appendChild.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.appendChild.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.appendChild.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.appendChild.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.appendChild.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.appendChild.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.insertBefore.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.insertBefore.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.insertBefore.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.insertBefore.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.insertBefore.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.insertBefore.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.setAttribute.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.setAttribute.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.setAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.setAttribute.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.setAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.setAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAttribute.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAttribute.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAttribute.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.hasAttribute.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.hasAttribute.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.hasAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.hasAttribute.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.hasAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.hasAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeAttribute.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeAttribute.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeAttribute.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeAttribute.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeAttribute.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeAttribute.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getBoundingClientRect.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getBoundingClientRect.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getBoundingClientRect.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getBoundingClientRect.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getBoundingClientRect.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getBoundingClientRect.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getDrawableContext.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getDrawableContext.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getDrawableContext.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getDrawableContext.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getDrawableContext.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getDrawableContext.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeChild.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeChild.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeChild.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeChild.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeChild.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.removeChild.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.remove.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.remove.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.remove.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.remove.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.remove.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.remove.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollTo.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollTo.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollTo.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollTo.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollTo.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollTo.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollBy.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollBy.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollBy.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollBy.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollBy.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.scrollBy.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelector.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelector.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelector.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelector.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelector.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelector.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelectorAll.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelectorAll.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelectorAll.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelectorAll.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelectorAll.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.querySelectorAll.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.focus.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.focus.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.focus.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.focus.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.focus.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.focus.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.blur.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.blur.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.blur.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.blur.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.blur.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.blur.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidView.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidView.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidView.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidView.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidView.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidView.tutorial -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidActivity.name -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidActivity.description -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidActivity.compatibility -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidActivity.param -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidActivity.returnValue -->
<!-- CUSTOMTYPEJSON.UniObjectElement.methods.getAndroidActivity.tutorial -->
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册