scroll 里面嵌套webView,demo参考:// xxx.ets import web_webview from '@ohos.web.webview' @Entry @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() @State mode: WebLayoutMode = WebLayoutMode.FIT_CONTENT build() { Column() { Text("这里是头部区域") .width("100%") .height('30%') .backgroundColor("#f89f0f") .fontSize(28) .fontColor("#FF0F0F") Web({ src: $rawfile('Index.html'), controller: this.controller }) .width('100%') .height(200)// .layoutMode(this.mode) .zoomAccess(false) .domStorageAccess(true) .overviewModeAccess(true) .imageAccess(true) .onlineImageAccess(true) .fileAccess(true) .databaseAccess(true) Text("这里是底部区域") .fontSize(28) .fontColor("#FF0F0F") .width("100%") .height('40%') .backgroundColor("#f89f0f") } .width('100%') .height('100%') } }
scroll 里面嵌套webView,demo参考: