73 lines
2.1 KiB
Plaintext
73 lines
2.1 KiB
Plaintext
@Component
|
|
export struct EditUserDataItem {
|
|
private label: string = ''
|
|
private required: boolean = false
|
|
@Prop content: string = ''
|
|
private hasArrow: boolean = false
|
|
|
|
build() {
|
|
Column() {
|
|
Row() {
|
|
Row() {
|
|
Text(this.label)
|
|
.fontSize(16)
|
|
.fontColor('#333333')
|
|
.margin({ left: 15 })
|
|
if (this.required) {
|
|
Text('*')
|
|
.margin({ left: 0 })
|
|
.fontSize(16)
|
|
.fontColor($r('app.color.main_color'))
|
|
}
|
|
}
|
|
.layoutWeight(1)//权重自定义
|
|
.justifyContent(FlexAlign.Start)
|
|
|
|
Row({space:5}) {
|
|
if (this.label == '头像') {
|
|
Image(this.content)
|
|
.alt($r('app.media.userPhoto_default'))
|
|
.onComplete(() => console.log('图片加载完成'))
|
|
.onError(() => console.error('图片加载失败'+this.content))
|
|
.width(40)
|
|
.height(40)
|
|
.margin({ right: this.hasArrow?0:10 })
|
|
.borderRadius(8)
|
|
} else if (this.label == '执业医师证图片或胸牌') {
|
|
Image(this.content)
|
|
.onComplete(() => console.log('图片加载完成'))
|
|
.onError(() => console.error('图片加载失败'+this.content))
|
|
.width(60)
|
|
.height(40)
|
|
.margin({ right: this.hasArrow?0:10 })
|
|
} else {
|
|
Text(this.content)
|
|
.fontSize(16)
|
|
.fontColor('#333333')
|
|
.width('60%')
|
|
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
|
.maxLines(1)
|
|
.margin({right: this.hasArrow?0:10 })
|
|
.textAlign(TextAlign.End)
|
|
}
|
|
if (this.hasArrow) {
|
|
Image($r('sys.media.ohos_ic_public_arrow_right'))
|
|
.width(15)
|
|
.height(15)
|
|
.margin({ right: 10 })
|
|
}
|
|
}
|
|
.justifyContent(FlexAlign.End)
|
|
}
|
|
.height(50)
|
|
.alignItems(VerticalAlign.Center)
|
|
|
|
Divider()
|
|
.color('#F4F4F4')
|
|
.strokeWidth(1)
|
|
.height(1)
|
|
.margin({ left: 10, top: 0 })
|
|
}
|
|
}
|
|
}
|