1/* 2 * Copyright (c) 2022-2023 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@Component 17export default struct BindServiceIp { 18 @Link ipAddress: string 19 private onBind: () => void 20 21 build() { 22 Column() { 23 Text($r('app.string.welcome')) 24 .fontSize(25) 25 .margin({ top: 20 }) 26 .fontWeight(FontWeight.Bold) 27 TextInput({ placeholder: $r('app.string.ip_placeholder') }) 28 .height(50) 29 .fontSize(15) 30 .width('70%') 31 .margin({ top: 20 }) 32 .key('ipInput') 33 .id('text_ip_input') 34 .onChange((value: string) => { 35 this.ipAddress = `${value}` 36 }) 37 Button() { 38 Text($r('app.string.bind_ip')) 39 .fontSize(20) 40 .fontColor(Color.White) 41 } 42 .id('btn_bind') 43 .margin({ top: 20 }) 44 .width(200) 45 .height(50) 46 .type(ButtonType.Capsule) 47 .onClick(() => { 48 this.onBind() 49 }) 50 } 51 .width('100%') 52 } 53}