提交 9386214c 编写于 作者: T tianyu

updata photo

Signed-off-by: Ntianyu <tianyu55@h-partners.com>
上级 141c0528
...@@ -32,3 +32,71 @@ ...@@ -32,3 +32,71 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 属性和样式不能混用,不能在属性字段中进行样式设置。 > 属性和样式不能混用,不能在属性字段中进行样式设置。
## 示例
```html
<!-- xxx.hml -->
<div id="container">
<button class="btn" type="capsule" value="toggleDisplay" onclick="toggleDisplay"></button>
<list class="list">
<list-item for="{{ array }}" class="listItem">
<text class="text" onclick="toggleShow" show="{{ visible }}"
if="{{ display }}">{{ $item.value }}</text>
</list-item>
</list>
</div>
```
```css
/* xxx.css */
#container {
flex-direction: column;
width: 100%;
margin-top: 10px;
}
.text {
font-size: 50px;
font-weight: 500;
margin-left: 12px;
}
.listItem {
width: 100%;
height: 100px;
line-height: 60px;
border-bottom: 1px solid #DEDEDE;
font-size: 20px;
}
.btn{
width: 280px;
font-size: 26px;
margin: 10px 0;
}
```
```js
/* xxx.js */
export default {
data: {
visible: true,
display: true,
title: "",
i: 4,
array: [
{"value": "列表文本0"},
{"value": "列表文本1"},
{"value": "列表文本2"},
{"value": "列表文本3"},
],
},
toggleShow: function() {
this.array.push({"value": "列表文本" + this.i })
this.i++
},
toggleDisplay: function() {
this.display = !this.display
},
}
```
![zh-cn-attributes](figures/zh-cn-attributes.gif)
\ No newline at end of file
...@@ -13,29 +13,29 @@ ...@@ -13,29 +13,29 @@
相对于私有事件,大部分组件都可以绑定如下事件。 相对于私有事件,大部分组件都可以绑定如下事件。
| 名称 | 参数 | 描述 | 是否支持冒泡 | | 名称 | 参数 | 描述 | 是否支持冒泡 | 是否支持捕获 |
| ------------------------ | ---------- | ---------------------------------------- | -------------- | | ------------------------ | ---------- | ------------------------------------------------------------ | --------------- | --------------- |
| touchstart | TouchEvent | 手指刚触摸屏幕时触发该事件。<br>> **说明:** TouchEvent具体可参考表2 TouchEvent对象属性列表 | 是<sup>5+</sup> | | touchstart | TouchEvent | 手指刚触摸屏幕时触发该事件。<br>> **说明:** TouchEvent具体可参考表2 TouchEvent对象属性列表 | 是<sup>5+</sup> |<sup>5+</sup> |
| touchmove | TouchEvent | 手指触摸屏幕后移动时触发该事件。 | 是<sup>5+</sup> | | touchmove | TouchEvent | 手指触摸屏幕后移动时触发该事件。 | 是<sup>5+</sup> | 是<sup>5+</sup> |
| touchcancel | TouchEvent | 手指触摸屏幕中动作被打断时触发该事件。 | 是<sup>5+</sup> | | touchcancel | TouchEvent | 手指触摸屏幕中动作被打断时触发该事件。 | 是<sup>5+</sup> | 是<sup>5+</sup> |
| touchend | TouchEvent | 手指触摸结束离开屏幕时触发该事件。 | 是<sup>5+</sup> | | touchend | TouchEvent | 手指触摸结束离开屏幕时触发该事件。 | 是<sup>5+</sup> | 是<sup>5+</sup> |
| click | - | 点击动作触发该事件。 | 是<sup>6+</sup> | | click | - | 点击动作触发该事件。 | 是<sup>6+</sup> | 否 |
| doubleclick<sup>7+</sup> | - | 双击动作触发该事件 | 否 | | doubleclick<sup>7+</sup> | - | 双击动作触发该事件 | 否 | 否 |
| longpress | - | 长按动作触发该事件。 | 否 | | longpress | - | 长按动作触发该事件。 | 否 | 否 |
| swipe<sup>5+</sup> | SwipeEvent | 组件上快速滑动后触发该事件。<br/>> **说明:** SwipeEvent具体可参考表6 SwipeEvent 基础事件对象属性列表 | 否 | | swipe<sup>5+</sup> | SwipeEvent | 组件上快速滑动后触发该事件。<br/>> **说明:** SwipeEvent具体可参考表6 SwipeEvent 基础事件对象属性列表 | 否 | 否 |
| attached<sup>6+</sup> | - | 当前组件节点挂载在渲染树后触发。 | 否 | | attached<sup>6+</sup> | - | 当前组件节点挂载在渲染树后触发。 | 否 | 否 |
| detached<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 | 手指执行捏合操作过程中触发该事件。 | 否 | | pinchupdate<sup>7+</sup> | PinchEvent | 手指执行捏合操作过程中触发该事件。 | 否 | 否 |
| pinchend<sup>7+</sup> | PinchEvent | 手指捏合操作结束离开屏幕时触发该事件。 | 否 | | pinchend<sup>7+</sup> | PinchEvent | 手指捏合操作结束离开屏幕时触发该事件。 | 否 | 否 |
| pinchcancel<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 | 拖拽过程中触发该事件。 | 否 | | drag<sup>7+</sup> | DragEvent | 拖拽过程中触发该事件。 | 否 | 否 |
| dragend<sup>7+</sup> | DragEvent | 用户拖拽完成后触发。 | 否 | | dragend<sup>7+</sup> | DragEvent | 用户拖拽完成后触发。 | 否 | 否 |
| dragenter<sup>7+</sup> | DragEvent | 进入释放目标时触发该事件。 | 否 | | dragenter<sup>7+</sup> | DragEvent | 进入释放目标时触发该事件。 | 否 | 否 |
| dragover<sup>7+</sup> | DragEvent | 在释放目标内拖动时触发。 | 否 | | dragover<sup>7+</sup> | DragEvent | 在释放目标内拖动时触发。 | 否 | 否 |
| dragleave<sup>7+</sup> | DragEvent | 离开释放目标区域时触发。 | 否 | | dragleave<sup>7+</sup> | DragEvent | 离开释放目标区域时触发。 | 否 | 否 |
| drop<sup>7+</sup> | DragEvent | 在可释放目标区域内释放时触发。 | 否 | | drop<sup>7+</sup> | DragEvent | 在可释放目标区域内释放时触发。 | 否 | 否 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
- RouteType枚举说明 - RouteType枚举说明
| 名称 | 描述 | | 名称 | 描述 |
| -------- | -------- | | -------- | -------- |
| Pop | PageA跳转到PageB时,PageA为Exit+Push,PageB为Enter+Push。 | | Pop | 重定向指定页面 |
| Push | PageB返回至PageA时,PageA为Enter+Pop,PageB为Exit+Pop。 | | Push | 跳转到下一页面。 |
## 属性 ## 属性
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
### 案例1 ### 案例1
``` ```
//父组件ViewB中的类对象ClassB,其包含的对象ClassA与子组件ViewA数据同步时,通过ObjectLink将数据c值的变化状态通知给父组件同步变化。
@Observed @Observed
class ClassA { class ClassA {
public name : string; public name : string;
...@@ -77,7 +78,7 @@ struct ViewA { ...@@ -77,7 +78,7 @@ struct ViewA {
.width(100) .width(100)
.margin(2) .margin(2)
.onClick(() => { .onClick(() => {
this.a = new ClassA(0); // ERROR, this.a is immutable this.a = new ClassA(0); // 错误:ObjectLink装饰的变量a是不可变的
}) })
} }
} }
...@@ -119,6 +120,7 @@ struct ViewB { ...@@ -119,6 +120,7 @@ struct ViewB {
### 案例2 ### 案例2
``` ```
//父组件ViewB中的类对象ClassA与子组件ViewA保持数据同步时,可以使用@ObjectLink和@Observed,绑定该数据对象的父组件和其他子组件同步更新
var nextID: number = 0; var nextID: number = 0;
@Observed @Observed
class ClassA { class ClassA {
...@@ -142,7 +144,7 @@ struct ViewA { ...@@ -142,7 +144,7 @@ struct ViewA {
.onClick(() => { .onClick(() => {
this.a.c += 1; this.a.c += 1;
}) })
} }.margin({ top: 10 })
} }
} }
...@@ -161,14 +163,17 @@ struct ViewB { ...@@ -161,14 +163,17 @@ struct ViewB {
ViewA({label: `ViewA this.arrA[last]`, a: this.arrA[this.arrA.length-1]}) ViewA({label: `ViewA this.arrA[last]`, a: this.arrA[this.arrA.length-1]})
Button(`ViewB: reset array`) Button(`ViewB: reset array`)
.margin({ top: 10 })
.onClick(() => { .onClick(() => {
this.arrA = [ new ClassA(0), new ClassA(0) ]; this.arrA = [ new ClassA(0), new ClassA(0) ];
}) })
Button(`ViewB: push`) Button(`ViewB: push`)
.margin({ top: 10 })
.onClick(() => { .onClick(() => {
this.arrA.push(new ClassA(0)) this.arrA.push(new ClassA(0))
}) })
Button(`ViewB: shift`) Button(`ViewB: shift`)
.margin({ top: 10 })
.onClick(() => { .onClick(() => {
this.arrA.shift() this.arrA.shift()
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册