web组件和list嵌套滚动,在出现list后向下滑动,出现web滑动list不动的情况

web组件设置为全量展开,滑动也有这样的效果

HarmonyOS
2024-05-07 21:51:08
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
PinkFish

目前只支持两种web布局模式,分别为Web布局跟随系统WebLayoutMode.NONE和Web基于页面大小的自适应网页布局WebLayoutMode.FIT_CONTENT。默认为WebLayoutMode.NONE模式。自适应网页布局WebLayoutMode.FIT_CONTENT方式全量展开。

https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-basic-components-web-0000001860247877#ZH-CN_TOPIC_0000001860247877__layoutmode11

当前规格只支持全量展开(LayoutMode)高度16000px

import webview from ‘@ohos.web.webview’; 
 
@Entry 
@Component 
struct WebHeightPage { 
  private webviewController: WebviewController = new webview.WebviewController() 
  private scroller: Scroller = new Scroller() 
 
  aboutToAppear() { 
    // 配置Web开启调试模式 
    webview.WebviewController.setWebDebuggingAccess(true); 
  } 
 
  build() { 
    Scroll(this.scroller) { 
      Column() { 
        Column() { 
          Text(“这里是头部区域”) 
          .fontSize(28) 
            .fontColor("#FF0F0F") 
        } 
        .width(“100%”) 
        .height(100) 
          .backgroundColor("#f89f0f") 
 
        Web({ 
          src: 'https://mbmodule-staticres.paas.cmbchina.com/mb5web/default.html', 
          // https://ishare.ifeng.com/c/s/v002E3vO1kV813bN9t9xd9RCB3YCJUUO2QyD8b9jXHERFTU__ 
          // https://mbmodule-staticres.paas.cmbchina.com/mb5web/default.html 
          controller: this.webviewController, 
          type:1 
        }) 
          .width('100%') 
          .layoutMode(WebLayoutMode.FIT_CONTENT) 
          .zoomAccess(false) 
          .domStorageAccess(true) 
          .overviewModeAccess(true) 
          .imageAccess(true) 
          .onlineImageAccess(true) 
          .fileAccess(true) 
          .databaseAccess(true) 
          .nestedScroll({ 
            scrollForward: NestedScrollMode.SELF_FIRST, 
            scrollBackward: NestedScrollMode.SELF_FIRST, 
          }) 
        Text("这里是底部区域") 
          .fontSize(28) 
          .fontColor("#FF0F0F") 
          .width("100%") 
          .height(vp2px(100)) 
          .backgroundColor("#f89f0f") 
      } 
      .width("100%") 
    }.width("100%") 
    .height("100%") 
    .scrollBar(BarState.On) 
  } 
}
分享
微博
QQ
微信
回复
2024-05-08 15:50:13
相关问题
scrolllist嵌套滑动
389浏览 • 1回复 待解决
WebList嵌套手势冲突问题
402浏览 • 1回复 待解决
如何屏蔽List滑动事件
823浏览 • 1回复 待解决
如何监听List组件滑动距离
588浏览 • 1回复 待解决
list组件无法滚动到底部
364浏览 • 1回复 待解决
如何获取List组件滚动滚动距离
777浏览 • 1回复 待解决
list 支持循环滚动吗?
722浏览 • 1回复 待解决
Tabs组件嵌套滑动组件
581浏览 • 1回复 待解决
List及ListItem组件使用
444浏览 • 1回复 待解决
使用List嵌套实现表格布局
422浏览 • 1回复 待解决