Showing
1 changed file
with
24 additions
and
18 deletions
| @@ -5,12 +5,14 @@ import { performJSCallNative } from './JsBridgeBiz'; | @@ -5,12 +5,14 @@ import { performJSCallNative } from './JsBridgeBiz'; | ||
| 5 | import { H5CallNativeType } from './H5CallNativeType'; | 5 | import { H5CallNativeType } from './H5CallNativeType'; |
| 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; | 6 | import { Message } from 'wdJsBridge/src/main/ets/bean/Message'; |
| 7 | import { DateTimeUtils } from 'wdKit' | 7 | import { DateTimeUtils } from 'wdKit' |
| 8 | + | ||
| 8 | const TAG = 'WdWebLocalComponent'; | 9 | const TAG = 'WdWebLocalComponent'; |
| 9 | 10 | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct WdWebLocalComponent { | 12 | export struct WdWebLocalComponent { |
| 12 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() | 13 | webviewControl: BridgeWebViewControl = new BridgeWebViewControl() |
| 13 | - onWebPrepared: () => void = () => {} | 14 | + onWebPrepared: () => void = () => { |
| 15 | + } | ||
| 14 | @Prop backVisibility: boolean = false | 16 | @Prop backVisibility: boolean = false |
| 15 | @Prop webResource: Resource = {} as Resource | 17 | @Prop webResource: Resource = {} as Resource |
| 16 | @State webHeight: string | number = '100%' | 18 | @State webHeight: string | number = '100%' |
| @@ -47,16 +49,15 @@ export struct WdWebLocalComponent { | @@ -47,16 +49,15 @@ export struct WdWebLocalComponent { | ||
| 47 | Row() { | 49 | Row() { |
| 48 | RelativeContainer() { | 50 | RelativeContainer() { |
| 49 | // Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) | 51 | // Web({ src: this.webResource, controller: this.webviewControl, renderMode: RenderMode.SYNC_RENDER }) |
| 50 | - Web({ src: this.webResource, controller: this.webviewControl}) | 52 | + Web({ src: this.webResource, controller: this.webviewControl }) |
| 51 | .domStorageAccess(true) | 53 | .domStorageAccess(true) |
| 52 | .databaseAccess(true) | 54 | .databaseAccess(true) |
| 53 | .javaScriptAccess(true) | 55 | .javaScriptAccess(true) |
| 54 | .imageAccess(true) | 56 | .imageAccess(true) |
| 55 | .mixedMode(MixedMode.All) | 57 | .mixedMode(MixedMode.All) |
| 56 | .onlineImageAccess(true) | 58 | .onlineImageAccess(true) |
| 57 | - .enableNativeEmbedMode(true) | ||
| 58 | - // .layoutMode(WebLayoutMode.FIT_CONTENT) | ||
| 59 | - // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | 59 | + .enableNativeEmbedMode(true)// .layoutMode(WebLayoutMode.FIT_CONTENT) |
| 60 | + // .nestedScroll({ scrollForward: NestedScrollMode.SELF_FIRST, scrollBackward: NestedScrollMode.PARENT_FIRST }) | ||
| 60 | .height(this.webHeight) | 61 | .height(this.webHeight) |
| 61 | .onPageBegin((event) => { | 62 | .onPageBegin((event) => { |
| 62 | this.onPageBegin(event?.url); | 63 | this.onPageBegin(event?.url); |
| @@ -113,18 +114,21 @@ export struct WdWebLocalComponent { | @@ -113,18 +114,21 @@ export struct WdWebLocalComponent { | ||
| 113 | } | 114 | } |
| 114 | }) | 115 | }) |
| 115 | Row() { | 116 | Row() { |
| 116 | - Image($r(this.isPause ? 'app.media.icon_play' : 'app.media.icon_pause')) | 117 | + Image(this.isPause ? $r('app.media.icon_play') : $r('app.media.icon_pause')) |
| 117 | .width(24) | 118 | .width(24) |
| 118 | .height(24) | 119 | .height(24) |
| 119 | - .onClick(()=>{ | ||
| 120 | - if(this.isPause){ | 120 | + .onClick(() => { |
| 121 | + if (this.isPause) { | ||
| 121 | this.controller.start() | 122 | this.controller.start() |
| 122 | - }else{ | 123 | + } else { |
| 123 | this.controller.pause() | 124 | this.controller.pause() |
| 124 | } | 125 | } |
| 125 | }) | 126 | }) |
| 126 | Row() { | 127 | Row() { |
| 127 | - Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600) | 128 | + Text(DateTimeUtils.getFormattedDuration(this.currentTime * 1000)) |
| 129 | + .fontSize(12) | ||
| 130 | + .fontColor(Color.White) | ||
| 131 | + .fontWeight(600) | ||
| 128 | Slider({ | 132 | Slider({ |
| 129 | value: this.currentTime, | 133 | value: this.currentTime, |
| 130 | min: 0, | 134 | min: 0, |
| @@ -132,23 +136,25 @@ export struct WdWebLocalComponent { | @@ -132,23 +136,25 @@ export struct WdWebLocalComponent { | ||
| 132 | }) | 136 | }) |
| 133 | .width("50%") | 137 | .width("50%") |
| 134 | .selectedColor('#ED2800') | 138 | .selectedColor('#ED2800') |
| 135 | - .margin({ left: 4, right: 4 }) | ||
| 136 | - // .blockStyle({ | ||
| 137 | - // type: SliderBlockType.IMAGE, | ||
| 138 | - // image: $r('app.media.slider_block') | ||
| 139 | - // }) | ||
| 140 | - // .blockSize({ width: 18, height: 12 }) | 139 | + .margin({ left: 4, right: 4 })// .blockStyle({ |
| 140 | + // type: SliderBlockType.IMAGE, | ||
| 141 | + // image: $r('app.media.slider_block') | ||
| 142 | + // }) | ||
| 143 | + // .blockSize({ width: 18, height: 12 }) | ||
| 141 | .onChange((value: number, mode: SliderChangeMode) => { | 144 | .onChange((value: number, mode: SliderChangeMode) => { |
| 142 | this.controller.setCurrentTime(value); | 145 | this.controller.setCurrentTime(value); |
| 143 | }) | 146 | }) |
| 144 | - Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)).fontSize(12).fontColor(Color.White).fontWeight(600) | 147 | + Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)) |
| 148 | + .fontSize(12) | ||
| 149 | + .fontColor(Color.White) | ||
| 150 | + .fontWeight(600) | ||
| 145 | } | 151 | } |
| 146 | .justifyContent(FlexAlign.Center) | 152 | .justifyContent(FlexAlign.Center) |
| 147 | 153 | ||
| 148 | Image($r('app.media.icon_full_screen')) | 154 | Image($r('app.media.icon_full_screen')) |
| 149 | .width(24) | 155 | .width(24) |
| 150 | .height(24) | 156 | .height(24) |
| 151 | - .onClick(()=>{ | 157 | + .onClick(() => { |
| 152 | this.controller.requestFullscreen(true) | 158 | this.controller.requestFullscreen(true) |
| 153 | }) | 159 | }) |
| 154 | } | 160 | } |
-
Please register or login to post a comment