文档开发者中心
我的
|

UI

HarmonyOS 5

Scroll 嵌套 Tabs ,TabContent嵌套 ForEach列表 ,列表数据滚动不到底部是为什么?

已解决
代码片段:
收起
自动换行
深色代码主题
复制
private controller: TabsController = new TabsController()
arry: string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15']
build() {
  Scroll() {
    Flex({ direction: FlexDirection.Column }) {
      Text('1').width('100%').height(200).backgroundColor(Color.Yellow)
      Text('2').width('100%').height(200).backgroundColor(Color.Blue)
      Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
        TabContent() {
          Column() {
            ForEach(this.arry, (item: string) => {
              Text('新闻:' + item).width('100%').height(100).backgroundColor(Color.Pink)
            })
          }

        }.tabBar('新闻')
        TabContent() {
          Column() {
            ForEach(this.arry, (item: string) => {
              Text('新闻列表:' + item).width('100%').height(100).backgroundColor(Color.Pink)
            })
          }
        }.tabBar('新闻2')
      }

    }.width('100%')
  }

}
点赞
收藏
回复
1
分享
举报
浏览236 发布于2024-09-25 06:08广东
全部评论
最多点赞
最新发布
最早发布
|
采纳答复
1楼回复于2024-09-25 06:41 来自广东
写回答
新增插入模板功能
一键使用模板,快速填写内容,轻松发帖~
知道了
  • 为了保障您的信息安全,请勿上传您的敏感个人信息(如您的密码等信息)和您的敏感资产信息(如关键源代码、签名私钥、调试安装包、业务日志等信息),且您需自行承担由此产生的信息泄露等安全风险。
  • 如您发布的内容为转载内容,请注明内容来源。

我要提问题

了解社区公约,与您携手共创和谐专业的开发者社区。