1/* 2* Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 16import { Information } from '../model/Information'; 17import { DeleteView } from './DeleteView'; 18import { getString } from '@ohos/common/src/main/ets/util/ResourceUtil'; 19 20@Component 21export struct InformationItemView { 22 @ObjectLink information: Information; 23 private deleteAction: (event?: ClickEvent) => void = () => { 24 }; 25 private index: number = 0; 26 27 build() { 28 Row() { 29 Row() { 30 Column() { 31 Text(this.information.name) 32 .fontColor($r('app.color.text_color_primary')) 33 .fontSize(16) 34 Text(this.information.phone) 35 .fontColor($r('app.color.text_color_second')) 36 .fontSize(14) 37 .margin({ top: 5 }) 38 } 39 40 Blank() 41 Text(`${this.information.age}${getString($r('app.string.old'))}`) 42 .fontColor($r('app.color.text_color_second')) 43 .fontSize(12) 44 } 45 .height(72) 46 .layoutWeight(1) 47 .padding({ left: 16, right: 15 }) 48 .margin({ right: 12 }) 49 .backgroundColor($r('app.color.bg_white')) 50 .borderRadius(16) 51 52 DeleteView({ enable: this.information.clickAble }) 53 .id(`delete${this.index}`) 54 .enabled(this.information.clickAble) 55 .onClick(this.deleteAction) 56 } 57 .padding({ left: 12 }) 58 .width('100%') 59 .margin({ top: 12, right: 12 }) 60 } 61}