未验证 提交 9a031cfd 编写于 作者: O openharmony_ci 提交者: Gitee

!12580 断链修改

Merge pull request !12580 from LiAn/master
...@@ -4,37 +4,37 @@ Bind different types of gesture events to components and set response methods fo ...@@ -4,37 +4,37 @@ Bind different types of gesture events to components and set response methods fo
> **NOTE** > **NOTE**
> >
> The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Binding Gesture Recognition ## Binding Gesture Recognition
Use the following attributes to bind gesture recognition to a component. When a gesture is recognized, the event callback is invoked to notify the component. Use the following attributes to bind gesture recognition to a component. When a gesture is recognized, the event callback is invoked to notify the component.
| Name| Type| Default Value| Description| | Name | Type | Default Value | Description |
| -------- | -------- | -------- | -------- | | --------------- | ---------------------------------------- | --------------------------------------- | ---------------------------------------- |
| gesture | gesture: [GestureType](#gesturetype),<br>mask?: [GestureMask](#gesturemask) | gesture: -,<br>mask: GestureMask.Normal | Gesture to bind.<br>- **gesture**: type of the gesture to bind.<br>- **mask**: event response setting.| | gesture | gesture: [GestureType](#gesturetype),<br>mask?: [GestureMask](#gesturemask) | gesture: -,<br>mask: GestureMask.Normal | Gesture to bind.<br>- **gesture**: type of the gesture to bind.<br>- **mask**: event response setting. |
| priorityGesture | gesture: [GestureType](#gesturetype),<br>mask?: [GestureMask](#gesturemask) | gesture: -,<br>mask: GestureMask.Normal | Gesture to preferentially recognize.<br>- **gesture**: type of the gesture to bind.<br>- **mask**: event response setting.<br>By default, a component recognizes gestures bound through **gesture**. When **priorityGesture** is configured for its parent component, the component preferentially recognizes gestures bound through **priorityGesture**.| | priorityGesture | gesture: [GestureType](#gesturetype),<br>mask?: [GestureMask](#gesturemask) | gesture: -,<br>mask: GestureMask.Normal | Gesture to preferentially recognize.<br>- **gesture**: type of the gesture to bind.<br>- **mask**: event response setting.<br>By default, a component recognizes gestures bound through **gesture**. When **priorityGesture** is configured for its parent component, the component preferentially recognizes gestures bound through **priorityGesture**. |
| parallelGesture | gesture: [GestureType](#gesturetype),<br>mask?: [GestureMask](#gesturemask) | gesture: -,<br>mask: GestureMask.Normal | Gesture that can be triggered together with the child component gesture.<br>- **gesture**: type of the gesture to bind. <br>- **mask**: event response setting.<br>The gesture event is not a bubbling event. When **parallelGesture** is set for the parent component, gesture events that are the same for the parent and child components can be triggered, thereby implementing a bubbling effect. If both the single-tap gesture event and the double-tap gesture event are bound to the parent and child components, only the single-tap gesture event is responded.| | parallelGesture | gesture: [GestureType](#gesturetype),<br>mask?: [GestureMask](#gesturemask) | gesture: -,<br>mask: GestureMask.Normal | Gesture that can be triggered together with the child component gesture.<br>- **gesture**: type of the gesture to bind. <br>- **mask**: event response setting.<br>The gesture event is not a bubbling event. When **parallelGesture** is set for the parent component, gesture events that are the same for the parent and child components can be triggered, thereby implementing a bubbling effect. If both the single-tap gesture event and the double-tap gesture event are bound to the parent and child components, only the single-tap gesture event is responded. |
## GestureType ## GestureType
| Name| Description| | Name | Description |
| -------- | -------- | | ---------------------------------------- | ---------------------------------------- |
| [TapGesture](ts-basic-gestures-tapgesture.md) | Tap gesture, which can be a single-tap or multi-tap gesture.| | [TapGesture](ts-basic-gestures-tapgesture.md) | Tap gesture, which can be a single-tap or multi-tap gesture. |
| [LongPressGesture](ts-basic-gestures-longpressgesture.md) | Long press gesture.| | [LongPressGesture](ts-basic-gestures-longpressgesture.md) | Long press gesture. |
| [PanGesture](ts-basic-gestures-pangesture.md) | Pan gesture, which requires a minimum 5 vp movement distance of a finger on the screen.| | [PanGesture](ts-basic-gestures-pangesture.md) | Pan gesture, which requires a minimum 5 vp movement distance of a finger on the screen. |
| [PinchGesture](ts-basic-gestures-pinchgesture.md) | Pinch gesture.| | [PinchGesture](ts-basic-gestures-pinchgesture.md) | Pinch gesture. |
| [RotationGesture](ts-basic-gestures-rotationgesture.md) | Rotation gesture.| | [RotationGesture](ts-basic-gestures-rotationgesture.md) | Rotation gesture. |
| [SwipeGesture](ts-basic-gestures-swipegesture.md) | Swipe gesture, which can be recognized when the swipe speed is 100 vp/s or higher.| | [SwipeGesture](ts-basic-gestures-swipegesture.md) | Swipe gesture, which can be recognized when the swipe speed is 100 vp/s or higher. |
| [GestureGroup](ts-combined-gestures.md) | A group of gestures. Continuous recognition, parallel recognition, and exclusive recognition are supported.| | [GestureGroup](ts-combined-gestures.md) | A group of gestures. Continuous recognition, parallel recognition, and exclusive recognition are supported. |
## GestureMask ## GestureMask
| Name| Description| | Name | Description |
| -------- | -------- | | -------------- | ---------------------------------------- |
| Normal | The gestures of child components are not ignored and are recognized based on the default gesture recognition sequence.| | Normal | The gestures of child components are not ignored and are recognized based on the default gesture recognition sequence. |
| IgnoreInternal | The gestures of child components are ignored. Only the gestures of the current component are recognized.<br>However, the built-in gestures of the child components are not ignored. For example, when the child component is a **\<List>** component, the built-in sliding gestures can still be triggered.| | IgnoreInternal | The gestures of child components are ignored. Only the gestures of the current component are recognized.<br>However, the built-in gestures of the child components are not ignored. For example, when the child component is a **\<List>** component, the built-in sliding gestures can still be triggered. |
## Gesture Response Event ## Gesture Response Event
...@@ -42,52 +42,52 @@ The component binds gesture objects of different **GestureType**s through gestur ...@@ -42,52 +42,52 @@ The component binds gesture objects of different **GestureType**s through gestur
**TapGesture** **TapGesture**
| Name| Description| | Name | Description |
| -------- | -------- | | ---------------------------------------- | ---------------------------------------- |
| onAction((event?:GestureEvent) =&gt; void) | Callback invoked when a tap gesture is recognized.| | onAction((event?:GestureEvent) =&gt; void) | Callback invoked when a tap gesture is recognized. |
## GestureEvent ## GestureEvent
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ----------------------- | ---------------------------------------- | ---------------------------------------- |
| repeat | boolean | Whether the event is triggered repeatedly. This attribute is used for the **LongPressGesture** event.| | repeat | boolean | Whether the event is triggered repeatedly. This attribute is used for the **LongPressGesture** event. |
| offsetX | number | Offset of the gesture event on the x-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from left to right, and a negative value means the opposite.| | offsetX | number | Offset of the gesture event on the x-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from left to right, and a negative value means the opposite. |
| offsetY | number | Offset of the gesture event on the y-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from top to bottom, and a negative value means the opposite.| | offsetY | number | Offset of the gesture event on the y-axis, in vp. This attribute is used for the **PanGesture** event. A positive value means to pan from top to bottom, and a negative value means the opposite. |
| angle | number | Rotation angle for the **RotationGesture** event;<br>angle of the swipe gesture for the **SwipeGesture** event, that is, the change in the included angle between the line segment created by the two fingers and the horizontal direction.<br>**NOTE**<br>Angle calculation method: After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) – arctan2(y2-y1,x2-x1) The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees.| | angle | number | Rotation angle for the **RotationGesture** event;<br>angle of the swipe gesture for the **SwipeGesture** event, that is, the change in the included angle between the line segment created by the two fingers and the horizontal direction.<br>**NOTE**<br>Angle calculation method: After a swipe gesture is recognized, a line connecting the two fingers is identified as the initial line. As the fingers swipe, the line between the fingers rotates. Based on the coordinates of the initial line's and current line's end points, an arc tangent function is used to calculate the respective included angle of the points relative to the horizontal direction by using the following formula: Rotation angle = arctan2(cy2-cy1,cx2-cx1) – arctan2(y2-y1,x2-x1) The initial line is used as the coordinate system. The clockwise rotation is 0 to 180 degrees, and the counter-clockwise rotation is –180 to 0 degrees. |
| scale | number | Scale ratio. This attribute is used for the **PinchGesture** event.| | scale | number | Scale ratio. This attribute is used for the **PinchGesture** event. |
| pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.| | pinchCenterX | number | X-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event. |
| pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event.| | pinchCenterY | number | Y-coordinate of the center of the pinch gesture, in px relative to the upper left corner of the current component. This attribute is used for the **PinchGesture** event. |
| speed<sup>8+</sup> | number | Swipe gesture speed, that is, the average swipe speed of all fingers. The unit is vp/s. This attribute is used for the **SwipeGesture** event.| | speed<sup>8+</sup> | number | Swipe gesture speed, that is, the average swipe speed of all fingers. The unit is vp/s. This attribute is used for the **SwipeGesture** event. |
| fingerList<sup>8+</sup> | [FingerInfo](#fingerinfo)[] | Information about all fingers that trigger the event, which is used for the **LongPressGesture** and **TapGesture** events.| | fingerList<sup>8+</sup> | [FingerInfo](#fingerinfo)[] | Information about all fingers that trigger the event, which is used for the **LongPressGesture** and **TapGesture** events. |
| timestamp<sup>8+</sup> | number | Timestamp of the event.| | timestamp<sup>8+</sup> | number | Timestamp of the event. |
| target<sup>8+</sup> | [EventTarget](ts-universal-events-click.md#eventtarget8) | Display area of the element that triggers the gesture event.| | target<sup>8+</sup> | [EventTarget](ts-universal-events-click.md#eventtarget8) | Display area of the element that triggers the gesture event. |
| source<sup>8+</sup> | [SourceType](#sourcetype) | Event input device.| | source<sup>8+</sup> | [SourceType](#sourcetype) | Event input device. |
| pressure<sup>9+</sup> | number | Press pressure.| | pressure<sup>9+</sup> | number | Press pressure. |
| tiltX<sup>9+</sup> | number | Angle between the projection of the stylus on the device plane and the x-axis.| | tiltX<sup>9+</sup> | number | Angle between the projection of the stylus on the device plane and the x-axis. |
| tiltY<sup>9+</sup> | number | Angle between the projection of the stylus on the device plane and the y-axis.| | tiltY<sup>9+</sup> | number | Angle between the projection of the stylus on the device plane and the y-axis. |
| sourceTool<sup>9+</sup> | [SourceTool](#sourcetool) | Event input source.| | sourceTool<sup>9+</sup> | [SourceTool](#sourcetool) | Event input source. |
## SourceType ## SourceType
| Name| Description| | Name | Description |
| -------- | -------- | | ----------- | -------------------- |
| Unknown | Unknown device type.| | Unknown | Unknown device type. |
| Mouse | Mouse.| | Mouse | Mouse. |
| TouchScreen | Touchscreen.| | TouchScreen | Touchscreen. |
## FingerInfo ## FingerInfo
| Name| Type| Description| | Name | Type | Description |
| -------- | -------- | -------- | | ------- | ------ | ---------------------------------------- |
| id | number | Index of a finger.| | id | number | Index of a finger. |
| globalX | number | X-coordinate relative to the upper left corner of the application window.| | globalX | number | X-coordinate relative to the upper left corner of the application window. |
| globalY | number | Y-coordinate relative to the upper left corner of the application window.| | globalY | number | Y-coordinate relative to the upper left corner of the application window. |
| localX | number | X-coordinate relative to the upper left corner of the current component.| | localX | number | X-coordinate relative to the upper left corner of the current component. |
| localY | number | Y-coordinate relative to the upper left corner of the current component.| | localY | number | Y-coordinate relative to the upper left corner of the current component. |
## SourceTool ## SourceTool
| Name| Description| | Name | Description |
| -------- | -------- | | ------- | --------------------- |
| Unknown | Unknown input source.| | Unknown | Unknown input source. |
| Finger | Finger input.| | Finger | Finger input. |
| Pen | Stylus input.| | Pen | Stylus input. |
## Example ## Example
......
...@@ -139,4 +139,4 @@ export default { ...@@ -139,4 +139,4 @@ export default {
} }
``` ```
![zh-cn_image1](figures/zh-cn_image1.PNG) ![zh-cn_image1](figures/zh-cn_image1.png)
\ No newline at end of file \ No newline at end of file
...@@ -6,11 +6,10 @@ ...@@ -6,11 +6,10 @@
> >
> 该组件从API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 该组件从API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 子组件 ## 子组件
构造参数type为"surface"时不支持。\ 构造参数type为"surface"时不支持。
从API version 9开始,构造参数type为"component"时可以包含子组件。 从API version 9开始,构造参数type为"component"时可以包含子组件。
## 接口 ## 接口
...@@ -19,12 +18,12 @@ ...@@ -19,12 +18,12 @@
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 描述 | | 参数名 | 参数类型 | 必填 | 描述 |
| --------- | ------ | ---- | ----- | | ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| id | string | 是 | 组件的唯一标识,支持最大的字符串长度128。 | | id | string | 是 | 组件的唯一标识,支持最大的字符串长度128。 |
| type | string | 是 | 用于指定XComponent组件类型,可选值为:<br/>-"surface":用于EGL/OpenGLES和媒体数据写入,组件内容单独送显,直接合成到屏幕。<br/>-"component"<sup>9+</sup> :XComponent将变成一个容器组件,并可在其中执行非UI逻辑以动态加载显示内容。 | | type | string | 是 | 用于指定XComponent组件类型,可选值为:<br/>-"surface":用于EGL/OpenGLES和媒体数据写入,组件内容单独送显,直接合成到屏幕。<br/>-"component"<sup>9+</sup> :XComponent将变成一个容器组件,并可在其中执行非UI逻辑以动态加载显示内容。 |
| libraryname | string | 否 | 应用Native层编译输出动态库名称,仅XComponent类型为"surface"时有效。 | | libraryname | string | 否 | 应用Native层编译输出动态库名称,仅XComponent类型为"surface"时有效。 |
| controller | [XComponentcontroller](#xcomponentcontroller) | 否 | 给组件绑定一个控制器,通过控制器调用组件方法,仅XComponent类型为"surface"时有效。 | | controller | [XComponentcontroller](#xcomponentcontroller) | 否 | 给组件绑定一个控制器,通过控制器调用组件方法,仅XComponent类型为"surface"时有效。 |
> **说明:** > **说明:**
> >
...@@ -46,7 +45,7 @@ ...@@ -46,7 +45,7 @@
## 事件 ## 事件
仅type为"surface"时以下事件有效。不支持[通用事件和手势](./Readme-CN.md) 仅type为"surface"时以下事件有效。不支持不支持[通用事件](ts-universal-events-click.md)[手势](ts-gesture-settings.md)
### onLoad ### onLoad
...@@ -56,9 +55,9 @@ onLoad(callback: (event?: object) => void ) ...@@ -56,9 +55,9 @@ onLoad(callback: (event?: object) => void )
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 描述 | | 参数名 | 参数类型 | 必填 | 描述 |
| ------------- | ------ | ---- | ----------------------- | | ----- | ------ | ---- | ---------------------------------------- |
| event | object | 否 | 获取XComponent实例对象的context,context上挂载的方法由开发者在c++层定义。 | | event | object | 否 | 获取XComponent实例对象的context,context上挂载的方法由开发者在c++层定义。 |
### onDestroy ### onDestroy
...@@ -99,7 +98,7 @@ setXComponentSurfaceSize(value: {surfaceWidth: number, surfaceHeight: number}): ...@@ -99,7 +98,7 @@ setXComponentSurfaceSize(value: {surfaceWidth: number, surfaceHeight: number}):
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 描述 | | 参数名 | 参数类型 | 必填 | 描述 |
| ------------- | ------ | ---- | ----------------------- | | ------------- | ------ | ---- | ----------------------- |
| surfaceWidth | number | 是 | XComponent持有Surface的宽度。 | | surfaceWidth | number | 是 | XComponent持有Surface的宽度。 |
| surfaceHeight | number | 是 | XComponent持有Surface的高度。 | | surfaceHeight | number | 是 | XComponent持有Surface的高度。 |
......
...@@ -22,12 +22,12 @@ Video(value: {src?: string | Resource, currentProgressRate?: number | string | P ...@@ -22,12 +22,12 @@ Video(value: {src?: string | Resource, currentProgressRate?: number | string | P
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 | | 参数名 | 参数类型 | 必填 | 参数描述 |
| ------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | ------------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| src | string \| [Resource](ts-types.md) | 否 | 视频播放源的路径,支持本地视频路径和网络路径。<br>支持在resources下面的video或rawfile文件夹里放置媒体资源。<br>支持dataability://的路径前缀,用于访问通过Data Ability提供的视频路径,具体路径信息详见[DataAbility说明](../../ability/fa-dataability.md)<br/>**说明:**<br/>视频支持的格式是:mp4、mkv、webm、TS。 | | src | string \| [Resource](ts-types.md) | 否 | 视频播放源的路径,支持本地视频路径和网络路径。<br>支持在resources下面的video或rawfile文件夹里放置媒体资源。<br>支持dataability://的路径前缀,用于访问通过Data Ability提供的视频路径,具体路径信息详见 [DataAbility说明](../../application-models/dataability-overview.md)<br/>**说明:**<br/>视频支持的格式是:mp4、mkv、webm、TS。 |
| currentProgressRate | number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;PlaybackSpeed<sup>8+</sup> | 否 | 视频播放倍速。<br/>**说明:**<br/>number取值仅支持:0.75,1.0,1.25,1.75,2.0。<br/>默认值:1.0 \| PlaybackSpeed.Speed_Forward_1_00_X | | currentProgressRate | number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;PlaybackSpeed<sup>8+</sup> | 否 | 视频播放倍速。<br/>**说明:**<br/>number取值仅支持:0.75,1.0,1.25,1.75,2.0。<br/>默认值:1.0 \| PlaybackSpeed.Speed_Forward_1_00_X |
| previewUri | string&nbsp;\|&nbsp;PixelMap<sup>8+</sup>&nbsp;\|&nbsp;[Resource](ts-types.md) | 否 | 视频未播放时的预览图片路径。 | | previewUri | string&nbsp;\|&nbsp;PixelMap<sup>8+</sup>&nbsp;\|&nbsp;[Resource](ts-types.md) | 否 | 视频未播放时的预览图片路径。 |
| controller | [VideoController](#videocontroller) | 否 | 设置视频控制器。 | | controller | [VideoController](#videocontroller) | 否 | 设置视频控制器。 |
## PlaybackSpeed<sup>8+</sup>枚举说明 ## PlaybackSpeed<sup>8+</sup>枚举说明
...@@ -43,29 +43,29 @@ Video(value: {src?: string | Resource, currentProgressRate?: number | string | P ...@@ -43,29 +43,29 @@ Video(value: {src?: string | Resource, currentProgressRate?: number | string | P
除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性:
| 名称 | 参数类型 | 描述 | | 名称 | 参数类型 | 描述 |
| --------- | ---------------------------------------- | ----------------------------------------------- | | --------- | ---------------------------------------- | ---------------------------- |
| muted | boolean | 是否静音。<br/>默认值:false | | muted | boolean | 是否静音。<br/>默认值:false |
| autoPlay | boolean | 是否自动播放。<br/>默认值:false | | autoPlay | boolean | 是否自动播放。<br/>默认值:false |
| controls | boolean | 控制视频播放的控制栏是否显示。<br/>默认值:true | | controls | boolean | 控制视频播放的控制栏是否显示。<br/>默认值:true |
| objectFit | [ImageFit](ts-basic-components-image.md) | 设置视频显示模式。<br/>默认值:Cover | | objectFit | [ImageFit](ts-basic-components-image.md) | 设置视频显示模式。<br/>默认值:Cover |
| loop | boolean | 是否单个视频循环播放。<br/>默认值:false | | loop | boolean | 是否单个视频循环播放。<br/>默认值:false |
## 事件 ## 事件
除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: 除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件:
| 名称 | 功能描述 | | 名称 | 功能描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ---------------------------------------- | ---------------------------------------- |
| onStart(event:()&nbsp;=&gt;&nbsp;void) | 播放时触发该事件。 | | onStart(event:()&nbsp;=&gt;&nbsp;void) | 播放时触发该事件。 |
| onPause(event:()&nbsp;=&gt;&nbsp;void) | 暂停时触发该事件。 | | onPause(event:()&nbsp;=&gt;&nbsp;void) | 暂停时触发该事件。 |
| onFinish(event:()&nbsp;=&gt;&nbsp;void) | 播放结束时触发该事件。 | | onFinish(event:()&nbsp;=&gt;&nbsp;void) | 播放结束时触发该事件。 |
| onError(event:()&nbsp;=&gt;&nbsp;void) | 播放失败时触发该事件。 | | onError(event:()&nbsp;=&gt;&nbsp;void) | 播放失败时触发该事件。 |
| onPrepared(callback:(event?:&nbsp;{&nbsp;duration:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 视频准备完成时触发该事件,通过duration可以获取视频时长,单位为秒(s)。 | | onPrepared(callback:(event?:&nbsp;{&nbsp;duration:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 视频准备完成时触发该事件,通过duration可以获取视频时长,单位为秒(s)。 |
| onSeeking(callback:(event?:&nbsp;{&nbsp;time:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 操作进度条过程时上报时间信息,单位为s。 | | onSeeking(callback:(event?:&nbsp;{&nbsp;time:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 操作进度条过程时上报时间信息,单位为s。 |
| onSeeked(callback:(event?:&nbsp;{&nbsp;time:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 操作进度条完成后,上报播放时间信息,单位为s。 | | onSeeked(callback:(event?:&nbsp;{&nbsp;time:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 操作进度条完成后,上报播放时间信息,单位为s。 |
| onUpdate(callback:(event?:&nbsp;{&nbsp;time:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 播放进度变化时触发该事件,单位为s,更新时间间隔为250ms。 | | onUpdate(callback:(event?:&nbsp;{&nbsp;time:&nbsp;number&nbsp;})&nbsp;=&gt;&nbsp;void) | 播放进度变化时触发该事件,单位为s,更新时间间隔为250ms。 |
| onFullscreenChange(callback:(event?:&nbsp;{&nbsp;fullscreen:&nbsp;boolean&nbsp;})&nbsp;=&gt;&nbsp;void) | 在全屏播放与非全屏播放状态之间切换时触发该事件,返回值为true表示进入全屏播放状态,为false则表示非全屏播放。 | | onFullscreenChange(callback:(event?:&nbsp;{&nbsp;fullscreen:&nbsp;boolean&nbsp;})&nbsp;=&gt;&nbsp;void) | 在全屏播放与非全屏播放状态之间切换时触发该事件,返回值为true表示进入全屏播放状态,为false则表示非全屏播放。 |
## VideoController ## VideoController
...@@ -106,9 +106,9 @@ setCurrentTime(value: number) ...@@ -106,9 +106,9 @@ setCurrentTime(value: number)
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 | | 参数名 | 参数类型 | 必填 | 参数描述 |
| ------ | -------- | ---- | --------------------------- | | ----- | ------ | ---- | -------------- |
| value | number | 是 | 视频播放进度位置,单位为s。 | | value | number | 是 | 视频播放进度位置,单位为s。 |
### requestFullscreen ### requestFullscreen
...@@ -118,8 +118,8 @@ requestFullscreen(value: boolean) ...@@ -118,8 +118,8 @@ requestFullscreen(value: boolean)
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 | | 参数名 | 参数类型 | 必填 | 参数描述 |
| ----- | ------ | ---- | ------- | | ----- | ------- | ---- | --------------------- |
| value | boolean | 是 | 是否全屏播放。<br/>默认值:false | | value | boolean | 是 | 是否全屏播放。<br/>默认值:false |
### exitFullscreen ### exitFullscreen
...@@ -136,10 +136,10 @@ setCurrentTime(value: number, seekMode: SeekMode) ...@@ -136,10 +136,10 @@ setCurrentTime(value: number, seekMode: SeekMode)
**参数:** **参数:**
| 参数名 | 参数类型 | 必填 | 参数描述 | | 参数名 | 参数类型 | 必填 | 参数描述 |
| -------- | -------- | ---- | ------------------ | | -------- | -------- | ---- | -------------- |
| value | number | 是 | 视频播放进度位置,单位为s。 | | value | number | 是 | 视频播放进度位置,单位为s。 |
| seekMode | SeekMode | 是 | 跳转模式。 | | seekMode | SeekMode | 是 | 跳转模式。 |
## SeekMode<sup>8+</sup>枚举说明 ## SeekMode<sup>8+</sup>枚举说明
......
...@@ -58,6 +58,6 @@ JS服务卡片(entry/src/main/js/Widget)的典型开发目录结构如下: ...@@ -58,6 +58,6 @@ JS服务卡片(entry/src/main/js/Widget)的典型开发目录结构如下:
## 配置文件 ## 配置文件
FA卡片需要在应用配置文件config.json中进行配置。详细的配置内容请参考[FA卡片配置文件说明](../../ability/fa-formability.md#配置卡片配置文件) FA卡片需要在应用配置文件config.json中进行配置。详细的配置内容请参考[FA卡片配置文件说明](../../application-models/widget-development-fa.md#配置卡片配置文件)
Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../ability/stage-formextension.md#配置卡片配置文件) Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/widget-development-stage.md#配置卡片配置文件)
\ No newline at end of file \ No newline at end of file
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
| 开发范式名称 | 简介 | 适用场景 | 适用人群 | | 开发范式名称 | 简介 | 适用场景 | 适用人群 |
| -------- | ---------------------------------------- | ---------------- | ------------------- | | -------- | ---------------------------------------- | ---------------- | ------------------- |
| 声明式开发范式 | 采用基于TypeScript进行声明式UI语法扩展而来的[ArkTS语言](../quick-start/arkts-get-started.md),从组件、动画和状态管理三个维度提供了UI绘制能力。声明式开发范式更接近自然语义的编程方式,让开发者直观地描述UI界面,不必关心框架如何实现UI绘制和渲染,实现极简高效开发。 | 复杂度较大、团队合作度较高的应用 | 移动系统应用开发人员、系统应用开发人员 | | 声明式开发范式 | 采用基于TypeScript进行声明式UI语法扩展而来的[ArkTS语言](../quick-start/arkts-get-started.md),从组件、动画和状态管理三个维度提供了UI绘制能力。声明式开发范式更接近自然语义的编程方式,让开发者直观地描述UI界面,不必关心框架如何实现UI绘制和渲染,实现极简高效开发。 | 复杂度较大、团队合作度较高的应用 | 移动系统应用开发人员、系统应用开发人员 |
| 类Web开发范式 | 采用经典的HML、CSS、JavaScript三段式开发方式,使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发刷新。该开发方式更接近Web前端开发者的使用习惯,便于快速将已有的Web应用改造成方舟开发框架应用。 | 界面较简单的中小型应用和卡片 | Web前端开发人员 | | 类Web开发范式 | 采用经典的HML、CSS、JavaScript三段式开发方式,使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发刷新。该开发方式更接近Web前端开发者的使用习惯,便于快速将已有的Web应用改造成方舟开发框架应用。 | 界面较简单的中小型应用和卡片 | Web前端开发人员 |
## 框架结构 ## 框架结构
...@@ -37,24 +37,24 @@ ...@@ -37,24 +37,24 @@
## UI与Ability框架的关系 ## UI与Ability框架的关系
Ability也是OpenHarmony应用的重要组成部分,[Ability框架](../ability/ability-brief.md)包括FA模型与Stage模型两种模型。下表给出了Ability框架的两种模型分别与方舟开发框架的两种开发范式的关系。 OpenHarmony提供了FA模型与Stage模型两种[应用模型](../application-models/application-model-description.md)。下表给出了两种模型分别与方舟开发框架的两种开发范式的关系。
**FA模型:** **FA模型:**
| 类型 | UI开发范式 | 说明 | | 类型 | UI开发范式 | 说明 |
| -------- | --------------------------- | --------------------------- | | ---- | -------- | ---------------------------------------- |
| 应用 | 类web开发范式 | UI开发语言:使用hml/css/js <br>业务入口:使用固定文件名app.ets(Page类型Ability)/service.ts(Service类型Ability)/data.ts(Data类型Ability)<br>业务逻辑语言:js/ts | | 应用 | 类web开发范式 | UI开发语言:使用hml/css/js <br>业务入口:使用固定文件名app.ets(Page类型Ability)/service.ts(Service类型Ability)/data.ts(Data类型Ability)<br>业务逻辑语言:js/ts |
| | 声明式开发范式 | UI开发语言:ArkTS <br>业务入口:使用固定文件名app.ets(Page类型Ability)/service.ts(Service类型Ability)/data.ts(Data类型Ability) <br>业务逻辑语言:js/ts | | | 声明式开发范式 | UI开发语言:ArkTS <br>业务入口:使用固定文件名app.ets(Page类型Ability)/service.ts(Service类型Ability)/data.ts(Data类型Ability) <br>业务逻辑语言:js/ts |
| 服务卡片 | 类web开发范式 | UI开发语言:卡片显示使用hml+css+json(action) <br>业务入口:form.ts <br>卡片业务逻辑语言:js/ts | | 服务卡片 | 类web开发范式 | UI开发语言:卡片显示使用hml+css+json(action) <br>业务入口:form.ts <br>卡片业务逻辑语言:js/ts |
| | 声明式开发范式 | 当前不支持 | | | 声明式开发范式 | 当前不支持 |
**Stage模型:** **Stage模型:**
| 类型 | UI开发范式 | 说明 | | 类型 | UI开发范式 | 说明 |
| -------- | --------------------------- | --------------------------- | | ---- | -------- | ---------------------------------------- |
| 应用 | 类web开发范式 | 当前不支持 | | 应用 | 类web开发范式 | 当前不支持 |
| | 声明式开发范式 | UI开发语言:ArkTS <br>业务入口:应用模型基于ohos.application.Ability/ExtensionAbility等派生 <br>业务逻辑语言:ts | | | 声明式开发范式 | UI开发语言:ArkTS <br>业务入口:应用模型基于ohos.application.Ability/ExtensionAbility等派生 <br>业务逻辑语言:ts |
| 服务卡片 | 类web开发范式 | UI开发语言:卡片显示使用hml+css+json(action) <br>业务入口:从FormExtensionAbility派生 <br>业务逻辑语言:ts | | 服务卡片 | 类web开发范式 | UI开发语言:卡片显示使用hml+css+json(action) <br>业务入口:从FormExtensionAbility派生 <br>业务逻辑语言:ts |
| | 声明式开发范式 | 当前不支持 | | | 声明式开发范式 | 当前不支持 |
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
## 定义资源文件 ## 定义资源文件
资源文件用于存放应用在多种语言场景下的资源内容,开发框架使用JSON文件保存资源定义。在[文件组织](../ui/js-framework-file.md)中指定的i18n文件夹内放置语言资源文件,其中语言资源文件的命名是由语言、文字、国家或地区的限定词通过中划线连接组成,其中文字和国家或地区可以省略,如zh-Hant-HK(中国香港地区使用的繁体中文)、zh-CN(中国使用的简体中文)、zh(中文)。命名规则如下: 资源文件用于存放应用在多种语言场景下的资源内容,开发框架使用JSON文件保存资源定义。在[文件组织](js-framework-file.md)中指定的i18n文件夹内放置语言资源文件,其中语言资源文件的命名是由语言、文字、国家或地区的限定词通过中划线连接组成,其中文字和国家或地区可以省略,如zh-Hant-HK(中国香港地区使用的繁体中文)、zh-CN(中国使用的简体中文)、zh(中文)。命名规则如下:
``` ```
language[-script-region].json language[-script-region].json
...@@ -183,4 +183,4 @@ ar-AE.json ...@@ -183,4 +183,4 @@ ar-AE.json
## 获取语言 ## 获取语言
获取语言功能请参考[应用配置](../reference/apis/js-apis-configuration.md) 获取语言功能请参考[应用配置](../reference/apis/js-apis-application-configuration.md)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册