diff --git a/entry/src/main/ets/pages/VuePage.ets b/entry/src/main/ets/pages/VuePage.ets index b36894ec679316f56c93bbafe341da7091735340..3bb894284d32da5d3e88669119bfbb615e87be4d 100755 --- a/entry/src/main/ets/pages/VuePage.ets +++ b/entry/src/main/ets/pages/VuePage.ets @@ -14,23 +14,32 @@ */ import { webview } from '@kit.ArkWeb'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; import { CommonConstant as Const } from '../common/Constant'; import { NavigatorBean } from '../viewmodel/NavigatorBean'; + const uiContext: UIContext | undefined = AppStorage.get('uiContext'); let context = uiContext!.getHostContext()!; + class LinkClass { messageFromHtml(value: string) { - let res = context.resourceManager.getStringSync($r('app.string.congratulate').id); - uiContext!.showAlertDialog!({ - message: res + value, - confirm: { - value: $r('app.string.web_alert_dialog_button_value'), - action: () => { + try { + let res = context.resourceManager.getStringSync($r('app.string.congratulate').id); + uiContext!.showAlertDialog!({ + message: res + value, + confirm: { + value: $r('app.string.web_alert_dialog_button_value'), + action: () => { + } + }, + cancel: () => { } - }, - cancel: () => { - } - }); + }); + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'LinkClass', `getStringSync failed, error code=${err.code}, message=${err.message}`); + } } } diff --git a/entry/src/main/ets/pages/WebPage.ets b/entry/src/main/ets/pages/WebPage.ets index 5690db6b7ee822cb36681ccef923522268077c73..1684ba26ef689ca44d12825b723439d8670178b1 100755 --- a/entry/src/main/ets/pages/WebPage.ets +++ b/entry/src/main/ets/pages/WebPage.ets @@ -13,25 +13,32 @@ * limitations under the License. */ -import { promptAction } from '@kit.ArkUI'; import { webview } from '@kit.ArkWeb'; +import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; import { CommonConstant as Const } from '../common/Constant'; import { NavigatorBean } from '../viewmodel/NavigatorBean'; + const uiContext: UIContext | undefined = AppStorage.get('uiContext'); let context = uiContext!.getHostContext()!; class LinkClass { messageFromHtml(value: string) { - let res = context.resourceManager.getStringSync($r('app.string.congratulate').id); - uiContext!.showAlertDialog({ - message: res + value, - confirm: { - value: $r('app.string.web_alert_dialog_button_value'), - action: () => { + try { + let res = context.resourceManager.getStringSync($r('app.string.congratulate').id); + uiContext!.showAlertDialog({ + message: res + value, + confirm: { + value: $r('app.string.web_alert_dialog_button_value'), + action: () => { + } + }, + cancel: () => { } - }, - cancel: () => { - } - }); + }); + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, 'LinkClass', `getStringSync failed, error code=${err.code}, message=${err.message}`); + } } } diff --git a/hvigor/hvigor-config.json5 b/hvigor/hvigor-config.json5 index 64d4de8dd4fdf6fe47e1dd12255d5f67bbc62577..5fbdc0a61e8e8b4300fbba3fa6b1e584891bb60c 100755 --- a/hvigor/hvigor-config.json5 +++ b/hvigor/hvigor-config.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "dependencies": { }, "execution": { diff --git a/oh-package.json5 b/oh-package.json5 index c098d7a06a58c52211594537c40d407fbb8fef67..bcff9015106ca3675a01e1c6211cc8a3501863bd 100755 --- a/oh-package.json5 +++ b/oh-package.json5 @@ -1,5 +1,5 @@ { - "modelVersion": "5.0.0", + "modelVersion": "5.0.5", "license": "", "devDependencies": {}, "author": "",