提交 243ecd50 编写于 作者: T tianyu

update docs

Signed-off-by: Ntianyu <tianyu55@h-partners.com>
上级 acea059c
...@@ -133,7 +133,7 @@ back(options?: RouterOptions ): void ...@@ -133,7 +133,7 @@ back(options?: RouterOptions ): void
**示例:** **示例:**
```js ```js
router.back({uri:'pages/detail'}); router.back({url:'pages/detail'});
``` ```
## router.clear ## router.clear
...@@ -313,7 +313,7 @@ export default { ...@@ -313,7 +313,7 @@ export default {
// 在detail页面中 // 在detail页面中
export default { export default {
onInit() { onInit() {
console.info('showData1:' + router.getParams().data1); console.info('showData1:' + router.getParams()[data1]);
} }
} }
``` ```
......
...@@ -22,7 +22,7 @@ addColorStop(offset: number, color: string): void ...@@ -22,7 +22,7 @@ addColorStop(offset: number, color: string): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
<input type="button" style="width: 180px; height: 60px;" value="fillStyle"onclick="handleClick" /> <input type="button" style="width: 180px; height: 60px;" value="fillStyle"onclick="handleClick" />
</div> </div>
``` ```
......
...@@ -21,7 +21,7 @@ addPath(path: Object): void ...@@ -21,7 +21,7 @@ addPath(path: Object): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 500px; height: 500px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -61,7 +61,7 @@ setTransform(scaleX: number, skewX: number, skewY: number, scaleY: number, trans ...@@ -61,7 +61,7 @@ setTransform(scaleX: number, skewX: number, skewY: number, scaleY: number, trans
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -91,7 +91,7 @@ closePath(): void ...@@ -91,7 +91,7 @@ closePath(): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -130,7 +130,7 @@ moveTo(x: number, y: number): void ...@@ -130,7 +130,7 @@ moveTo(x: number, y: number): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 300px; height: 250px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 300px; height: 250px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -169,7 +169,7 @@ lineTo(x: number, y: number): void ...@@ -169,7 +169,7 @@ lineTo(x: number, y: number): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 400px; height: 450px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 400px; height: 450px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -213,7 +213,7 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, ...@@ -213,7 +213,7 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number,
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -252,7 +252,7 @@ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void ...@@ -252,7 +252,7 @@ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -293,7 +293,7 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, ...@@ -293,7 +293,7 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number,
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -332,7 +332,7 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void ...@@ -332,7 +332,7 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 200px; height: 150px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -374,7 +374,7 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number ...@@ -374,7 +374,7 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
...@@ -412,7 +412,7 @@ rect(x: number, y: number, width: number, height: number): void ...@@ -412,7 +412,7 @@ rect(x: number, y: number, width: number, height: number): void
```html ```html
<!-- xxx.hml --> <!-- xxx.hml -->
<div> <div>
<canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"</canvas> <canvas ref="canvas" style="width: 500px; height: 450px; background-color: #ffff00;"></canvas>
</div> </div>
``` ```
......
...@@ -234,8 +234,8 @@ struct ImageExample2 { ...@@ -234,8 +234,8 @@ struct ImageExample2 {
@Entry @Entry
@Component @Component
struct ImageExample3 { struct ImageExample3 {
@State width: number = 0 @State widthValue: number = 0
@State height: number = 0 @State heightValue: number = 0
private on: Resource = $r('app.media.image_on') private on: Resource = $r('app.media.image_on')
private off: Resource = $r('app.media.image_off') private off: Resource = $r('app.media.image_off')
private on2off: Resource = $r('app.media.image_on2off') private on2off: Resource = $r('app.media.image_on2off')
...@@ -256,8 +256,8 @@ struct ImageExample3 { ...@@ -256,8 +256,8 @@ struct ImageExample3 {
.height(180).width(180) .height(180).width(180)
// 图片加载完成后,获取图片尺寸。 // 图片加载完成后,获取图片尺寸。
.onComplete((msg: { width: number,height: number }) => { .onComplete((msg: { width: number,height: number }) => {
this.width = msg.width this.widthValue = msg.width
this.height = msg.height this.heightValue = msg.height
}) })
.onError(() => { .onError(() => {
console.log('load image fail') console.log('load image fail')
......
...@@ -61,13 +61,15 @@ struct RemoteWindowExample { ...@@ -61,13 +61,15 @@ struct RemoteWindowExample {
@State target: WindowAnimationTarget = undefined // 通过windowAnimationManager获取 @State target: WindowAnimationTarget = undefined // 通过windowAnimationManager获取
build() { build() {
RemoteWindow(this.target) Column() {
.translate({x:100, y:200}) RemoteWindow(this.target)
.scale({x:0.5, y:0.5}) .translate({x:100, y:200})
.scale({x:0.5, y:0.5})
.opacity(0.8) .opacity(0.8)
.position({x:px2vp(this.target?.windowBounds.left), y:px2vp(this.target?.windowBounds.top)}) .position({x:px2vp(this.target?.windowBounds.left), y:px2vp(this.target?.windowBounds.top)})
.width(px2vp(this.target?.windowBounds.width)) .width(px2vp(this.target?.windowBounds.width))
.height(px2vp(this.target?.windowBounds.height)) .height(px2vp(this.target?.windowBounds.height))
}
} }
} }
``` ```
\ No newline at end of file
...@@ -46,21 +46,21 @@ PinchGesture(options?: { fingers?: number, distance?: number }) ...@@ -46,21 +46,21 @@ PinchGesture(options?: { fingers?: number, distance?: number })
@Entry @Entry
@Component @Component
struct PinchGestureExample { struct PinchGestureExample {
@State scale: number = 1 @State scaleValue: number = 1
build() { build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('PinchGesture scale:' + this.scale) Text('PinchGesture scale:' + this.scale)
} }
.height(100).width(200).padding(20).border({ width: 1 }).margin(80) .height(100).width(200).padding(20).border({ width: 1 }).margin(80)
.scale({ x: this.scale, y: this.scale, z: this.scale }) .scale({ x: this.scaleValue, y: this.scaleValue, z: this.scaleValue })
.gesture( .gesture(
PinchGesture() PinchGesture()
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
console.info('Pinch start') console.info('Pinch start')
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
this.scale = event.scale this.scaleValue = event.scale
}) })
.onActionEnd(() => { .onActionEnd(() => {
console.info('Pinch end') console.info('Pinch end')
......
...@@ -40,10 +40,10 @@ Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: F ...@@ -40,10 +40,10 @@ Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: F
| ColumnReverse | 与Column相反方向进行布局。 | | ColumnReverse | 与Column相反方向进行布局。 |
- FlexWrap枚举说明 - FlexWrap枚举说明
| 名称 | 描述 | | 名称 | 描述 |
| ----------- | --------------------------- | | ----------- | ------------------------------------------------- |
| NoWrap | Flex容器的元素单行/列布局,子项允许超出容器。 | | NoWrap | Flex容器的元素单行/列布局,子项允许超出容器。 |
| Wrap | Flex容器的元素多行/列排布,子项允许超出容器。 | | Wrap | Flex容器的元素多行/列排布,子项允许超出容器。 |
| WrapReverse | Flex容器的元素反向多行/列排布,子项允许超出容器。 | | WrapReverse | Flex容器的元素反向多行/列排布,子项允许超出容器。 |
- FlexAlign枚举说明 - FlexAlign枚举说明
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册