提交 34b6eddf 编写于 作者: H HelloCrease

update docs

Signed-off-by: NHelloCrease <lian15@huawei.com>
上级 2a117db1
......@@ -26,7 +26,7 @@ In this section, we will develop an infographic food details page, by building c
![en-us_image_0000001222967780](figures/en-us_image_0000001222967780.png)
2. Display food pictures.
Create an &lt;Image&gt; component and specify a URL for it. The &lt;Image&gt; and &lt;Text&gt; components are mandatory. To display the &lt;Text&gt; component above the &lt;Image&gt; component, you need to declare the &lt;Image&gt; component first. Image resources are stored in the rawfile folder in resources. When referencing the resources in the rawfile folder, use the $rawfile('_filename_ loaded) format, where filename indicates the relative path of the file in the rawfile folder. Currently, $rawfile only allows the &lt;Image&gt; component to reference image resources.
Create an &lt;Image&gt; component and specify a URL for it. The &lt;Image&gt; and &lt;Text&gt; components are mandatory. To display the &lt;Text&gt; component above the &lt;Image&gt; component, you need to declare the &lt;Image&gt; component first. Image resources are stored in the rawfile folder in resources. When referencing the resources in the rawfile folder, use the `"$rawfile('filename')"` format, where filename indicates the relative path of the file in the rawfile folder. Currently, `$rawfile` only allows the &lt;Image&gt; component to reference image resources.
```
@Entry
......@@ -54,7 +54,7 @@ In this section, we will develop an infographic food details page, by building c
![en-us_image_0000001222807784](figures/en-us_image_0000001222807784.png)
You can then can reference the application resource in the $r('app.type.name') format, that is, $r('app.media.Tomato').
You can then can reference the application resource in the ` "$r('app.type.name')"` format, that is, `$r('app.media.Tomato')`.
```
......@@ -74,13 +74,10 @@ In this section, we will develop an infographic food details page, by building c
}
```
4. Set the width and height of the image, and set the objectFit attribute of the image to ImageFit.Contain, which means to keep the aspect ratio of the image to ensure that the image is completely displayed within the boundary.
If the image fills the entire screen, the possible causes are as follows:
4. Set the width and height of the image, and set the objectFit attribute of the image to ImageFit.Contain, which means to keep the aspect ratio of the image to ensure that the image is completely displayed within the boundary.If the image fills the entire screen, the possible causes are as follows:
1. The width and height of the image are not set.
2. The default attribute of objectFit of the image is ImageFit.Cover, that is, the image is zoomed in or zoomed out to fill the entire display boundary with the aspect ratio locked.
```
@Entry
@Component
......@@ -98,11 +95,11 @@ In this section, we will develop an infographic food details page, by building c
}
```
![en-us_image_0000001223127732](figures/en-us_image_0000001223127732.png)
![en-us_image_0000001223127732](figures/en-us_image_0000001223127732.png)
5. Set the food image and name layout. Set the alignment mode of the stack to bottom alignment. By default, the stack is center aligned. Set alignContent to Alignment.BottomStart. Similar to FontWeight, Alignment is a built-in enumeration type provided by the framework.
```
```
@Entry
@Component
struct MyComponent {
......@@ -117,7 +114,7 @@ In this section, we will develop an infographic food details page, by building c
}
}
}
```
```
![en-us_image_0000001267647873](figures/en-us_image_0000001267647873.png)
......@@ -556,3 +553,7 @@ The following sample is provided to help you better understand how to use build
- [eTSBuildCommonView](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/eTSBuildCommonView)
This sample shows how to build a common view to display the picture of tomatoes and nutrition information, with the stack layout and flex layout.
```
```
\ No newline at end of file
......@@ -14,22 +14,22 @@
| 名称 | 参数 | 描述 | 是否支持冒泡 |
| -------- | -------- | -------- | -------- |
| touchstart | TouchEvent | 手指刚触摸屏幕时触发该事件。<br>> **说明:**TouchEvent具体可参考表2 TouchEvent对象属性列表 | 是<sup>5+</sup> |
| ------------------------ | ---------- | ---------------------------------------- | -------------- |
| touchstart | TouchEvent | 手指刚触摸屏幕时触发该事件。<br>> **说明:** TouchEvent具体可参考表2 TouchEvent对象属性列表 | 是<sup>5+</sup> |
| touchmove | TouchEvent | 手指触摸屏幕后移动时触发该事件。 | 是<sup>5+</sup> |
| touchcancel | TouchEvent | 手指触摸屏幕中动作被打断时触发该事件。 | 是<sup>5+</sup> |
| touchend | TouchEvent | 手指触摸结束离开屏幕时触发该事件。 | 是<sup>5+</sup> |
| click | - | 点击动作触发该事件。 | 是<sup>6+</sup> |
| doubleclick<sup>7+</sup> | - | 双击动作触发该事件 | 否 |
| longpress | - | 长按动作触发该事件。 | 否 |
| swipe<sup>5+</sup> | SwipeEvent | 组件上快速滑动后触发该事件。<br/>> **说明:**SwipeEvent具体可参考表6 SwipeEvent 基础事件对象属性列表 | 否 |
| swipe<sup>5+</sup> | SwipeEvent | 组件上快速滑动后触发该事件。<br/>> **说明:** SwipeEvent具体可参考表6 SwipeEvent 基础事件对象属性列表 | 否 |
| attached<sup>6+</sup> | - | 当前组件节点挂载在渲染树后触发。 | 否 |
| detached<sup>6+</sup> | - | 当前组件节点从渲染树中移除后触发。 | 否 |
| pinchstart<sup>7+</sup> | PinchEvent | 手指开始执行捏合操作时触发该事件。<br/>> **说明:**PinchEvent具体可参考表7 PinchEvent 对象属性列表 | 否 |
| pinchstart<sup>7+</sup> | PinchEvent | 手指开始执行捏合操作时触发该事件。<br/>> **说明:** PinchEvent具体可参考表7 PinchEvent 对象属性列表 | 否 |
| pinchupdate<sup>7+</sup> | PinchEvent | 手指执行捏合操作过程中触发该事件。 | 否 |
| pinchend<sup>7+</sup> | PinchEvent | 手指捏合操作结束离开屏幕时触发该事件。 | 否 |
| pinchcancel<sup>7+</sup> | PinchEvent | 手指捏合操作被打断时触发该事件。 | 否 |
| dragstart<sup>7+</sup> | DragEvent | 用户开始拖拽时触发该事件。<br/>> **说明:**DragEvent具体可参考表8 DragEvent对象属性列表 | 否 |
| dragstart<sup>7+</sup> | DragEvent | 用户开始拖拽时触发该事件。<br/>> **说明:** DragEvent具体可参考表8 DragEvent对象属性列表 | 否 |
| drag<sup>7+</sup> | DragEvent | 拖拽过程中触发该事件。 | 否 |
| dragend<sup>7+</sup> | DragEvent | 用户拖拽完成后触发。 | 否 |
| dragenter<sup>7+</sup> | DragEvent | 进入释放目标时触发该事件。 | 否 |
......@@ -44,21 +44,21 @@
**表1** BaseEvent对象属性列表
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| --------- | ------ | --------------------------- |
| type | string | 当前事件的类型,比如click、longpress等。 |
| timestamp | number | 该事件触发时的时间戳。 |
**表2** TouchEvent对象属性列表(继承BaseEvent)
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| -------------- | ---------------------- | ---------------------------------------- |
| touches | Array&lt;TouchInfo&gt; | 触摸事件时的属性集合,包含屏幕触摸点的信息数组。 |
| changedTouches | Array&lt;TouchInfo&gt; | 触摸事件时的属性集合,包括产生变化的屏幕触摸点的信息数组。数据格式和touches一样。该属性表示有变化的触摸点,如从无变有,位置变化,从有变无。例如用户手指刚接触屏幕时,touches数组中有数据,但changedTouches无数据。 |
**表3** TouchInfo
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| ------------------ | ------ | ------------------------------ |
| globalX | number | 距离屏幕左上角(不包括状态栏)横向距离。屏幕的左上角为原点。 |
| globalY | number | 距离屏幕左上角(不包括状态栏)纵向距离。屏幕的左上角为原点。 |
| localX | number | 距离被触摸组件左上角横向距离。组件的左上角为原点。 |
......@@ -69,14 +69,14 @@
**表6** SwipeEvent 基础事件对象属性列表(继承BaseEvent)
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| --------------------- | ------ | ---------------------------------------- |
| direction | string | 滑动方向,可能值有:<br/>1.&nbsp;left:向左滑动;<br/>2.&nbsp;right:向右滑动;<br/>3.&nbsp;up:向上滑动;<br/>4.&nbsp;down:向下滑动。 |
| distance<sup>6+</sup> | number | 在滑动方向上的滑动距离。 |
**表7** PinchEvent 对象属性列表<sup>7+</sup>
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| ------------ | ------ | -------------- |
| scale | number | 缩放比例 |
| pinchCenterX | number | 捏合中心点X轴坐标,单位px |
| pinchCenterY | number | 捏合中心点Y轴坐标,单位px |
......@@ -84,7 +84,7 @@
**表8** DragEvent对象属性列表(继承BaseEvent)<sup>7+</sup>
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| --------- | ------ | ---------------- |
| type | string | 事件名称。 |
| globalX | number | 距离屏幕左上角坐标原点横向距离。 |
| globalY | number | 距离屏幕左上角坐标原点纵向距离。 |
......@@ -97,7 +97,7 @@
**target对象:**
| 属性 | 类型 | 说明 |
| -------- | -------- | -------- |
| -------------------- | ------ | ---------------------------------------- |
| dataSet<sup>6+</sup> | Object | 组件上通过通用属性设置的[data-*](../arkui-js/js-components-common-attributes.md)的自定义属性组成的集合。 |
**示例:**
......
......@@ -24,7 +24,7 @@
![zh-cn_image_0000001214128687](figures/zh-cn_image_0000001214128687.png)
2. 食物图片展示。
创建Image组件,指定Image组件的url,Image组件和Text组件都是必选构造参数组件。为了让Text组件在Image组件上方显示,所以要先声明Image组件。图片资源放在resources下的rawfile文件夹内,引用rawfile下资源时使用“$rawfile('filename')”的形式,filename为rawfile目录下的文件相对路径。当前$rawfile仅支持Image控件引用图片资源。
创建Image组件,指定Image组件的url,Image组件和Text组件都是必选构造参数组件。为了让Text组件在Image组件上方显示,所以要先声明Image组件。图片资源放在resources下的rawfile文件夹内,引用rawfile下资源时使用`$rawfile('filename')`的形式,filename为rawfile目录下的文件相对路径。当前`$rawfile`仅支持Image控件引用图片资源。
```
@Entry
@Component
......@@ -51,7 +51,7 @@
![zh-cn_image_0000001214330169](figures/zh-cn_image_0000001214330169.png)
就可以通过“$r('app.type.name')”的形式引用应用资源,即$r('app.media.Tomato')
就可以通过`$r('app.type.name')`的形式引用应用资源,即`$r('app.media.Tomato')`
```
@Entry
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册