@Builder shopItem(title: string, subTitle: string) { Row() { Text(title) .fontColor("#FF999999") .fontSize(12).margin({ right: 3.5 }) Text(subTitle + "666") .fontColor("#FF444444") .fontWeight(FontWeight.Regular) .fontSize(12) }.margin({ bottom: 11.5 }).width('100%') }
例如 非list使用 但是需要多次调用 无法刷新
改成下面的 多次使用
@Component export struct shopItem { @Prop title: string = ""; @Prop subTitle: string = ""; build() { Row() { Text(this.title) .fontColor("#FF999999") .fontSize(12).margin({ right: 3.5 }) Text(this.subTitle) .fontColor("#FF444444") .fontWeight(FontWeight.Regular) .fontSize(12) }.margin({ bottom: 11.5 }).width('100%') } }
shopItem({ title: "主要产品:", subTitle: this.brandDetailBean.products }) shopItem({ title: "公司名称:", subTitle: this.brandDetailBean.chName }) shopItem({ title: "成立时间:", subTitle: this.brandDetailBean.establishTime })