Column(){
Text(item.name)
.fontColor(this.selectIndex === index ? $r('app.color.color_main'): $r('app.color.color_333333'))
.fontWeight(this.selectIndex === index ? FontWeight.Medium : FontWeight.Regular)
.fontSize(16)
.margin({top:16})
Shape()
.width(48)
.height(2)
.borderRadius(2)
.backgroundColor($r('app.color.color_main'))
.margin({top:7})
.visibility(this.selectIndex===index?Visibility.Visible:Visibility.Hidden)
}.height(44)
Shape的宽度 如何根据Text宽度进行自适应
这是个简易demo