• 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 */
15import router from '@ohos.router';
16import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
17import { Hypium } from '@ohos/hypium'
18import testsuite from '../../test/List.test'
19
20@Entry
21@Component
22struct Index {
23  @State message: string = 'CreateFormAbility'
24  @State isShowing: boolean = true;
25
26  @State formId: number = 0;
27  @State bundle: string = "com.example.apicoverhaptest";
28  @State ability: string = "FormAbility";
29  @State moduleName: string = "phone";
30  @State name: string = "form1";
31  @State allowUpate: boolean = true;
32  private dimension: FormDimension = FormDimension.Dimension_2_2;
33  private temporary = false;
34
35  aboutToAppear() {
36    this.isShowing = globalThis.isCreateForm
37  }
38
39  build() {
40    Row() {
41      Column() {
42        if (this.isShowing) {
43          FormComponent({
44            id: this.formId,
45            name: this.name,
46            bundle: this.bundle,
47            ability: this.ability,
48            module: this.moduleName,
49            dimension: this.dimension,
50            temporary: this.temporary,
51          })
52          .allowUpdate(this.allowUpate )
53          .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden)
54          .size({width:360,height:360})
55          .onAcquired((form) => {
56            console.log("[FormComponent.host] get form, form id:" + form.id);
57          })
58        }
59        Text(this.message)
60          .fontSize(50)
61          .fontWeight(FontWeight.Bold)
62      }
63      .width('100%')
64    }
65    .height('100%')
66  }
67}