Showing
2 changed files
with
12 additions
and
5 deletions
| @@ -18,7 +18,7 @@ export class WDRouterRule { | @@ -18,7 +18,7 @@ export class WDRouterRule { | ||
| 18 | if (page) { | 18 | if (page) { |
| 19 | if (params) { | 19 | if (params) { |
| 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) | 20 | // router.pushUrl({ url: 'pages/routerpage2', , params: params }) |
| 21 | - console.log('page.url()==',page.url()) | 21 | + console.log('page.url()==',page.url(),JSON.stringify(params)) |
| 22 | router.pushUrl({ url: page.url(), params: params }) | 22 | router.pushUrl({ url: page.url(), params: params }) |
| 23 | } else { | 23 | } else { |
| 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ | 24 | router.pushUrl({ url: page.url() }).catch((error:Error)=>{ |
| @@ -14,7 +14,7 @@ export struct WdWebLocalComponent { | @@ -14,7 +14,7 @@ export struct WdWebLocalComponent { | ||
| 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 14 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 15 | @Prop backVisibility: boolean = false | 15 | @Prop backVisibility: boolean = false |
| 16 | @Prop webResource: Resource = {} as Resource | 16 | @Prop webResource: Resource = {} as Resource |
| 17 | - @State webHeight : string = '100%' | 17 | + @State webHeight: string | number = '100%' |
| 18 | 18 | ||
| 19 | build() { | 19 | build() { |
| 20 | Column() { | 20 | Column() { |
| @@ -39,7 +39,7 @@ export struct WdWebLocalComponent { | @@ -39,7 +39,7 @@ export struct WdWebLocalComponent { | ||
| 39 | .mixedMode(MixedMode.All) | 39 | .mixedMode(MixedMode.All) |
| 40 | .onlineImageAccess(true) | 40 | .onlineImageAccess(true) |
| 41 | .enableNativeEmbedMode(true) | 41 | .enableNativeEmbedMode(true) |
| 42 | - .height(this.webHeight === '100%' ? '100%' : Number(this.webHeight)) | 42 | + .height(this.webHeight) |
| 43 | .onPageBegin((event) => { | 43 | .onPageBegin((event) => { |
| 44 | this.onPageBegin(event?.url); | 44 | this.onPageBegin(event?.url); |
| 45 | }) | 45 | }) |
| @@ -79,9 +79,16 @@ export struct WdWebLocalComponent { | @@ -79,9 +79,16 @@ export struct WdWebLocalComponent { | ||
| 79 | 79 | ||
| 80 | //webview 高度设置 | 80 | //webview 高度设置 |
| 81 | private setCurrentPageOperate: (data: Message) => void = (data) => { | 81 | private setCurrentPageOperate: (data: Message) => void = (data) => { |
| 82 | - console.log("setCurrentPageOperate",JSON.stringify(data)) | 82 | + console.log("setCurrentPageOperate", JSON.stringify(data)) |
| 83 | if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { | 83 | if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) { |
| 84 | - this.webHeight = data?.data?.webViewHeight || '100%' | 84 | + if (typeof this.webHeight === 'number') { |
| 85 | + if (Number(data?.data?.webViewHeight) > this.webHeight) { | ||
| 86 | + this.webHeight = Number(data?.data?.webViewHeight) | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + { | ||
| 90 | + this.webHeight = Number(data?.data?.webViewHeight) || '100%' | ||
| 91 | + } | ||
| 85 | } | 92 | } |
| 86 | } | 93 | } |
| 87 | /** | 94 | /** |
-
Please register or login to post a comment