下面的Demo h5页面能滚动,以供参考:import { webview } from '@kit.ArkWeb'; @Entry @Component export struct HomeWebPage { controller: webview.WebviewController = new webview.WebviewController(); @State url: string = '' @State isLoaded: boolean = false @Prop title: string = '' @State token: string = '' build() { Navigation() { // Text('头部') Web({ src: $rawfile("index.html"), controller: this.controller }) .onControllerAttached(() => { this.isLoaded = true console.log('----: ',this.controller.getTitle()) }) .width('100%') .height('100%') .backgroundColor(Color.Red) .javaScriptAccess(true) .domStorageAccess(true) .mixedMode(MixedMode.All) .onTitleReceive((data) => { }) .onErrorReceive((error) => { console.log('---:'+error) }) .onHttpErrorReceive((error) => { console.log('---:'+error) }) .onPageEnd(() => { }) } .hideTitleBar(true) .height('100%') } }<!DOCTYPE html> <html> <meta charset="utf-8"> <style> html{ height:3000px } </style> <body> <p id="demo" style="height: 800px;background-color:yellow;"> "文本内容" </p> </body> <script type="text/javascript"> </script> </html>
下面的Demo h5页面能滚动,以供参考: