diff --git a/README.en.md b/README.en.md index cd5d037b578eab7b22087c3edd3d74073cdb9e2a..f15ef8aa32b088468452f95f6efc25e42d1aa3d3 100644 --- a/README.en.md +++ b/README.en.md @@ -13,17 +13,26 @@ Instructions: ### Project Directory ``` -├──entry/src/main/ets/ +webprerenderlibrary +├──src/main/ets/ │ ├──common -│ │ ├──BreakpointType.ets +│ │ ├──utils +│ │ │ ├──BreakpointSystem.ets +│ │ │ └──WindowUtil.ets │ │ ├──Constants.ets // Common constant class │ │ └──ResourceUtil.ets -│ ├──entryability -│ │ └──EntryAbility.ets // Entry ability -│ └──pages -│ └──Index.ets // Home page -│ └──WebPage.ets // Pre-rendering web page -└──entry/src/main/resources // Static resources +│ └──view +│ │ └──WebPage.ets // Home page +│ │ └──WebPreRenderView.ets // Pre-rendering web page +│ └──WebPrerenderController.ets +└──src/main/resources // Static resources +webprerendersample +├──src/main/ets // Common constant class +│ ├──entryability +│ │ └──EntryAbility.ets +│ └──pages +│ └──Index.ets // entry page +└──src/main/resources // Static resources ``` ### How to Implement diff --git a/README.md b/README.md index 33f006bf98369203ba163cdf3fd1a70a1b6b49dd..4d2825b8e6937a01015b7e06042e4b04279dfaf1 100644 --- a/README.md +++ b/README.md @@ -13,17 +13,26 @@ ### 工程目录 ``` -├──entry/src/main/ets/ +webprerenderlibrary +├──src/main/ets/ │ ├──common -│ │ ├──BreakpointType.ets +│ │ ├──utils +│ │ │ ├──BreakpointSystem.ets // 断点类 +│ │ │ └──WindowUtil.ets // 窗口工具 │ │ ├──Constants.ets // 公共常量类 -│ │ └──ResourceUtil.ets -│ ├──entryability -│ │ └──EntryAbility.ets // 程序入口类 -│ └──pages -│ ├──Index.ets // 首页 -│ └──WebPage.ets // Web预渲染页面 -└──entry/src/main/resources // 应用静态资源目录 +│ │ └──ResourceUtil.ets +│ └──view +│ │ └──WebPage.ets // 首页 +│ │ └──WebPreRenderView.ets // Web预渲染页面 +│ └──WebPrerenderController.ets +└──src/main/resources // 静态资源 +webprerendersample +├──src/main/ets +│ ├──entryability +│ │ └──EntryAbility.ets +│ └──pages +│ └──Index.ets // 入口页面 +└──src/main/resources // 应用静态资源目录 ``` ### 具体实现 diff --git a/webprerenderlibrary/BuildProfile.ets b/webprerenderlibrary/BuildProfile.ets deleted file mode 100644 index 3a501e5ddee8ea6d28961648fc7dd314a5304bd4..0000000000000000000000000000000000000000 --- a/webprerenderlibrary/BuildProfile.ets +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Use these variables when you tailor your ArkTS code. They must be of the const type. - */ -export const HAR_VERSION = '1.0.0'; -export const BUILD_MODE_NAME = 'debug'; -export const DEBUG = true; -export const TARGET_NAME = 'default'; - -/** - * BuildProfile Class is used only for compatibility purposes. - */ -export default class BuildProfile { - static readonly HAR_VERSION = HAR_VERSION; - static readonly BUILD_MODE_NAME = BUILD_MODE_NAME; - static readonly DEBUG = DEBUG; - static readonly TARGET_NAME = TARGET_NAME; -} \ No newline at end of file diff --git a/webprerenderlibrary/CHANGELOG.md b/webprerenderlibrary/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..addaa8c904e77491f00f6f35027c527cda8c1bb0 --- /dev/null +++ b/webprerenderlibrary/CHANGELOG.md @@ -0,0 +1,6 @@ +# 版本记录 +## 1.0.0(2025.07.11) + +--- +### Initial +- 初始版本 diff --git a/webprerenderlibrary/Index.ets b/webprerenderlibrary/Index.ets index 6bb0a6b6dd38222c319bc7b5e4b6288443a45d38..9998f1006824bc527f6b65b248d726a8ee94657b 100644 --- a/webprerenderlibrary/Index.ets +++ b/webprerenderlibrary/Index.ets @@ -1,2 +1,3 @@ -export { WebPreRenderPage } from './src/main/ets/pages/WebPreRenderPage'; -export { WindowUtil } from './src/main/ets/common/utils/WindowUtil'; \ No newline at end of file +export { WebPreRenderView as WebPreRenderComponent } from './src/main/ets/view/WebPreRenderView'; + +export { WebPrerenderController } from './src/main/ets/WebPrerenderController'; \ No newline at end of file diff --git a/webprerenderlibrary/LICENSE b/webprerenderlibrary/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..338e5b0bc22082e0ffcc7121c2ed3897a3ddccb0 --- /dev/null +++ b/webprerenderlibrary/LICENSE @@ -0,0 +1,78 @@ + Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Apache License, Version 2.0 +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +2. Grant of Copyright License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. + +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. + +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: +1.You must give any other recipients of the Work or Derivative Works a copy of this License; and +2.You must cause any modified files to carry prominent notices stating that You changed the files; and +3.You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +4.If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +5. Submission of Contributions. + +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. + +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. + +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. + +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. + +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/webprerenderlibrary/README.md b/webprerenderlibrary/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bb88b6ace6da92389ad2d3af96d9a47290a36dbe --- /dev/null +++ b/webprerenderlibrary/README.md @@ -0,0 +1,42 @@ +## web页面瞬开 + +### 介绍 + +本示例基于预渲染技术,实现了点击后Web页面瞬间打开的效果,无需额外加载过程,减少用户等待时长,提高了用户体验。 + +### 下载安装 + +使用ohpm安装依赖 + +``` +ohpm install @ohos_samples/webprerenderlibrary +``` + +或者按需在模块中修改oh-package.json5 + +``` +{ + "dependencies": { + "@ohos_samples/webprerenderlibrary": "^1.0.0" + } +} +``` + +### 使用说明 + +``` +import { WebPreRenderComponent, WebPrerenderController } from '@ohos_samples/webprerenderlibrary'; +``` +按需在文件中使用导出模块即可,其中WWebPreRenderComponent是整个sample的入口页面组件。WebPrerenderController初始化沉浸式、设备断点判断、避让区域计算等窗口能力。示例如下: +``` +// Index.ets +import { WebPreRenderComponent } from '@ohos_samples/webprerenderlibrary'; +Stack() { + WebPreRenderComponent() +} + +// EntryAbility.ets +import { WebPrerenderController } from '@ohos_samples/webprerenderlibrary'; +// onWindowStageCreate回调里的loadContent方法里初始化 +WebPrerenderController.initWindowConfig(windowStage, this); +``` \ No newline at end of file diff --git a/webprerenderlibrary/build-profile.json5 b/webprerenderlibrary/build-profile.json5 index 312d38eb08629793b3484c7373213f22840c8d82..cda3307123ec7c43181580a86ef7e82a18319a34 100644 --- a/webprerenderlibrary/build-profile.json5 +++ b/webprerenderlibrary/build-profile.json5 @@ -8,7 +8,7 @@ "arkOptions": { "obfuscation": { "ruleOptions": { - "enable": true, + "enable": false, "files": [ "./obfuscation-rules.txt" ] diff --git a/webprerenderlibrary/oh-package.json5 b/webprerenderlibrary/oh-package.json5 index a63e49e85474617db32f4ee51af03e3098079a6d..8f5e8a2cff6e4f288c1ad64555526004d05de597 100644 --- a/webprerenderlibrary/oh-package.json5 +++ b/webprerenderlibrary/oh-package.json5 @@ -1,9 +1,10 @@ { - "name": "webprerenderlibrary", + "name": "@ohos_samples/webprerenderlibrary", "version": "1.0.0", - "description": "Please describe the basic information.", + "description": "This sample shows how to display the web pages in an instant manner by using pre-rendering.", "main": "Index.ets", - "author": "", + "author": "@ohos_samples", "license": "Apache-2.0", + "repository": "https://gitee.com/harmonyos_samples/web-pre-render/tree/br_release_hmos/", "dependencies": {} -} +} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/ets/WebPrerenderController.ets b/webprerenderlibrary/src/main/ets/WebPrerenderController.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ef7bacf4fa67c8aae0b279c27dbb7b69044c20a --- /dev/null +++ b/webprerenderlibrary/src/main/ets/WebPrerenderController.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { UIAbility } from '@kit.AbilityKit'; +import { window } from '@kit.ArkUI'; +import { WindowUtil } from './common/utils/WindowUtil'; + +export class WebPrerenderController { + public static initWindowConfig(windowStage: window.WindowStage, ability: UIAbility): void { + WindowUtil.initialize(windowStage, ability); + } +} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/ets/common/Constants.ets b/webprerenderlibrary/src/main/ets/common/Constants.ets index 23dc95e54042d1211e1e1f0f9d7b77266dd14458..90e4296e060a572eb657b6364113ee40ebea92f4 100644 --- a/webprerenderlibrary/src/main/ets/common/Constants.ets +++ b/webprerenderlibrary/src/main/ets/common/Constants.ets @@ -18,30 +18,33 @@ export class Constants { * All breakpoints */ public static readonly BREAKPOINTS: string[] = ['sm', 'md', 'lg']; - /** * Full Screen width */ public static readonly FULL_WIDTH: string = '100%'; - /** * Full Screen height */ public static readonly FULL_HEIGHT: string = '100%'; - /** * Index page padding top size. */ public static readonly PADDING_TOP_INDEX: number = 64; - /** * Index page padding bottom size. */ public static readonly PADDING_BOTTOM_INDEX: number = 16; - /** * Set the url whitelist of the current web */ public static readonly URL_TRUST: string = '{\"UrlPermissionList\": [{\"scheme\": \"https\",\"host\": \"developer.huawei.com\"}]}'; + /** + * AppStorage key + */ + public static readonly KEY_PREFIX: string = 'webPrerender'; + public static readonly KEY_BREAKPOINT: string = Constants.KEY_PREFIX + 'BreakPoint'; + public static readonly KEY_STATUS_BAR_HEIGHT: string = Constants.KEY_PREFIX + 'StatusBarHeight'; + public static readonly KEY_NAV_INDICATOR_HEIGHT: string = Constants.KEY_PREFIX + 'NavIndicatorHeight'; + public static readonly KEY_UI_CONTEXT: string = Constants.KEY_PREFIX + 'UIContext'; } \ No newline at end of file diff --git a/webprerenderlibrary/src/main/ets/common/ResourceUtil.ets b/webprerenderlibrary/src/main/ets/common/ResourceUtil.ets index f26f38e1c31d39ec24445e92abc0e2a17bdcbab5..99a7edf377a3b97229be93673f589ed0fa3b3e51 100644 --- a/webprerenderlibrary/src/main/ets/common/ResourceUtil.ets +++ b/webprerenderlibrary/src/main/ets/common/ResourceUtil.ets @@ -13,9 +13,9 @@ * limitations under the License. */ -import { hilog } from '@kit.PerformanceAnalysisKit'; import { JSON, util } from '@kit.ArkTS'; import { BusinessError } from '@kit.BasicServicesKit'; +import { hilog } from '@kit.PerformanceAnalysisKit'; export class ResourceUtil { /** diff --git a/webprerenderlibrary/src/main/ets/common/utils/BreakpointSystem.ets b/webprerenderlibrary/src/main/ets/common/utils/BreakpointSystem.ets index aa7581b2047323eac83c8d9a031e21faabc55bd2..26914c1798280323d2cf76f05a433c0e31c3a26d 100644 --- a/webprerenderlibrary/src/main/ets/common/utils/BreakpointSystem.ets +++ b/webprerenderlibrary/src/main/ets/common/utils/BreakpointSystem.ets @@ -16,6 +16,7 @@ import { window } from '@kit.ArkUI'; import type { BusinessError } from '@kit.BasicServicesKit'; import { hilog } from '@kit.PerformanceAnalysisKit'; +import { Constants } from '../Constants'; const TAG: string = '[BreakpointSystem]'; @@ -77,6 +78,7 @@ export class BreakpointSystem { public static getInstance(): BreakpointSystem { if (!BreakpointSystem.instance) { BreakpointSystem.instance = new BreakpointSystem(); + AppStorage.setOrCreate(Constants.KEY_BREAKPOINT, BreakpointTypeEnum.MD); } return BreakpointSystem.instance; } @@ -84,7 +86,7 @@ export class BreakpointSystem { public updateCurrentBreakpoint(breakpoint: BreakpointTypeEnum): void { if (this.currentBreakpoint !== breakpoint) { this.currentBreakpoint = breakpoint; - AppStorage.setOrCreate('currentBreakpoint', this.currentBreakpoint); + AppStorage.setOrCreate(Constants.KEY_BREAKPOINT, this.currentBreakpoint); } } @@ -96,7 +98,8 @@ export class BreakpointSystem { try { const mainWindow: window.WindowProperties = window.getWindowProperties(); const windowWidth: number = mainWindow.windowRect.width; - const windowWidthVp = px2vp(windowWidth); + const context: UIContext = window.getUIContext(); + const windowWidthVp = context.px2vp(windowWidth); let widthBp: BreakpointTypeEnum = BreakpointTypeEnum.MD; if (windowWidthVp < 320) { widthBp = BreakpointTypeEnum.XS; diff --git a/webprerenderlibrary/src/main/ets/common/utils/WindowUtil.ets b/webprerenderlibrary/src/main/ets/common/utils/WindowUtil.ets index 84b20e5a1cd85e6ce4dfa553b697ae233990ea34..e9f32672d149f73ced73c2abd24a7799b61f52b3 100644 --- a/webprerenderlibrary/src/main/ets/common/utils/WindowUtil.ets +++ b/webprerenderlibrary/src/main/ets/common/utils/WindowUtil.ets @@ -13,63 +13,78 @@ * limitations under the License. */ +import { common, UIAbility } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; import type { BusinessError } from '@kit.BasicServicesKit'; -import { BreakpointSystem } from './BreakpointSystem'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { createNWeb } from '../../pages/WebPage'; +import { createNWeb } from '../../view/WebPage'; +import { Constants } from '../Constants'; import { ConfigMapKey, ResourceUtil } from '../ResourceUtil'; -import { common, UIAbility } from '@kit.AbilityKit'; +import { BreakpointSystem } from './BreakpointSystem'; const TAG: string = '[WindowUtil]'; export class WindowUtil { - public static requestFullScreen(windowStage: window.WindowStage): void { - windowStage.getMainWindow((err: BusinessError, data: window.Window) => { - if (err.code) { - return; - } - const windowClass: window.Window = data; - // Realize the immersive effect. - try { - const promise: Promise = windowClass.setWindowLayoutFullScreen(true); - promise.then(() => { - hilog.info(0x0000, TAG, 'Succeeded in setting the window layout to full-screen mode.'); - }).catch((err: BusinessError) => { - hilog.info(0x0000, TAG, - `Failed to set the window layout to full-screen mode. Cause: ${err.code}, ${err.message}`); - }); - } catch { - hilog.error(0x0000, TAG, 'Failed to set the window layout to full-screen mode. '); - } - }); + private static windowClass: window.Window; + + public static initialize(windowStage: window.WindowStage, ability: UIAbility) { + try { + WindowUtil.windowClass = windowStage.getMainWindowSync(); + const uiContext: UIContext = WindowUtil.windowClass.getUIContext(); + AppStorage.setOrCreate(Constants.KEY_UI_CONTEXT, uiContext); + WindowUtil.requestFullScreen(WindowUtil.windowClass); + WindowUtil.registerBreakPoint(WindowUtil.windowClass, ability); + } catch (err) { + const error = err as BusinessError; + hilog.error(0x0000, TAG, `Initialize failed. Cause code: ${error.code}, message: ${error.message}`); + } } - public static registerBreakPoint(windowStage: window.WindowStage,ability:UIAbility) { - windowStage.getMainWindow((err: BusinessError, data: window.Window) => { - if (err.code) { - hilog.error(0x0000, TAG, `Failed to get main window: ${err.message}`); - return; - } + public static requestFullScreen(windowClass: window.Window): void { + // Realize the immersive effect. + try { + const promise: Promise = windowClass.setWindowLayoutFullScreen(true); + promise.then(() => { + hilog.info(0x0000, TAG, 'Succeeded in setting the window layout to full-screen mode.'); + }).catch((err: BusinessError) => { + hilog.error(0x0000, TAG, + `Failed to set the window layout to full-screen mode. Cause: ${err.code}, ${err.message}`); + }); + } catch { + hilog.error(0x0000, TAG, 'Failed to set the window layout to full-screen mode. '); + } + + } + + public static registerBreakPoint(data: window.Window, ability: UIAbility) { + + try { BreakpointSystem.getInstance().updateWidthBp(data); + const systemAvoidArea: window.AvoidArea = data.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); + const navIndicatorAvoidArea: window.AvoidArea = + data.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR); + WindowUtil.setAvoidArea(data, window.AvoidAreaType.TYPE_SYSTEM, systemAvoidArea); + WindowUtil.setAvoidArea(data, window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR, navIndicatorAvoidArea); data.on('windowSizeChange', () => BreakpointSystem.getInstance().onWindowSizeChange(data)); data.on('avoidAreaChange', (avoidAreaOption) => { - if (avoidAreaOption.type === window.AvoidAreaType.TYPE_SYSTEM || - avoidAreaOption.type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) { - WindowUtil.setAvoidArea(avoidAreaOption.type, avoidAreaOption.area); - } + WindowUtil.setAvoidArea(data, avoidAreaOption.type, avoidAreaOption.area); }); - createNWeb(ResourceUtil.getRawFileStringByKey(getContext(ability) as common.UIAbilityContext, - ConfigMapKey.GALLERY_URL), data.getUIContext()); - }) + } catch (err) { + const error = err as BusinessError; + hilog.error(0x0000, TAG, + `Register avoidAreaChange or windowSizeChange failed. code: ${error.code}, message: ${error.message}`); + } + createNWeb(ResourceUtil.getRawFileStringByKey(getContext(ability) as common.UIAbilityContext, + ConfigMapKey.GALLERY_URL), data.getUIContext()); } // Get status bar height and indicator height. - public static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea) { + private static setAvoidArea(data: window.Window, type: window.AvoidAreaType, area: window.AvoidArea) { + const context: UIContext = data.getUIContext(); if (type === window.AvoidAreaType.TYPE_SYSTEM) { - AppStorage.setOrCreate('topRectHeight', px2vp(area.topRect.height)); - } else { - AppStorage.setOrCreate('bottomRectHeight', px2vp(area.bottomRect.height)); + AppStorage.setOrCreate(Constants.KEY_STATUS_BAR_HEIGHT, context.px2vp(area.topRect.height)); + } else if (type === window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR) { + AppStorage.setOrCreate(Constants.KEY_NAV_INDICATOR_HEIGHT, context.px2vp(area.bottomRect.height)); } } } \ No newline at end of file diff --git a/webprerenderlibrary/src/main/ets/pages/WebPage.ets b/webprerenderlibrary/src/main/ets/view/WebPage.ets similarity index 100% rename from webprerenderlibrary/src/main/ets/pages/WebPage.ets rename to webprerenderlibrary/src/main/ets/view/WebPage.ets index b0c4c52c57def6260f925f077ba39d36c2e2865a..b4df6c2a4713e0b413ac33085550521bc9177fba 100644 --- a/webprerenderlibrary/src/main/ets/pages/WebPage.ets +++ b/webprerenderlibrary/src/main/ets/view/WebPage.ets @@ -13,13 +13,13 @@ * limitations under the License. */ -import { BuilderNode, FrameNode, NodeController, UIContext } from '@kit.ArkUI'; -import { hilog } from '@kit.PerformanceAnalysisKit'; import { common } from '@kit.AbilityKit'; +import { BuilderNode, FrameNode, NodeController, UIContext } from '@kit.ArkUI'; import { webview } from '@kit.ArkWeb'; import { BusinessError } from '@kit.BasicServicesKit'; -import { ConfigMapKey, ResourceUtil } from '../common/ResourceUtil'; +import { hilog } from '@kit.PerformanceAnalysisKit'; import { Constants } from '../common/Constants'; +import { ConfigMapKey, ResourceUtil } from '../common/ResourceUtil'; class Data { public url: string = diff --git a/webprerenderlibrary/src/main/ets/pages/WebPreRenderPage.ets b/webprerenderlibrary/src/main/ets/view/WebPreRenderView.ets similarity index 70% rename from webprerenderlibrary/src/main/ets/pages/WebPreRenderPage.ets rename to webprerenderlibrary/src/main/ets/view/WebPreRenderView.ets index 72fb1d29cc8902031062c095bf2b00eece6be88b..7ff8413b19dd27a7fd4ac690deea4f9eec8678de 100644 --- a/webprerenderlibrary/src/main/ets/pages/WebPreRenderPage.ets +++ b/webprerenderlibrary/src/main/ets/view/WebPreRenderView.ets @@ -16,16 +16,15 @@ import { common } from '@kit.AbilityKit'; import { Constants } from '../common/Constants'; import { ConfigMapKey, ResourceUtil } from '../common/ResourceUtil'; -import { BreakpointType } from '../common/utils/BreakpointSystem'; +import { BreakpointType, BreakpointTypeEnum } from '../common/utils/BreakpointSystem'; import { getNWeb } from './WebPage'; -@Entry @Component -export struct WebPreRenderPage { +export struct WebPreRenderView { @State isShowSheet: boolean = false; - @StorageProp('currentBreakpoint') curBp: string = Constants.BREAKPOINTS[1]; - @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; - @StorageProp('topRectHeight') topRectHeight: number = 0; + @StorageProp(Constants.KEY_BREAKPOINT) curBp: string = Constants.BREAKPOINTS[1]; + @StorageProp(Constants.KEY_NAV_INDICATOR_HEIGHT) navIndicatorHeight: number = 0; + @StorageProp(Constants.KEY_STATUS_BAR_HEIGHT) statusBarHeight: number = 0; @Builder mySheet() { @@ -36,7 +35,7 @@ export struct WebPreRenderPage { .width($r('app.string.full_height_width')) } .padding({ - top: $r('app.string.index_tab'), + top: $r('app.float.index_tab'), left: $r('sys.float.padding_level8'), right: $r('sys.float.padding_level8') }) @@ -54,20 +53,28 @@ export struct WebPreRenderPage { .fontSize($r('sys.float.Title_L')) .alignSelf(ItemAlign.Start) .margin({ - left: this.curBp === 'sm' ? $r('sys.float.padding_level0') : - this.curBp === 'md' ? $r('sys.float.padding_level4') : $r('sys.float.padding_level8') + left: new BreakpointType({ + sm: $r('sys.float.padding_level0'), + md: $r('sys.float.padding_level4'), + lg: $r('sys.float.padding_level8'), + xl: $r('sys.float.padding_level8') + }).getValue(this.curBp) }) Column() { Button($r('app.string.text_name')) .fontSize($r('sys.float.Subtitle_M')) .fontColor($r('sys.color.font_on_primary')) - .width(this.curBp === 'sm' ? '100%' : $r('app.float.index_button_width_lg')) + .width(this.curBp === BreakpointTypeEnum.SM ? '100%' : $r('app.float.index_button_width_lg')) .height($r('app.float.button_height')) .margin({ top: $r('sys.float.padding_level6') }) .backgroundColor($r('sys.color.comp_background_emphasize')) .bindSheet(this.isShowSheet, this.mySheet(), { - height: new BreakpointType({sm:748, md:560, lg:560}).getValue(this.curBp), - width: this.curBp === 'sm' ? '100%' : 480, + height: new BreakpointType({ + sm: $r('app.float.bind_sheet_height_sm'), + md: $r('app.float.bind_sheet_height_non_sm'), + lg: $r('app.float.bind_sheet_height_non_sm') + }).getValue(this.curBp), + width: this.curBp === BreakpointTypeEnum.SM ? '100%' : $r('app.float.bind_sheet_width'), preferType: SheetType.CENTER, backgroundColor: $r('sys.color.comp_background_primary'), onWillDisappear: () => { @@ -88,8 +95,8 @@ export struct WebPreRenderPage { .padding({ left: $r('sys.float.padding_level8'), right: $r('sys.float.padding_level8'), - top: Constants.PADDING_TOP_INDEX + this.topRectHeight, - bottom: Constants.PADDING_BOTTOM_INDEX + this.bottomRectHeight + top: Constants.PADDING_TOP_INDEX + this.statusBarHeight, + bottom: Constants.PADDING_BOTTOM_INDEX + this.navIndicatorHeight }) } .width($r('app.string.full_height_width')) diff --git a/webprerenderlibrary/src/main/resources/base/element/float.json b/webprerenderlibrary/src/main/resources/base/element/float.json index 6d2c7b40903578cfafbf41ff058dc2797666d166..b3bd07e7255d908054070bdebb78b9e81d6a9f09 100644 --- a/webprerenderlibrary/src/main/resources/base/element/float.json +++ b/webprerenderlibrary/src/main/resources/base/element/float.json @@ -7,6 +7,22 @@ { "name": "button_height", "value": "40vp" + }, + { + "name": "index_tab", + "value": "56vp" + }, + { + "name": "bind_sheet_height_sm", + "value": "748vp" + }, + { + "name": "bind_sheet_height_non_sm", + "value": "560vp" + }, + { + "name": "bind_sheet_width", + "value": "480vp" } ] } \ No newline at end of file diff --git a/webprerenderlibrary/src/main/resources/base/element/string.json b/webprerenderlibrary/src/main/resources/base/element/string.json index af7e1aafa57639ef1df8abbfa4755abe31a4fa1e..76fb5b23c3451669a62827b7e0d4d175e9cb27ce 100644 --- a/webprerenderlibrary/src/main/resources/base/element/string.json +++ b/webprerenderlibrary/src/main/resources/base/element/string.json @@ -1,33 +1,17 @@ { "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "Web页面瞬开效果实践" - }, { "name": "title", - "value": "Web页面瞬开效果实践" + "value": "Practice of Web Page Instant Open Effect" }, { "name": "text_name", - "value": "点击打开Web页面" + "value": "Click to open the web page." }, { "name": "full_height_width", "value": "100%" }, - { - "name": "index_tab", - "value": "56vp" - }, { "name": "reason_internet", "value": "Used for instant page loading effects in web scenarios" diff --git a/webprerenderlibrary/src/main/resources/base/media/layered_image.json b/webprerenderlibrary/src/main/resources/base/media/layered_image.json deleted file mode 100644 index fb49920440fb4d246c82f9ada275e26123a2136a..0000000000000000000000000000000000000000 --- a/webprerenderlibrary/src/main/resources/base/media/layered_image.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "layered-image": - { - "background" : "$media:background", - "foreground" : "$media:foreground" - } -} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/resources/en_US/element/float.json b/webprerenderlibrary/src/main/resources/en_US/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..4d5aa4ae53de7fa51ab24cd0159f05be8b4d84ab --- /dev/null +++ b/webprerenderlibrary/src/main/resources/en_US/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "index_tab", + "value": "56vp" + } + ] +} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/resources/en_US/element/string.json b/webprerenderlibrary/src/main/resources/en_US/element/string.json index 37f89039cc94dca60cd6c21a5326364215a7d7f8..76fb5b23c3451669a62827b7e0d4d175e9cb27ce 100644 --- a/webprerenderlibrary/src/main/resources/en_US/element/string.json +++ b/webprerenderlibrary/src/main/resources/en_US/element/string.json @@ -1,17 +1,5 @@ { "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "Practice of Web Page Instant Open Effect" - }, { "name": "title", "value": "Practice of Web Page Instant Open Effect" @@ -24,10 +12,6 @@ "name": "full_height_width", "value": "100%" }, - { - "name": "index_tab", - "value": "56vp" - }, { "name": "reason_internet", "value": "Used for instant page loading effects in web scenarios" diff --git a/webprerenderlibrary/src/main/resources/zh_CN/element/float.json b/webprerenderlibrary/src/main/resources/zh_CN/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..c36779fa6ef0d2e9782c0fc8dfcdad2b8a678ed2 --- /dev/null +++ b/webprerenderlibrary/src/main/resources/zh_CN/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "index_tab", + "value": "72vp" + } + ] +} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/resources/zh_CN/element/string.json b/webprerenderlibrary/src/main/resources/zh_CN/element/string.json index 4fa1acda9237a5db808ac8343f55526833986377..0f76872a37e195ef469437bf736e2ddddc7b479a 100644 --- a/webprerenderlibrary/src/main/resources/zh_CN/element/string.json +++ b/webprerenderlibrary/src/main/resources/zh_CN/element/string.json @@ -1,17 +1,5 @@ { "string": [ - { - "name": "module_desc", - "value": "module description" - }, - { - "name": "EntryAbility_desc", - "value": "description" - }, - { - "name": "EntryAbility_label", - "value": "Web页面瞬开效果实践" - }, { "name": "title", "value": "Web页面瞬开效果实践" @@ -24,10 +12,6 @@ "name": "full_height_width", "value": "100%" }, - { - "name": "index_tab", - "value": "72vp" - }, { "name": "reason_internet", "value": "用于Web页面的瞬开效果场景" diff --git a/webprerendersample/oh-package-lock.json5 b/webprerendersample/oh-package-lock.json5 deleted file mode 100644 index c3369b6b427564e70f342f8789381dab4497f0e0..0000000000000000000000000000000000000000 --- a/webprerendersample/oh-package-lock.json5 +++ /dev/null @@ -1,18 +0,0 @@ -{ - "meta": { - "stableOrder": true - }, - "lockfileVersion": 3, - "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", - "specifiers": { - "webprerenderlibrary@../webprerenderlibrary": "webprerenderlibrary@../webprerenderlibrary" - }, - "packages": { - "webprerenderlibrary@../webprerenderlibrary": { - "name": "webprerenderlibrary", - "version": "1.0.0", - "resolved": "../webprerenderlibrary", - "registryType": "local" - } - } -} \ No newline at end of file diff --git a/webprerendersample/oh-package.json5 b/webprerendersample/oh-package.json5 index 2a4c88b30223923de7c60ecf0a60d41041a9d48d..c84bc8bd5877ae861e0be7b7feaab2193866fbae 100644 --- a/webprerendersample/oh-package.json5 +++ b/webprerendersample/oh-package.json5 @@ -6,6 +6,6 @@ "author": "", "license": "", "dependencies": { - "webprerenderlibrary": "file:../webprerenderlibrary" + "@ohos_samples/webprerenderlibrary": "file:../webprerenderlibrary" } } \ No newline at end of file diff --git a/webprerendersample/src/main/ets/entryability/EntryAbility.ets b/webprerendersample/src/main/ets/entryability/EntryAbility.ets index 9b46fa0bd4daca15c24c4451d44cc828e76f7713..d3b08d2a30b86aff0d07610d8c21ea4d828811ea 100644 --- a/webprerendersample/src/main/ets/entryability/EntryAbility.ets +++ b/webprerendersample/src/main/ets/entryability/EntryAbility.ets @@ -13,28 +13,17 @@ * limitations under the License. */ -import { Configuration, ConfigurationConstant, UIAbility } from '@kit.AbilityKit'; -import { window } from '@kit.ArkUI'; +import { ConfigurationConstant, UIAbility } from '@kit.AbilityKit'; +import { window } from '@kit.ArkUI'; import { hilog } from '@kit.PerformanceAnalysisKit'; -import { WindowUtil } from 'webprerenderlibrary'; - -export default class WebprerendersampleAbility extends UIAbility { +import { WebPrerenderController } from '@ohos_samples/webprerenderlibrary'; +export default class WebPrerenderSampleAbility extends UIAbility { onCreate(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); - AppStorage.setOrCreate('systemColorMode', this.context.config.colorMode); this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } - onConfigurationUpdate(newConfig: Configuration): void { - let newColorMode: ConfigurationConstant.ColorMode = - newConfig.colorMode || ConfigurationConstant.ColorMode.COLOR_MODE_DARK; - let currentColorMode = AppStorage.get('systemColorMode'); - if (newColorMode !== currentColorMode) { - AppStorage.setOrCreate('systemColorMode', newColorMode); - } - } - onDestroy(): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); } @@ -47,9 +36,8 @@ export default class WebprerendersampleAbility extends UIAbility { hilog.error(0x0000, 'testTag', '%{public}s', `Failed to load the content. Cause: ${err.code}`); return; } + WebPrerenderController.initWindowConfig(windowStage, this); hilog.info(0x0000, 'testTag', '%{public}s', `Succeed in loading the content.`); - WindowUtil.requestFullScreen(windowStage) - WindowUtil.registerBreakPoint(windowStage,this) }); } diff --git a/webprerendersample/src/main/ets/pages/Index.ets b/webprerendersample/src/main/ets/pages/Index.ets index 8b0ab46fe93ebc8dcc8111c7dc4801eac7f8466a..cec612be6674a2c0922f52a06152e9830ad325d5 100644 --- a/webprerendersample/src/main/ets/pages/Index.ets +++ b/webprerendersample/src/main/ets/pages/Index.ets @@ -13,84 +13,14 @@ * limitations under the License. */ -import { common } from '@kit.AbilityKit'; -import { ConfigMapKey, ResourceUtil } from 'webprerenderlibrary/src/main/ets/common/ResourceUtil'; -import { Constants } from 'webprerenderlibrary/src/main/ets/common/Constants'; -import { getNWeb } from 'webprerenderlibrary/src/main/ets/pages/WebPage'; -import { BreakpointType } from 'webprerenderlibrary/src/main/ets/common/utils/BreakpointSystem'; +import { WebPreRenderComponent } from '@ohos_samples/webprerenderlibrary'; @Entry @Component -struct WebPreRender { - @State isShowSheet: boolean = false; - @StorageProp('currentBreakpoint') curBp: string = Constants.BREAKPOINTS[1]; - @StorageProp('bottomRectHeight') bottomRectHeight: number = 0; - @StorageProp('topRectHeight') topRectHeight: number = 0; - - @Builder - mySheet() { - Column() { - NodeContainer(getNWeb(ResourceUtil.getRawFileStringByKey(getContext(this) as common.UIAbilityContext, - ConfigMapKey.GALLERY_URL))) - .height($r('app.string.full_height_width')) - .width($r('app.string.full_height_width')) - } - .padding({ - top: $r('app.string.index_tab'), - left: $r('sys.float.padding_level8'), - right: $r('sys.float.padding_level8') - }) - .width($r('app.string.full_height_width')) - .height($r('app.string.full_height_width')) - .backgroundColor($r('sys.color.comp_background_primary')) - } - +struct Index { build() { Column() { - Column() { - Text($r('app.string.title')) - .fontWeight(FontWeight.Bold) - .fontColor($r('sys.color.font_primary')) - .fontSize($r('sys.float.Title_L')) - .alignSelf(ItemAlign.Start) - .margin({ - left: this.curBp === 'sm' ? $r('sys.float.padding_level0') : - this.curBp === 'md' ? $r('sys.float.padding_level4') : $r('sys.float.padding_level8') - }) - Column() { - Button($r('app.string.text_name')) - .fontSize($r('sys.float.Subtitle_M')) - .fontColor($r('sys.color.font_on_primary')) - .width(this.curBp === 'sm' ? '100%' : $r('app.float.index_button_width_lg')) - .height($r('app.float.button_height')) - .margin({ top: $r('sys.float.padding_level6') }) - .backgroundColor($r('sys.color.comp_background_emphasize')) - .bindSheet(this.isShowSheet, this.mySheet(), { - height: new BreakpointType({sm:748, md:560, lg:560}).getValue(this.curBp), - width: this.curBp === 'sm' ? '100%' : 480, - preferType: SheetType.CENTER, - backgroundColor: $r('sys.color.comp_background_primary'), - onWillDisappear: () => { - this.isShowSheet = !this.isShowSheet; - } - }) - .onClick(() => { - this.isShowSheet = !this.isShowSheet; - }) - } - .width(Constants.FULL_WIDTH) - } - .backgroundColor($r('sys.color.background_secondary')) - .width(Constants.FULL_WIDTH) - .height(Constants.FULL_HEIGHT) - .alignItems(HorizontalAlign.Center) - .justifyContent(FlexAlign.SpaceBetween) - .padding({ - left: $r('sys.float.padding_level8'), - right: $r('sys.float.padding_level8'), - top: Constants.PADDING_TOP_INDEX + this.topRectHeight, - bottom: Constants.PADDING_BOTTOM_INDEX + this.bottomRectHeight - }) + WebPreRenderComponent() } .width($r('app.string.full_height_width')) .height($r('app.string.full_height_width')) diff --git a/webprerenderlibrary/src/main/resources/base/element/color.json b/webprerendersample/src/main/resources/base/element/color.json similarity index 100% rename from webprerenderlibrary/src/main/resources/base/element/color.json rename to webprerendersample/src/main/resources/base/element/color.json diff --git a/webprerendersample/src/main/resources/base/element/string.json b/webprerendersample/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0f9af8bd300b2ed1175aae23f8e4e2965729014f --- /dev/null +++ b/webprerendersample/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "Practice of Web Page Instant Open Effect" + } + ] +} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/resources/base/media/background.png b/webprerendersample/src/main/resources/base/media/background.png similarity index 100% rename from webprerenderlibrary/src/main/resources/base/media/background.png rename to webprerendersample/src/main/resources/base/media/background.png diff --git a/webprerenderlibrary/src/main/resources/base/media/foreground.png b/webprerendersample/src/main/resources/base/media/foreground.png similarity index 100% rename from webprerenderlibrary/src/main/resources/base/media/foreground.png rename to webprerendersample/src/main/resources/base/media/foreground.png diff --git a/webprerendersample/src/main/resources/base/media/layered_image.json b/webprerendersample/src/main/resources/base/media/layered_image.json new file mode 100644 index 0000000000000000000000000000000000000000..4f9ad6307a2bc56beb6d0fce0a49cbf213b20a74 --- /dev/null +++ b/webprerendersample/src/main/resources/base/media/layered_image.json @@ -0,0 +1,6 @@ +{ + "layered-image": { + "background": "$media:background", + "foreground": "$media:foreground" + } +} \ No newline at end of file diff --git a/webprerenderlibrary/src/main/resources/base/media/startIcon.png b/webprerendersample/src/main/resources/base/media/startIcon.png similarity index 100% rename from webprerenderlibrary/src/main/resources/base/media/startIcon.png rename to webprerendersample/src/main/resources/base/media/startIcon.png diff --git a/webprerendersample/src/main/resources/en_US/element/string.json b/webprerendersample/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0f9af8bd300b2ed1175aae23f8e4e2965729014f --- /dev/null +++ b/webprerendersample/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "Practice of Web Page Instant Open Effect" + } + ] +} \ No newline at end of file diff --git a/webprerendersample/src/main/resources/zh_CN/element/string.json b/webprerendersample/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..07d905d7d42f7a16006a2f298a5584faa210bafb --- /dev/null +++ b/webprerendersample/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "描述" + }, + { + "name": "EntryAbility_label", + "value": "Web页面瞬开效果实践" + } + ] +} \ No newline at end of file