效果图
代码
@Entry
@Component
struct Index {
@State message: string = '文字溢出显示省略号'
build() {
Column() {
Text('HarmonyOS开发初体验')
.width('100%')
.height(40)
.fontSize(20)
.fontWeight(FontWeight.Bold)
Text('方舟开发框架(简称:ArkUI),是一套构建HarmonyOS应用界面的UI开发框架,' +
'它提供了极简的UI语法与包括UI组件、动画机制、事件交互等在内的UI开发基础设施,' +
'以满足应用开发者的可视化界面开发需求。')
.lineHeight(22)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(2)
}
.padding(10)
.width('100%')
}
}