Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yuzhilin
2024-04-17 09:41:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9c4e35c5073595166f506f10f50508135d03412b
9c4e35c5
1 parent
5d5cfac5
计算webview 高度
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterRule.ets
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
sight_harmony/commons/wdRouter/src/main/ets/router/WDRouterRule.ets
View file @
9c4e35c
...
...
@@ -18,7 +18,7 @@ export class WDRouterRule {
if (page) {
if (params) {
// router.pushUrl({ url: 'pages/routerpage2', , params: params })
console.log('page.url()==',page.url())
console.log('page.url()==',page.url()
,JSON.stringify(params)
)
router.pushUrl({ url: page.url(), params: params })
} else {
router.pushUrl({ url: page.url() }).catch((error:Error)=>{
...
...
sight_harmony/commons/wdWebComponent/src/main/ets/pages/WdWebLocalComponent.ets
View file @
9c4e35c
...
...
@@ -14,7 +14,7 @@ export struct WdWebLocalComponent {
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
@Prop backVisibility: boolean = false
@Prop webResource: Resource = {} as Resource
@State webHeight
: string
= '100%'
@State webHeight
: string | number
= '100%'
build() {
Column() {
...
...
@@ -39,7 +39,7 @@ export struct WdWebLocalComponent {
.mixedMode(MixedMode.All)
.onlineImageAccess(true)
.enableNativeEmbedMode(true)
.height(this.webHeight
=== '100%' ? '100%' : Number(this.webHeight)
)
.height(this.webHeight)
.onPageBegin((event) => {
this.onPageBegin(event?.url);
})
...
...
@@ -79,9 +79,16 @@ export struct WdWebLocalComponent {
//webview 高度设置
private setCurrentPageOperate: (data: Message) => void = (data) => {
console.log("setCurrentPageOperate",JSON.stringify(data))
console.log("setCurrentPageOperate",
JSON.stringify(data))
if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) {
this.webHeight = data?.data?.webViewHeight || '100%'
if (typeof this.webHeight === 'number') {
if (Number(data?.data?.webViewHeight) > this.webHeight) {
this.webHeight = Number(data?.data?.webViewHeight)
}
}
{
this.webHeight = Number(data?.data?.webViewHeight) || '100%'
}
}
}
/**
...
...
Please
register
or
login
to post a comment