• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16@Entry
17@Component
18struct TestView1 {
19
20  @State
21  clicked:number = 0;
22
23  onClicked() {
24    this.clicked = this.clicked + 1;
25  }
26
27    build() {
28    Column(){
29      Text("Clicked: " + this.onClicked)
30      Image("pages/pictures/0.jpeg")
31      .width(800).height(400).margin(50)
32      .onClick(this.onClicked.bind(this))
33      Text("Test text\ntest text")
34      .onClick(this.onClicked.bind(this))
35      Row(){
36        Text("test")
37        Text("test")
38        Text("test")
39      }
40      .onClick(this.onClicked.bind(this))
41      Stack(){
42        Image("pages/pictures/0.jpeg")
43        Text("Test text")
44      }
45      .onClick(this.onClicked.bind(this))
46      Column(){
47        Text("test")
48        Text("test")
49        Text("test")
50      }
51      .onClick(this.onClicked.bind(this))
52    }
53    .alignItems(HorizontalAlign.Center)
54    } // render
55}
56