Showing
4 changed files
with
18 additions
and
0 deletions
| @@ -15,6 +15,7 @@ export struct WdWebComponent { | @@ -15,6 +15,7 @@ export struct WdWebComponent { | ||
| 15 | onWebPrepared: () => void = () => { | 15 | onWebPrepared: () => void = () => { |
| 16 | } | 16 | } |
| 17 | @Prop webUrl: string = '' | 17 | @Prop webUrl: string = '' |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @Link isPageEnd: boolean | 19 | @Link isPageEnd: boolean |
| 19 | 20 | ||
| 20 | build() { | 21 | build() { |
| @@ -87,5 +88,11 @@ export struct WdWebComponent { | @@ -87,5 +88,11 @@ export struct WdWebComponent { | ||
| 87 | Logger.debug(TAG, 'onLoadIntercept return false'); | 88 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 88 | return false | 89 | return false |
| 89 | } | 90 | } |
| 91 | + onReloadStateChanged() { | ||
| 92 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 93 | + if (this.reload > 0) { | ||
| 94 | + this.webviewControl.refresh() | ||
| 95 | + } | ||
| 96 | + } | ||
| 90 | } | 97 | } |
| 91 | 98 |
| @@ -15,6 +15,7 @@ export struct WdWebLocalComponent { | @@ -15,6 +15,7 @@ export struct WdWebLocalComponent { | ||
| 15 | } | 15 | } |
| 16 | @Prop backVisibility: boolean = false | 16 | @Prop backVisibility: boolean = false |
| 17 | @Prop webResource: Resource = {} as Resource | 17 | @Prop webResource: Resource = {} as Resource |
| 18 | + @Prop @Watch('onReloadStateChanged') reload: number = 0 | ||
| 18 | @State webHeight: string | number = '100%' | 19 | @State webHeight: string | number = '100%' |
| 19 | @Link isPageEnd: boolean | 20 | @Link isPageEnd: boolean |
| 20 | @State videoUrl: string = '' | 21 | @State videoUrl: string = '' |
| @@ -240,5 +241,11 @@ export struct WdWebLocalComponent { | @@ -240,5 +241,11 @@ export struct WdWebLocalComponent { | ||
| 240 | Logger.debug(TAG, 'onLoadIntercept return false'); | 241 | Logger.debug(TAG, 'onLoadIntercept return false'); |
| 241 | return false | 242 | return false |
| 242 | } | 243 | } |
| 244 | + onReloadStateChanged() { | ||
| 245 | + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`); | ||
| 246 | + if (this.reload > 0) { | ||
| 247 | + this.webviewControl.refresh() | ||
| 248 | + } | ||
| 249 | + } | ||
| 243 | } | 250 | } |
| 244 | 251 |
| @@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent { | @@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent { | ||
| 95 | Column() { | 95 | Column() { |
| 96 | WdWebLocalComponent({ | 96 | WdWebLocalComponent({ |
| 97 | webviewControl: this.webviewControl, | 97 | webviewControl: this.webviewControl, |
| 98 | + reload:this.reload, | ||
| 98 | webResource: $rawfile('apph5/index.html'), | 99 | webResource: $rawfile('apph5/index.html'), |
| 99 | backVisibility: false, | 100 | backVisibility: false, |
| 100 | onWebPrepared: this.onWebPrepared.bind(this), | 101 | onWebPrepared: this.onWebPrepared.bind(this), |
| @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { | @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { | ||
| 20 | action: Action = {} as Action | 20 | action: Action = {} as Action |
| 21 | @State webUrl: string = ''; | 21 | @State webUrl: string = ''; |
| 22 | @State isPageEnd: boolean = false | 22 | @State isPageEnd: boolean = false |
| 23 | + @State reload: number = 0; | ||
| 23 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 24 | @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 24 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean | 25 | private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean |
| 25 | private webPrepared = false; | 26 | private webPrepared = false; |
| @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { | @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { | ||
| 101 | WdWebComponent({ | 102 | WdWebComponent({ |
| 102 | webviewControl: this.webviewControl, | 103 | webviewControl: this.webviewControl, |
| 103 | webUrl: this.webUrl, | 104 | webUrl: this.webUrl, |
| 105 | + reload: this.reload, | ||
| 104 | onWebPrepared: this.onWebPrepared.bind(this), | 106 | onWebPrepared: this.onWebPrepared.bind(this), |
| 105 | isPageEnd: $isPageEnd, | 107 | isPageEnd: $isPageEnd, |
| 106 | }) | 108 | }) |
| @@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent { | @@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent { | ||
| 136 | if (!this.action?.params?.backVisibility) { | 138 | if (!this.action?.params?.backVisibility) { |
| 137 | WindowModel.shared.setWindowLayoutFullScreen(true) | 139 | WindowModel.shared.setWindowLayoutFullScreen(true) |
| 138 | } | 140 | } |
| 141 | + this.reload++ | ||
| 139 | } | 142 | } |
| 140 | 143 | ||
| 141 | aboutToAppear() { | 144 | aboutToAppear() { |
-
Please register or login to post a comment