
如何写精华回答,获更多曝光?
发布
使用web组件时,如何可以做到弹出输入键盘时,布局可以同步上滑,而不是覆盖布局下半部分吗?
代码如下:
NavDestination() {
Column() {
Web({ src: '', controller: this.controller })
.backgroundColor(Color.Transparent)
.javaScriptAccess(true)// 支持js
.domStorageAccess(true)// 开启 DOM storage API 功能
.zoomAccess(false)// 设置可以支持缩放
.fileAccess(true)//允许访问本地路径
.domStorageAccess(true)
.textZoomRatio(100)//设置页面的文本缩放百分比
.layoutMode(WebLayoutMode.FIT_CONTENT)
.mixedMode(MixedMode.All)
.onControllerAttached(() => {
let userAgent = this.controller.getUserAgent()
this.controller.setCustomUserAgent(userAgent + 'FlutterWebDowngrade ')
this.controller.loadUrl(`${FlutterWebConstant.FLUTTER_WEB_HOST}/index.html#${this.flutterInitialRoute}`)
})
.onInterceptRequest((event) => {
const requestUrl = event.request.getRequestUrl()
// 加载其他文件
return loadUrlRequest(requestUrl, this.flutterInitialRoute)
})
}.width('100%')
.height('100%')
}.hideTitleBar(true)