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 16class MyLinkTestComponent extends View { 17 constructor(inputParams) { 18 super(); 19 this.myVar = 0; 20 Object.assign(this, inputParams); 21 this.createLink("myLink1"); 22 this.createLink("myLink2"); 23 this.createLink("myLink3"); 24 this.createLink("myLink4"); 25 } 26 render() { 27 } 28} 29class LinkTest extends View { 30 constructor(inputParams) { 31 super(); 32 this.myState1 = { count: 0 }; 33 this.myState2 = 0; 34 this.myState3 = false; 35 this.myState4 = 'Home'; 36 Object.assign(this, inputParams); 37 this.createState("myState1"); 38 this.createState("myState2"); 39 this.createState("myState3"); 40 this.createState("myState4"); 41 } 42 render() { return new Row(new MyLinkTestComponent({ 43 myLink1: createLinkReference(this, "myState1"), 44 myLink2: createLinkReference(this, "myState2"), 45 myLink3: createLinkReference(this, "myState3"), 46 myLink4: createLinkReference(this, "myState4"), 47 myVar: 100, 48 myVar2: 100, 49 })); } 50} 51loadDocument(new LinkTest()); 52