source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\ui\arkts-navigation-navigation.md
@Entry @Component struct Index { pageStack : NavPathStack = new NavPathStack(); build() { Navigation(this.pageStack){ }.onAppear(() => { this.pageStack.pushPathByName("PageOne", null, false); }) .hideNavBar(true) } }
application-dev\ui\arkts-navigation-tabs.md
TabContent() { Text('Home tab content').fontSize(30) } .tabBar('Home')
application-dev\ui\arkts-navigation-tabs.md
Tabs() { TabContent() { Text('Home tab content').fontSize(30) } .tabBar('Home') TabContent() { Text('Recommended tab content').fontSize(30) } .tabBar('Recommended') TabContent() { Text('Discover tab content').fontSize(30) } .tabBar('Discover') TabContent() { Text('Me tab content...
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.End }) { // TabContent: Home, Discover, Recommended, and Me // ... }
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.Start }) { // TabContent: Following, Video, Game, Digital, Technology, Sports, Movie // ... }
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.Start }) { // TabContent: Home, Discover, Recommended, and Me // ... } .vertical(true) .barWidth(100) .barHeight(200)
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.End }) { TabContent(){ Column(){ Tabs(){ // Content on the top navigation bar // ... } } .backgroundColor('#ff08a8f1') .width('100%') } .tabBar('Home') // Other TabContent content: Discover, Recommended, and Me // ... } .scrollable(f...
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.End }) { // TabContent: Home, Discover, Recommended, and Me // ... } .barMode(BarMode.Fixed)
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.Start }) { // TabContent: follow, video, game, digital, technology, sports, movie, humanities, art, nature, and military // ... } .barMode(BarMode.Scrollable)
application-dev\ui\arkts-navigation-tabs.md
@State currentIndex: number = 0; @Builder tabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) { Column() { Image(this.currentIndex === targetIndex ? selectedImg : normalImg) .size({ width: 25, height: 25 }) Text(title) .fontColor(this.currentIndex === target...
application-dev\ui\arkts-navigation-tabs.md
TabContent() { Column(){ Text('Me tab content') } .width('100%') .height('100%') .backgroundColor('#007DFF') } .tabBar(this.tabBuilder('Me', 0, $r('app.media.mine_selected'), $r('app.media.mine_normal')))
application-dev\ui\arkts-navigation-tabs.md
@Entry @Component struct TabsExample1 { @State currentIndex: number = 2 @Builder tabBuilder(title: string, targetIndex: number) { Column() { Text(title) .fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B6B6B') } } build() { Column() { Tabs({ barPosition: BarPositio...
application-dev\ui\arkts-navigation-tabs.md
@State currentIndex: number = 2 @State currentAnimationMode: AnimationMode = AnimationMode.CONTENT_FIRST private controller: TabsController = new TabsController() Tabs({ barPosition: BarPosition.End, index: this.currentIndex, controller: this.controller }) { // ... } .height(600) .animationMode(this.currentAnimation...
application-dev\ui\arkts-navigation-tabs.md
Tabs({ barPosition: BarPosition.End, controller: this.controller, index: this.currentIndex }) { // ... } .onContentWillChange((currentIndex, comingIndex) => { if (comingIndex == 2) { return false } return true })
application-dev\ui\arkts-navigation-tabs.md
import { abilityManager, Configuration } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { promptAction, uiAppearance } from '@kit.ArkUI'; @Entry @Component struct Demo { @State fontColor: string = '#182431'; @State selectedFontColor: string = '#007DFF'; @State currentIndex:...
application-dev\ui\arkts-navigation-transition.md
//PageOne.ets @Entry @Component struct NavigationDemo { @Provide('pathInfos') pathInfos: NavPathStack = new NavPathStack(); private listArray: Array<string> = ['WLAN', 'Bluetooth', 'Personal Hotpot', 'Connect & Share']; build() { Column() { Navigation(this.pathInfos) { TextInput({ placeholder: ...
application-dev\ui\arkts-navigation-transition.md
//PageOne.ets @Builder export function MyCommonPageBuilder(name: string, param: string) { MyCommonPage({ name: name, value: param }) } @Component export struct MyCommonPage { pathInfos: NavPathStack = new NavPathStack(); name: String = ''; @State value: String = ''; build() { NavDestination() { C...
application-dev\ui\arkts-navigation-transition.md
//PageTwo.ets @Builder export function MySharePageBuilder(name: string, param: string) { MySharePage({ name: name }) } @Component export struct MySharePage { pathInfos: NavPathStack = new NavPathStack(); name: String = ''; private listArray: Array<string> = ['Projection', 'Print', 'VPN', 'Private DNS', 'NFC'];...
application-dev\ui\arkts-navigation-transition.md
{ "routerMap" : [ { "name" : "WLAN", "pageSourceFile" : "src/main/ets/pages/PageOne.ets", "buildFunction" : "MyCommonPageBuilder" }, { "name" : "Bluetooth", "pageSourceFile" : "src/main/ets/pages/PageOne.ets", "buildFunction" : "MyCommonPageBuilder" }, { ...
application-dev\ui\arkts-page-transition-animation.md
pageTransition() { PageTransitionEnter() PageTransitionExit() }
application-dev\ui\arkts-page-transition-animation.md
PageTransitionEnter({type?: RouteType,duration?: number,curve?: Curve | string,delay?: number})
application-dev\ui\arkts-page-transition-animation.md
PageTransitionExit({type?: RouteType,duration?: number,curve?: Curve | string,delay?: number})
application-dev\ui\arkts-page-transition-animation.md
// page A pageTransition() { // Configure the page entrance animation to sliding in from the left, with the duration of 1200 ms. The settings take effect no matter whether the push or pop operation is performed on the page stack. PageTransitionEnter({ type: RouteType.None, duration: 1200 }) .slide(SlideEffect.L...
application-dev\ui\arkts-page-transition-animation.md
// page B pageTransition() { // Configure the page entrance animation to sliding in from the right, with the duration of 1000 ms. The settings take effect no matter whether the push or pop operation is performed on the page stack. PageTransitionEnter({ type: RouteType.None, duration: 1000 }) .slide(SlideEffect....
application-dev\ui\arkts-page-transition-animation.md
// page A pageTransition() { // Configure the page entrance animation to sliding in from the right, with the duration of 1200 ms. The settings take effect only when the push operation is performed on the page stack. PageTransitionEnter({ type: RouteType.Push, duration: 1200 }) .slide(SlideEffect.Right) // Con...
application-dev\ui\arkts-page-transition-animation.md
// page B pageTransition() { // Configure the page entrance animation to sliding in from the right, with the duration of 1000 ms. The settings take effect only when the push operation is performed on the page stack. PageTransitionEnter({ type: RouteType.Push, duration: 1000 }) .slide(SlideEffect.Right) // Con...
application-dev\ui\arkts-page-transition-animation.md
pageTransition() { PageTransitionEnter({ type: RouteType.None, duration: 0 }) PageTransitionExit({ type: RouteType.None, duration: 0 }) }
application-dev\ui\arkts-page-transition-animation.md
// PageTransitionSrc1 @Entry @Component struct PageTransitionSrc1 { build() { Column() { Image($r('app.media.mountain')) .width('90%') .height('80%') .objectFit(ImageFit.Fill) .syncLoad(true) // Load the image synchronously so that the image has been loaded when the page is d...
application-dev\ui\arkts-page-transition-animation.md
// PageTransitionDst1 @Entry @Component struct PageTransitionDst1 { build() { Column() { Image($r('app.media.forest')) .width('90%') .height('80%') .objectFit(ImageFit.Fill) .syncLoad(true) // Load the image synchronously so that the image has been loaded when the page is dis...
application-dev\ui\arkts-page-transition-animation.md
// PageTransitionSrc2 @Entry @Component struct PageTransitionSrc2 { build() { Column() { Image($r('app.media.mountain')) .width('90%') .height('80%') .objectFit(ImageFit.Fill) .syncLoad(true) // Load the image synchronously so that the image has been loaded when the page is d...
application-dev\ui\arkts-page-transition-animation.md
// PageTransitionDst2 @Entry @Component struct PageTransitionDst2 { build() { Column() { Image($r('app.media.forest')) .width('90%') .height('80%') .objectFit(ImageFit.Fill) .syncLoad(true) // Load the image synchronously so that the image has been loaded when the page is dis...
application-dev\ui\arkts-particle-animation.md
@Entry @Component struct ParticleExample { build() { Stack() { Text() .width(300).height(300).backgroundColor(Color.Black) Particle({ particles: [ { emitter: { particle: { type: ParticleType.POINT, // Particle type. config: { ...
application-dev\ui\arkts-particle-animation.md
// ... @State emitterProperties: Array<EmitterProperty> = [ { index: 0, emitRate: 100, position: { x: 60, y: 80 }, size: { width: 200, height: 200 } } ] Particle(...).width(300).height(300).emitter(this.emitterProperties) // Dynamically adjust the position of the particle emitter. // ...
application-dev\ui\arkts-particle-animation.md
// ... color: { range: [Color.White, Color.Yellow], // Initial color range. distributionType: DistributionType.GAUSSIAN // Random value distribution type of the initial color. }, // ...
application-dev\ui\arkts-particle-animation.md
// ... emitter: { particle: { // ... lifetime: 300, // Particle lifetime, in ms. lifetimeRange: 100 // Range of particle lifetime values, in ms. }, emitRate: 10, // Number of particles emitted per second. position: [0, 0], shape: ParticleEmitterShape.RECTANGLE // Emitter shape. }, color: { range...
application-dev\ui\arkts-particle-animation.md
// ... Particle({ particles: [ { emitter: // ... color: // ... scale: { range: [0.0, 0.0], updater: { type: ParticleUpdater.CURVE, config: [ { from: 0.0, to: 0.5, startMillis: 0, endMillis: 3000, curve: Curve...
application-dev\ui\arkts-popup-and-menu-components-menu.md
Button('click for Menu') .bindMenu([ { value: 'Menu1', action: () => { console.info('handle Menu1 select') } } ])
application-dev\ui\arkts-popup-and-menu-components-menu.md
class Tmp { iconStr2: ResourceStr = $r("app.media.view_list_filled") set(val: Resource) { this.iconStr2 = val } } @Entry @Component struct menuExample { @State select: boolean = true private iconStr: ResourceStr = $r("app.media.view_list_filled") private iconStr2: ResourceStr = $r("app.media.view_list...
application-dev\ui\arkts-popup-and-menu-components-menu.md
Button('click for Menu') .bindMenu(this.MyMenu)
application-dev\ui\arkts-popup-and-menu-components-menu.md
Button('click for Menu') .bindContextMenu(this.MyMenu, ResponseType.RightClick)
application-dev\ui\arkts-popup-and-menu-components-popup.md
@Entry @Component struct PopupExample { @State handlePopup: boolean = false build() { Column() { Button('PopupOptions') .onClick(() => { this.handlePopup = !this.handlePopup }) .bindPopup(this.handlePopup, { message: 'This is a popup with PopupOptions', ...
application-dev\ui\arkts-popup-and-menu-components-popup.md
@Entry @Component struct PopupExample { @State handlePopup: boolean = false build() { Column() { Button('PopupOptions') .onClick(() => { this.handlePopup = !this.handlePopup }) .bindPopup(this.handlePopup, { message: 'This is a popup with PopupOptions', ...
application-dev\ui\arkts-popup-and-menu-components-popup.md
@Entry @Component struct PopupExample22 { @State handlePopup: boolean = false build() { Column() { Button('PopupOptions').margin({ top: 200 }) .onClick(() => { this.handlePopup = !this.handlePopup }) .bindPopup(this.handlePopup, { message: 'This is a popup with...
application-dev\ui\arkts-popup-and-menu-components-popup.md
// xxx.ets @Entry @Component struct PopupExample { @State handlePopup: boolean = false @State customPopup: boolean = false // Define the popup content in the popup builder. @Builder popupBuilder() { Row() { Text('Custom Popup with transitionEffect').fontSize(10) }.height(50).padding(5) } bui...
application-dev\ui\arkts-popup-and-menu-components-popup.md
@Entry @Component struct Index { @State customPopup: boolean = false // Define the popup content in the popup builder. @Builder popupBuilder() { Row({ space: 2 }) { Image($r("app.media.icon")).width(24).height(24).margin({ left: 5 }) Text('This is Custom Popup').fontSize(15) }.width(200).heigh...
application-dev\ui\arkts-popup-and-menu-components-popup.md
// xxx.ets @Entry @Component struct PopupExample { @State handlePopup: boolean = false build() { Column({ space: 100 }) { Button('PopupOptions') .onClick(() => { this.handlePopup = !this.handlePopup }) .bindPopup(this.handlePopup, { width: 200, messa...
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
promptAction.openMenu(contentNode, { id: targetId }, { enableArrow: true }) .then(() => { console.info('openMenu success'); }) .catch((err: BusinessError) => { console.info('openMenu error: ' + err.code + ' ' + err.message); })
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
private contentNode: ComponentContent<Object> = new ComponentContent(uiContext, wrapBuilder(buildText), this.message);
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
@Builder export function buildText(params: Params) { Menu({ // Set the icon for the menu. icon: { image: $r('app.media.app_icon'), width: 32, height: 32, fillColor: Color.White, borderRadius: 10 } as MenuIconOptions, // Set the text conten...
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
let frameNode: FrameNode | null = this.ctx.getFrameNodeByUniqueId(this.getUniqueId()); let targetId = frameNode?.getChild(0)?.getUniqueId();
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
private options: MenuOptions = { enableArrow: true, placement: Placement.Bottom };
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
promptAction.updateMenu(contentNode, { enableArrow: false }, true) .then(() => { console.info('updateMenu success'); }) .catch((err: BusinessError) => { console.info('updateMenu error: ' + err.code + ' ' + err.message); })
application-dev\ui\arkts-popup-and-menu-components-uicontext-menu.md
promptAction.closeMenu(contentNode) .then(() => { console.info('openMenu success'); }) .catch((err: BusinessError) => { console.info('openMenu error: ' + err.code + ' ' + err.message); })
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
promptAction.openPopup(contentNode, { id: targetId }, { enableArrow: true }) .then(() => { console.info('openPopup success'); }) .catch((err: BusinessError) => { console.info('openPopup error: ' + err.code + ' ' + err.message); })
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
private contentNode: ComponentContent<Object> = new ComponentContent(uiContext, wrapBuilder(buildText), this.message);
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
@Builder export function buildText(params: Params) { Popup({ // Set the icon for the menu. icon: { image: $r('app.media.app_icon'), width: 32, height: 32, fillColor: Color.White, borderRadius: 10 } as PopupIconOptions, // Set the text cont...
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
let frameNode: FrameNode | null = this.ctx.getFrameNodeByUniqueId(this.getUniqueId()); let targetId = frameNode?.getChild(0)?.getUniqueId();
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
private options: PopupCommonOptions = { enableArrow: true };
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
promptAction.updatePopup(contentNode, { enableArrow: false }, true) .then(() => { console.info('updatePopup success'); }) .catch((err: BusinessError) => { console.info('updatePopup error: ' + err.code + ' ' + err.message); })
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
promptAction.closePopup(contentNode) .then(() => { console.info('closePopup success'); }) .catch((err: BusinessError) => { console.info('closePopup error: ' + err.code + ' ' + err.message); })
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
// library/src/main/ets/components/MainPage.ets import { BusinessError } from '@kit.BasicServicesKit'; import { ComponentContent, TargetInfo, PromptAction } from '@kit.ArkUI'; export class PromptActionClass { private promptAction: PromptAction | null = null; private contentNode: ComponentContent<Object> | null = ...
application-dev\ui\arkts-popup-and-menu-components-uicontext-popup.md
// entry/src/main/ets/pages/Index.ets import { PromptActionClass } from "library"; import { ComponentContent, PromptAction } from '@kit.ArkUI'; class Params { text: string = "" promptActionClass: PromptActionClass = new PromptActionClass(); constructor(text: string, promptActionClass: PromptActionClass) { ...
application-dev\ui\arkts-rotation-transition-animation.md
// xx.ets import { display } from '@kit.ArkUI'; @Entry @Component struct rotation { build() { Stack() { Image($r('app.media.tree')) .position({ x: 0, y: 0 }) .size({ width: 100, height: 100 }) .id('image1') } .backgroundColor(Color.White) .size({ width: '100%', height: ...
application-dev\ui\arkts-rotation-transition-animation.md
// xx.ets import { display } from '@kit.ArkUI'; @Entry @Component struct rotation { // Obtain the screen display orientation received by listening for the windowsSizeChange event. @StorageLink('orientation') myOrientation: display.Orientation = display.Orientation.PORTRAIT; build() { Stack() { // Sw...
application-dev\ui\arkts-rotation-transition-animation.md
onWindowStageCreate(windowStage: window.WindowStage): void { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); let mainWindow: window.Window; try { mainWindow = windowStage.getMainWindowSync(); let displayClass: display.Display = display.getDefaultDisplaySync(); ...
application-dev\ui\arkts-router-to-navigation.md
// index.ets import { router } from '@kit.ArkUI'; @Entry @Component struct Index { @State message: string = 'Hello World'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) Button('router to pageOne', { stateEffect: true, type:...
application-dev\ui\arkts-router-to-navigation.md
// pageOne.ets import { router } from '@kit.ArkUI'; @Entry @Component struct pageOne { @State message: string = 'This is pageOne'; build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) Button('router back to Index', { stateEffect: ...
application-dev\ui\arkts-router-to-navigation.md
// index.ets @Entry @Component struct Index { pathStack: NavPathStack = new NavPathStack() build() { Navigation(this.pathStack) { Column() { Button('Push PageOne', { stateEffect: true, type: ButtonType.Capsule }) .width('80%') .height(40) .margin(20) .onCli...
application-dev\ui\arkts-router-to-navigation.md
// PageOne.ets @Builder export function PageOneBuilder() { PageOne() } @Component export struct PageOne { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { Column() { Button('Back to Home', { stateEffect: true, type: ButtonType.Capsule }) .width('80%') ...
application-dev\ui\arkts-router-to-navigation.md
import { router } from '@kit.ArkUI'; // push page router.pushUrl({ url:"pages/pageOne", params: null }) // pop page router.back({ url: "pages/pageOne" }) // replace page router.replaceUrl({ url: "pages/pageOne" }) // clear all page router.clear() // Obtain the size of the page stack. let size = router.getLength() ...
application-dev\ui\arkts-router-to-navigation.md
@Entry @Component struct Index { pathStack: NavPathStack = new NavPathStack() build() { // Set NavPathStack and pass it to Navigation. Navigation(this.pathStack) { // ... }.width('100%').height('100%') .title("Navigation") .mode(NavigationMode.Stack) } } // push page this.pathStack.pu...
application-dev\ui\arkts-router-to-navigation.md
// Navigation root container @Entry @Component struct Index { // Navigation creates a NavPathStack object decorated by @Provide. @Provide('pathStack') pathStack: NavPathStack = new NavPathStack() build() { Navigation(this.pathStack) { // ... } .title("Navigation") .mode(NavigationMode.Stac...
application-dev\ui\arkts-router-to-navigation.md
@Component export struct PageOne { pathStack: NavPathStack = new NavPathStack() build() { NavDestination() { // ... }.title('PageOne') .onReady((context: NavDestinationContext) => { this.pathStack = context.pathStack }) } }
application-dev\ui\arkts-router-to-navigation.md
@Entry @Component struct Index { pathStack: NavPathStack = new NavPathStack() // Set a NavPathStack object globally. aboutToAppear(): void { AppStorage.setOrCreate("PathStack", this.pathStack) } build() { Navigation(this.pathStack) { // ... }.title("Navigation") .mode(NavigationMode....
application-dev\ui\arkts-router-to-navigation.md
// Custom component on the subpage @Component struct CustomNode { pathStack: NavPathStack = new NavPathStack() aboutToAppear() { // query navigation info let navigationInfo: NavigationInfo = this.queryNavigationInfo() as NavigationInfo this.pathStack = navigationInfo.pathStack; } build() { Row...
application-dev\ui\arkts-router-to-navigation.md
// Callback after the page is created and mounted to the tree aboutToAppear(): void { } // Callback before the page is destroyed and unmounted aboutToDisappear(): void { } // Callback when the page is displayed onPageShow(): void { } // Callback when the page is hidden onPageHide(): void { }
application-dev\ui\arkts-router-to-navigation.md
@Component struct PageOne { aboutToDisappear() { } aboutToAppear() { } build() { NavDestination() { // ... } .onWillAppear(() => { }) .onAppear(() => { }) .onWillShow(() => { }) .onShown(() => { }) .onWillHide(() => { }) .onHidden(() => { }) ...
application-dev\ui\arkts-router-to-navigation.md
// library/src/main/ets/pages/Index.ets // library is the new custom name of the shared package. @Entry({ routeName: 'myPage' }) @Component export struct MyComponent { build() { Row() { Column() { Text('Library Page') .fontSize(50) .fontWeight(FontWe...
application-dev\ui\arkts-router-to-navigation.md
import { router } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; import('library/src/main/ets/pages/Index'); // Import the named route page from the library of the shared package. @Entry @Component struct Index { build() { Flex({ direction: FlexDirection.Column...
application-dev\ui\arkts-router-to-navigation.md
@Component export struct PageInHSP { build() { NavDestination() { // ... } } }
application-dev\ui\arkts-router-to-navigation.md
export { PageInHSP } from "./src/main/ets/pages/PageInHSP"
application-dev\ui\arkts-router-to-navigation.md
import { uiObserver } from '@kit.ArkUI'; function callBackFunc(info: uiObserver.RouterPageInfo) { console.info("RouterPageInfo is : " + JSON.stringify(info)) } // used in ability context. uiObserver.on('routerPageUpdate', this.context, callBackFunc); // used in UIContext. uiObserver.on('routerPageUpdate', this.g...
application-dev\ui\arkts-router-to-navigation.md
// EntryAbility.ets import { BusinessError } from '@kit.BasicServicesKit'; import { UIObserver } from '@kit.ArkUI'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { // ... windowStage.getMainWindow((err: BusinessError, data) => { ...
application-dev\ui\arkts-router-to-navigation.md
import { uiObserver } from '@kit.ArkUI'; // Custom component on the page @Component struct MyComponent { aboutToAppear() { let info: uiObserver.RouterPageInfo | undefined = this.queryRouterPageInfo(); } build() { // ... } }
application-dev\ui\arkts-router-to-navigation.md
import { uiObserver } from '@kit.ArkUI'; @Component export struct NavDestinationExample { build() { NavDestination() { MyComponent() } } } @Component struct MyComponent { navDesInfo: uiObserver.NavDestinationInfo | undefined aboutToAppear() { this.navDesInfo = this.queryNavDestinationInfo()...
application-dev\ui\arkts-routing.md
import { promptAction, router } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit';
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; // On the Home page function onJumpClick(): void { router.pushUrl({ url: 'pages/Detail' // Target URL. }, router.RouterMode.Standard, (err) => { if (err) { console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); ...
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; // On the Login page function onJumpClick(): void { router.replaceUrl({ url: 'pages/Profile' // Target URL. }, router.RouterMode.Standard, (err) => { if (err) { console.error(`Invoke replaceUrl failed, code is ${err.code}, message is ${err.message}`)...
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; // On the Setting page function onJumpClick(): void { router.pushUrl({ url: 'pages/Theme' // Target URL. }, router.RouterMode.Single, (err) => { if (err) { console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); ...
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; // On the SearchResult page function onJumpClick(): void { router.replaceUrl({ url: 'pages/SearchDetail' // Target URL. }, router.RouterMode.Single, (err) => { if (err) { console.error(`Invoke replaceUrl failed, code is ${err.code}, message is ${err....
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; class DataModelInfo { age: number = 0; } class DataModel { id: number = 0; info: DataModelInfo | null = null; } function onJumpClick(): void { // On the Home page let paramsInfo: DataModel = { id: 123, info: { age: 20 } }; router.pushUrl({ url...
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; class InfoTmp { age: number = 0 } class RouTmp { id: object = () => { } info: InfoTmp = new InfoTmp() } const params: RouTmp = router.getParams() as RouTmp; // Obtain the passed parameter object. const id: object = params.id // Obtain the value of the id attribute. const ...
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI';
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; router.back();
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; router.back({ url: 'pages/Home' });
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; router.back({ url: 'myPage' // myPage is the alias of the page to return to. });
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; router.back({ url: 'pages/Home', params: { info: 'From Home Page' } });
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI'; router.back({ url: 'myPage', // myPage is the alias of the page to return to. params: { info: 'From Home Page' } });
application-dev\ui\arkts-routing.md
@Entry @Component struct Home { @State message: string = 'Hello World'; onPageShow() { const params = this.getUIContext().getRouter().getParams() as Record<string, string>; // Obtain the passed parameter object. if (params) { const info: string = params.info as string; // Obtain the value of the info...
application-dev\ui\arkts-routing.md
import { router } from '@kit.ArkUI';