diff --git a/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/common/Index.ets b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/common/Index.ets index 02c5c6b987280c6731d3e40af7c56c416176a3af..31b7114eab8bd18fa9090568829e80a6e1e3ae31 100644 --- a/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/common/Index.ets +++ b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/common/Index.ets @@ -20,4 +20,15 @@ export interface Route { export interface RouteGroup extends Route { children: Route[]; -} \ No newline at end of file +} + +export class P2PManager { + public resourceToString(resource: Resource): string { + return getContext(this).resourceManager.getStringSync(resource); + } +} + +// 默认导出let +let p2pManager = new P2PManager(); + +export default p2pManager as P2PManager; \ No newline at end of file diff --git a/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navPathStackExtend/template1/PageOne.ets b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navPathStackExtend/template1/PageOne.ets index 425a821bbe9a7347e42df99d50049b85d97cfa93..15fcd5b2be442b5d8e786e7ff977b4c2a2705adf 100644 --- a/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navPathStackExtend/template1/PageOne.ets +++ b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navPathStackExtend/template1/PageOne.ets @@ -13,6 +13,7 @@ * limitations under the License. */ import { uiObserver } from '@kit.ArkUI'; +import resource from '../../common/Index'; @Builder export function PageOneBuilder() { @@ -35,7 +36,7 @@ export struct PageOneComponent { this.navDesInfo = this.queryNavDestinationInfo(true); this.text = JSON.stringify(this.navDesInfo?.name); }) - Text($r('app.string.navStackTemp1PageOne_text2') + this.text) + Text(resource.resourceToString($r('app.string.navStackTemp1PageOne_text2')) + this.text) .width('80%') .height(50) .margin(50) @@ -63,7 +64,7 @@ struct MyComponent { this.navDesInfo = this.queryNavDestinationInfo(false); this.text = JSON.stringify(this.navDesInfo?.name); }) - Text($r('app.string.navStackTemp1PageOne_text4') + this.text) + Text(resource.resourceToString($r('app.string.navStackTemp1PageOne_text4')) + this.text) .width('80%') .height(50) .margin(50) diff --git a/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template3/Index.ets b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template3/Index.ets index 55602c33da4ea1aafb953b3f6dc556efb1082df1..e2dc00b88c59669bf176cb5e0218a852ae050e9b 100644 --- a/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template3/Index.ets +++ b/code/DocsSample/ArkUISample/Navigation/entry/src/main/ets/pages/navigation/template3/Index.ets @@ -23,7 +23,7 @@ export struct NavigationExample3 { if (this.pageInfos === undefined) { this.pageInfos = new NavPathStack(); } - this.pageInfos.pushPath({ name: 'temp3-pageTwo', param: CustomTransition.getInstance().getAnimationId() }); + this.pageInfos.pushPath({ name: 'temp3-pageOne', param: CustomTransition.getInstance().getAnimationId() }); } build() {