1/* 2 * Copyright (c) 2021-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit ArkUI 19 */ 20 21import { Callback } from './@ohos.base'; 22import { AsyncCallback } from './@ohos.base'; 23 24/** 25 * @namespace router 26 * @syscap SystemCapability.ArkUI.ArkUI.Full 27 * @since 8 28 */ 29/** 30 * @namespace router 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @crossplatform 33 * @since 10 34 */ 35/** 36 * @namespace router 37 * @syscap SystemCapability.ArkUI.ArkUI.Full 38 * @crossplatform 39 * @atomicservice 40 * @since arkts {'1.1':'11','1.2':'20'} 41 * @arkts 1.1&1.2 42 */ 43declare namespace router { 44 /** 45 * Router Mode 46 * 47 * @enum { number } 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @since 9 50 */ 51 /** 52 * Router Mode 53 * 54 * @enum { number } 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @crossplatform 57 * @since 10 58 */ 59 /** 60 * Router Mode 61 * 62 * @enum { number } 63 * @syscap SystemCapability.ArkUI.ArkUI.Full 64 * @crossplatform 65 * @atomicservice 66 * @since arkts {'1.1':'11','1.2':'20'} 67 * @arkts 1.1&1.2 68 */ 69 export enum RouterMode { 70 /** 71 * Default route mode. 72 * The page will be added to the top of the page stack. 73 * 74 * @syscap SystemCapability.ArkUI.ArkUI.Full 75 * @since 9 76 */ 77 /** 78 * Default route mode. 79 * The page will be added to the top of the page stack. 80 * 81 * @syscap SystemCapability.ArkUI.ArkUI.Full 82 * @crossplatform 83 * @since 10 84 */ 85 /** 86 * Default route mode. 87 * The page will be added to the top of the page stack. 88 * 89 * @syscap SystemCapability.ArkUI.ArkUI.Full 90 * @crossplatform 91 * @atomicservice 92 * @since arkts {'1.1':'11','1.2':'20'} 93 * @arkts 1.1&1.2 94 */ 95 Standard, 96 97 /** 98 * Single route mode. 99 * If the target page already has the same url page in the page stack, 100 * the same url page closest to the top of the stack will be moved to the top of the stack. 101 * If the target page url does not exist in the page stack, route will use default route mode. 102 * 103 * @syscap SystemCapability.ArkUI.ArkUI.Full 104 * @since 9 105 */ 106 /** 107 * Single route mode. 108 * If the target page already has the same url page in the page stack, 109 * the same url page closest to the top of the stack will be moved to the top of the stack. 110 * If the target page url does not exist in the page stack, route will use default route mode. 111 * 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @crossplatform 114 * @since 10 115 */ 116 /** 117 * Single route mode. 118 * If the target page already has the same url page in the page stack, 119 * the same url page closest to the top of the stack will be moved to the top of the stack. 120 * If the target page url does not exist in the page stack, route will use default route mode. 121 * 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @crossplatform 124 * @atomicservice 125 * @since arkts {'1.1':'11','1.2':'20'} 126 * @arkts 1.1&1.2 127 */ 128 Single, 129 } 130 131 /** 132 * @typedef RouterOptions 133 * @syscap SystemCapability.ArkUI.ArkUI.Lite 134 * @since 8 135 */ 136 /** 137 * @typedef RouterOptions 138 * @syscap SystemCapability.ArkUI.ArkUI.Lite 139 * @atomicservice 140 * @since 11 141 */ 142 /** 143 * @typedef RouterOptions 144 * @syscap SystemCapability.ArkUI.ArkUI.Lite 145 * @crossplatform 146 * @atomicservice 147 * @since arkts {'1.1':'19','1.2':'20'} 148 * @arkts 1.1&1.2 149 */ 150 interface RouterOptions { 151 /** 152 * URI of the destination page, which supports the following formats: 153 * 1. Absolute path of the page, which is provided by the pages list in the config.json file. 154 * Example: 155 * pages/index/index 156 * pages/detail/detail 157 * 2. Particular path. If the URI is a slash (/), the home page is displayed. 158 * 159 * @type { string } 160 * @syscap SystemCapability.ArkUI.ArkUI.Lite 161 * @since 8 162 */ 163 /** 164 * URI of the destination page, which supports the following formats: 165 * 1. Absolute path of the page, which is provided by the pages list in the config.json file. 166 * Example: 167 * pages/index/index 168 * pages/detail/detail 169 * 2. Particular path. If the URI is a slash (/), the home page is displayed. 170 * 171 * @type { string } 172 * @syscap SystemCapability.ArkUI.ArkUI.Lite 173 * @atomicservice 174 * @since 11 175 */ 176 /** 177 * URI of the destination page, which supports the following formats: 178 * 1. Absolute path of the page, which is provided by the pages list in the config.json file. 179 * Example: 180 * pages/index/index 181 * pages/detail/detail 182 * 2. Particular path. If the URI is a slash (/), the home page is displayed. 183 * 184 * @type { string } 185 * @syscap SystemCapability.ArkUI.ArkUI.Lite 186 * @crossplatform 187 * @atomicservice 188 * @since arkts {'1.1':'19','1.2':'20'} 189 * @arkts 1.1&1.2 190 */ 191 url: string; 192 193 /** 194 * Data that needs to be passed to the destination page during navigation. 195 * After the destination page is displayed, the parameter can be directly used for the page. 196 * For example, this.data1 (data1 is the key value of the params used for page navigation.) 197 * 198 * @type { ?Object } 199 * @syscap SystemCapability.ArkUI.ArkUI.Lite 200 * @since 8 201 */ 202 /** 203 * Data that needs to be passed to the destination page during navigation. 204 * After the destination page is displayed, the parameter can be directly used for the page. 205 * For example, this.data1 (data1 is the key value of the params used for page navigation.) 206 * 207 * @type { ?Object } 208 * @syscap SystemCapability.ArkUI.ArkUI.Lite 209 * @atomicservice 210 * @since 11 211 */ 212 /** 213 * Data that needs to be passed to the destination page during navigation. 214 * After the destination page is displayed, the parameter can be directly used for the page. 215 * For example, this.data1 (data1 is the key value of the params used for page navigation.) 216 * 217 * @type { ?Object } 218 * @syscap SystemCapability.ArkUI.ArkUI.Lite 219 * @crossplatform 220 * @atomicservice 221 * @since arkts {'1.1':'19','1.2':'20'} 222 * @arkts 1.1&1.2 223 */ 224 params?: Object; 225 226 /** 227 * Set router page stack can be recovered after application is destroyed. When router page stack is recovered, 228 * top page will be recovered, other page recovered when it backs. the default value is 'true'. 229 * 230 * @type { ?boolean } 231 * @syscap SystemCapability.ArkUI.ArkUI.Lite 232 * @since arkts {'1.1':'14','1.2':'20'} 233 * @arkts 1.1&1.2 234 */ 235 recoverable?: boolean; 236 } 237 238 /** 239 * @typedef RouterState 240 * @syscap SystemCapability.ArkUI.ArkUI.Full 241 * @since 8 242 */ 243 /** 244 * @typedef RouterState 245 * @syscap SystemCapability.ArkUI.ArkUI.Full 246 * @crossplatform 247 * @since 10 248 */ 249 /** 250 * @typedef RouterState 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @crossplatform 253 * @atomicservice 254 * @since arkts {'1.1':'11','1.2':'20'} 255 * @arkts 1.1&1.2 256 */ 257 interface RouterState { 258 /** 259 * Index of the current page in the stack. 260 * NOTE: The index starts from 1 from the bottom to the top of the stack. 261 * 262 * @type { number } 263 * @syscap SystemCapability.ArkUI.ArkUI.Full 264 * @since 8 265 */ 266 /** 267 * Index of the current page in the stack. 268 * NOTE: The index starts from 1 from the bottom to the top of the stack. 269 * 270 * @type { number } 271 * @syscap SystemCapability.ArkUI.ArkUI.Full 272 * @crossplatform 273 * @since 10 274 */ 275 /** 276 * Index of the current page in the stack. 277 * NOTE: The index starts from 1 from the bottom to the top of the stack. 278 * 279 * @type { number } 280 * @syscap SystemCapability.ArkUI.ArkUI.Full 281 * @crossplatform 282 * @atomicservice 283 * @since arkts {'1.1':'11','1.2':'20'} 284 * @arkts 1.1&1.2 285 */ 286 index: number; 287 288 /** 289 * Name of the current page, that is, the file name. 290 * 291 * @type { string } 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @since 8 294 */ 295 /** 296 * Name of the current page, that is, the file name. 297 * 298 * @type { string } 299 * @syscap SystemCapability.ArkUI.ArkUI.Full 300 * @crossplatform 301 * @since 10 302 */ 303 /** 304 * Name of the current page, that is, the file name. 305 * 306 * @type { string } 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @crossplatform 309 * @atomicservice 310 * @since arkts {'1.1':'11','1.2':'20'} 311 * @arkts 1.1&1.2 312 */ 313 name: string; 314 315 /** 316 * Path of the current page. 317 * 318 * @type { string } 319 * @syscap SystemCapability.ArkUI.ArkUI.Full 320 * @since 8 321 */ 322 /** 323 * Path of the current page. 324 * 325 * @type { string } 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @since 10 329 */ 330 /** 331 * Path of the current page. 332 * 333 * @type { string } 334 * @syscap SystemCapability.ArkUI.ArkUI.Full 335 * @crossplatform 336 * @atomicservice 337 * @since arkts {'1.1':'11','1.2':'20'} 338 * @arkts 1.1&1.2 339 */ 340 path: string; 341 342 /** 343 * Data that passed to the destination page during navigation. 344 * 345 * @type { Object } 346 * @syscap SystemCapability.ArkUI.ArkUI.Full 347 * @crossplatform 348 * @atomicservice 349 * @since arkts {'1.1':'12','1.2':'20'} 350 * @arkts 1.1&1.2 351 */ 352 params: Object; 353 } 354 355 /** 356 * @typedef EnableAlertOptions 357 * @syscap SystemCapability.ArkUI.ArkUI.Full 358 * @since 8 359 */ 360 /** 361 * @typedef EnableAlertOptions 362 * @syscap SystemCapability.ArkUI.ArkUI.Full 363 * @crossplatform 364 * @since 10 365 */ 366 /** 367 * @typedef EnableAlertOptions 368 * @syscap SystemCapability.ArkUI.ArkUI.Full 369 * @crossplatform 370 * @atomicservice 371 * @since arkts {'1.1':'11','1.2':'20'} 372 * @arkts 1.1&1.2 373 */ 374 interface EnableAlertOptions { 375 /** 376 * dialog context. 377 * 378 * @type { string } 379 * @syscap SystemCapability.ArkUI.ArkUI.Full 380 * @since 8 381 */ 382 /** 383 * dialog context. 384 * 385 * @type { string } 386 * @syscap SystemCapability.ArkUI.ArkUI.Full 387 * @crossplatform 388 * @since 10 389 */ 390 /** 391 * dialog context. 392 * 393 * @type { string } 394 * @syscap SystemCapability.ArkUI.ArkUI.Full 395 * @crossplatform 396 * @atomicservice 397 * @since arkts {'1.1':'11','1.2':'20'} 398 * @arkts 1.1&1.2 399 */ 400 message: string; 401 } 402 403 /** 404 * Navigates to a specified page in the application based on the page URL and parameters. 405 * 406 * @param { RouterOptions } options - Options. 407 * @syscap SystemCapability.ArkUI.ArkUI.Full 408 * @since 8 409 * @deprecated since 9 410 * @useinstead ohos.router.router#pushUrl 411 */ 412 function push(options: RouterOptions): void; 413 414 /** 415 * Navigates to a specified page in the application based on the page URL and parameters. 416 * 417 * @param { RouterOptions } options - Options. 418 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 419 * @throws { BusinessError } 401 - Parameter error. Possible causes: 420 * <br> 1. Mandatory parameters are left unspecified. 421 * <br> 2. Incorrect parameters types. 422 * <br> 3. Parameter verification failed. 423 * @throws { BusinessError } 100001 - Internal error. 424 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 425 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @since 9 428 */ 429 /** 430 * Navigates to a specified page in the application based on the page URL and parameters. 431 * 432 * @param { RouterOptions } options - Options. 433 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 434 * @throws { BusinessError } 401 - Parameter error. Possible causes: 435 * <br> 1. Mandatory parameters are left unspecified. 436 * <br> 2. Incorrect parameters types. 437 * <br> 3. Parameter verification failed. 438 * @throws { BusinessError } 100001 - Internal error. 439 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 440 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 441 * @syscap SystemCapability.ArkUI.ArkUI.Full 442 * @crossplatform 443 * @since 10 444 */ 445 /** 446 * Navigates to a specified page in the application based on the page URL and parameters. 447 * 448 * @param { RouterOptions } options - Options. 449 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 450 * @throws { BusinessError } 401 - Parameter error. Possible causes: 451 * <br> 1. Mandatory parameters are left unspecified. 452 * <br> 2. Incorrect parameters types. 453 * <br> 3. Parameter verification failed. 454 * @throws { BusinessError } 100001 - Internal error. 455 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 456 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 457 * @syscap SystemCapability.ArkUI.ArkUI.Full 458 * @crossplatform 459 * @atomicservice 460 * @since 11 461 * @deprecated since 18 462 * @useinstead ohos.arkui.UIContext.Router#pushUrl 463 */ 464 function pushUrl(options: RouterOptions, callback: AsyncCallback<void>): void; 465 466 /** 467 * Navigates to a specified page in the application based on the page URL and parameters. 468 * 469 * @param { RouterOptions } options - Options. 470 * @returns { Promise<void> } the promise returned by the function. 471 * @throws { BusinessError } 401 - Parameter error. Possible causes: 472 * <br> 1. Mandatory parameters are left unspecified. 473 * <br> 2. Incorrect parameters types. 474 * <br> 3. Parameter verification failed. 475 * @throws { BusinessError } 100001 - Internal error. 476 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 477 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 478 * @syscap SystemCapability.ArkUI.ArkUI.Full 479 * @since 9 480 */ 481 /** 482 * Navigates to a specified page in the application based on the page URL and parameters. 483 * 484 * @param { RouterOptions } options - Options. 485 * @returns { Promise<void> } the promise returned by the function. 486 * @throws { BusinessError } 401 - Parameter error. Possible causes: 487 * <br> 1. Mandatory parameters are left unspecified. 488 * <br> 2. Incorrect parameters types. 489 * <br> 3. Parameter verification failed. 490 * @throws { BusinessError } 100001 - Internal error. 491 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 492 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 493 * @syscap SystemCapability.ArkUI.ArkUI.Full 494 * @crossplatform 495 * @since 10 496 */ 497 /** 498 * Navigates to a specified page in the application based on the page URL and parameters. 499 * 500 * @param { RouterOptions } options - Options. 501 * @returns { Promise<void> } the promise returned by the function. 502 * @throws { BusinessError } 401 - Parameter error. Possible causes: 503 * <br> 1. Mandatory parameters are left unspecified. 504 * <br> 2. Incorrect parameters types. 505 * <br> 3. Parameter verification failed. 506 * @throws { BusinessError } 100001 - Internal error. 507 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 508 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 509 * @syscap SystemCapability.ArkUI.ArkUI.Full 510 * @crossplatform 511 * @atomicservice 512 * @since 11 513 * @deprecated since 18 514 * @useinstead ohos.arkui.UIContext.Router#pushUrl 515 */ 516 function pushUrl(options: RouterOptions): Promise<void>; 517 518 /** 519 * Navigates to a specified page in the application based on the page URL and parameters. 520 * 521 * @param { RouterOptions } options - Options. 522 * @param { RouterMode } mode - RouterMode. 523 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 524 * @throws { BusinessError } 401 - Parameter error. Possible causes: 525 * <br> 1. Mandatory parameters are left unspecified. 526 * <br> 2. Incorrect parameters types. 527 * <br> 3. Parameter verification failed. 528 * @throws { BusinessError } 100001 - Internal error. 529 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 530 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 531 * @syscap SystemCapability.ArkUI.ArkUI.Full 532 * @since 9 533 */ 534 /** 535 * Navigates to a specified page in the application based on the page URL and parameters. 536 * 537 * @param { RouterOptions } options - Options. 538 * @param { RouterMode } mode - RouterMode. 539 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 540 * @throws { BusinessError } 401 - Parameter error. Possible causes: 541 * <br> 1. Mandatory parameters are left unspecified. 542 * <br> 2. Incorrect parameters types. 543 * <br> 3. Parameter verification failed. 544 * @throws { BusinessError } 100001 - Internal error. 545 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 546 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 547 * @syscap SystemCapability.ArkUI.ArkUI.Full 548 * @crossplatform 549 * @since 10 550 */ 551 /** 552 * Navigates to a specified page in the application based on the page URL and parameters. 553 * 554 * @param { RouterOptions } options - Options. 555 * @param { RouterMode } mode - RouterMode. 556 * @param { AsyncCallback<void> } callback - the callback of pushUrl. 557 * @throws { BusinessError } 401 - Parameter error. Possible causes: 558 * <br> 1. Mandatory parameters are left unspecified. 559 * <br> 2. Incorrect parameters types. 560 * <br> 3. Parameter verification failed. 561 * @throws { BusinessError } 100001 - Internal error. 562 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 563 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 564 * @syscap SystemCapability.ArkUI.ArkUI.Full 565 * @crossplatform 566 * @atomicservice 567 * @since 11 568 * @deprecated since 18 569 * @useinstead ohos.arkui.UIContext.Router#pushUrl 570 */ 571 function pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 572 573 /** 574 * Navigates to a specified page in the application based on the page URL and parameters. 575 * 576 * @param { RouterOptions } options - Options. 577 * @param { RouterMode } mode - RouterMode. 578 * @returns { Promise<void> } the promise returned by the function. 579 * @throws { BusinessError } 401 - Parameter error. Possible causes: 580 * <br> 1. Mandatory parameters are left unspecified. 581 * <br> 2. Incorrect parameters types. 582 * <br> 3. Parameter verification failed. 583 * @throws { BusinessError } 100001 - Internal error. 584 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 585 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 586 * @syscap SystemCapability.ArkUI.ArkUI.Full 587 * @since 9 588 */ 589 /** 590 * Navigates to a specified page in the application based on the page URL and parameters. 591 * 592 * @param { RouterOptions } options - Options. 593 * @param { RouterMode } mode - RouterMode. 594 * @returns { Promise<void> } the promise returned by the function. 595 * @throws { BusinessError } 401 - Parameter error. Possible causes: 596 * <br> 1. Mandatory parameters are left unspecified. 597 * <br> 2. Incorrect parameters types. 598 * <br> 3. Parameter verification failed. 599 * @throws { BusinessError } 100001 - Internal error. 600 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 601 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 602 * @syscap SystemCapability.ArkUI.ArkUI.Full 603 * @crossplatform 604 * @since 10 605 */ 606 /** 607 * Navigates to a specified page in the application based on the page URL and parameters. 608 * 609 * @param { RouterOptions } options - Options. 610 * @param { RouterMode } mode - RouterMode. 611 * @returns { Promise<void> } the promise returned by the function. 612 * @throws { BusinessError } 401 - Parameter error. Possible causes: 613 * <br> 1. Mandatory parameters are left unspecified. 614 * <br> 2. Incorrect parameters types. 615 * <br> 3. Parameter verification failed. 616 * @throws { BusinessError } 100001 - Internal error. 617 * @throws { BusinessError } 100002 - Uri error. The URI of the page to redirect is incorrect or does not exist 618 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 619 * @syscap SystemCapability.ArkUI.ArkUI.Full 620 * @crossplatform 621 * @atomicservice 622 * @since 11 623 * @deprecated since 18 624 * @useinstead ohos.arkui.UIContext.Router#pushUrl 625 */ 626 function pushUrl(options: RouterOptions, mode: RouterMode): Promise<void>; 627 628 /** 629 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 630 * 631 * @param { RouterOptions } options - Options. 632 * @syscap SystemCapability.ArkUI.ArkUI.Lite 633 * @since 8 634 * @deprecated since 9 635 * @useinstead ohos.router.router#replaceUrl 636 */ 637 function replace(options: RouterOptions): void; 638 639 /** 640 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 641 * 642 * @param { RouterOptions } options - Options. 643 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 644 * @throws { BusinessError } 401 - Parameter error. Possible causes: 645 * <br> 1. Mandatory parameters are left unspecified. 646 * <br> 2. Incorrect parameters types. 647 * <br> 3. Parameter verification failed. 648 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 649 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 650 * @syscap SystemCapability.ArkUI.ArkUI.Lite 651 * @since 9 652 */ 653 /** 654 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 655 * 656 * @param { RouterOptions } options - Options. 657 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 658 * @throws { BusinessError } 401 - Parameter error. Possible causes: 659 * <br> 1. Mandatory parameters are left unspecified. 660 * <br> 2. Incorrect parameters types. 661 * <br> 3. Parameter verification failed. 662 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 663 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 664 * @syscap SystemCapability.ArkUI.ArkUI.Lite 665 * @atomicservice 666 * @since 11 667 * @deprecated since 18 668 * @useinstead ohos.arkui.UIContext.Router#replaceUrl 669 */ 670 function replaceUrl(options: RouterOptions, callback: AsyncCallback<void>): void; 671 672 /** 673 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 674 * 675 * @param { RouterOptions } options - Options. 676 * @returns { Promise<void> } the promise returned by the function. 677 * @throws { BusinessError } 401 - Parameter error. Possible causes: 678 * <br> 1. Mandatory parameters are left unspecified. 679 * <br> 2. Incorrect parameters types. 680 * <br> 3. Parameter verification failed. 681 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 682 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 683 * @syscap SystemCapability.ArkUI.ArkUI.Lite 684 * @since 9 685 */ 686 /** 687 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 688 * 689 * @param { RouterOptions } options - Options. 690 * @returns { Promise<void> } the promise returned by the function. 691 * @throws { BusinessError } 401 - Parameter error. Possible causes: 692 * <br> 1. Mandatory parameters are left unspecified. 693 * <br> 2. Incorrect parameters types. 694 * <br> 3. Parameter verification failed. 695 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 696 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 697 * @syscap SystemCapability.ArkUI.ArkUI.Lite 698 * @atomicservice 699 * @since 11 700 * @deprecated since 18 701 * @useinstead ohos.arkui.UIContext.Router#replaceUrl 702 */ 703 function replaceUrl(options: RouterOptions): Promise<void>; 704 705 /** 706 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 707 * 708 * @param { RouterOptions } options - Options. 709 * @param { RouterMode } mode - RouterMode. 710 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 711 * @throws { BusinessError } 401 - Parameter error. Possible causes: 712 * <br> 1. Mandatory parameters are left unspecified. 713 * <br> 2. Incorrect parameters types. 714 * <br> 3. Parameter verification failed. 715 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 716 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 717 * @syscap SystemCapability.ArkUI.ArkUI.Lite 718 * @since 9 719 */ 720 /** 721 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 722 * 723 * @param { RouterOptions } options - Options. 724 * @param { RouterMode } mode - RouterMode. 725 * @param { AsyncCallback<void> } callback - the callback of replaceUrl. 726 * @throws { BusinessError } 401 - Parameter error. Possible causes: 727 * <br> 1. Mandatory parameters are left unspecified. 728 * <br> 2. Incorrect parameters types. 729 * <br> 3. Parameter verification failed. 730 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 731 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 732 * @syscap SystemCapability.ArkUI.ArkUI.Lite 733 * @atomicservice 734 * @since 11 735 * @deprecated since 18 736 * @useinstead ohos.arkui.UIContext.Router#replaceUrl 737 */ 738 function replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 739 740 /** 741 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 742 * 743 * @param { RouterOptions } options - Options. 744 * @param { RouterMode } mode - RouterMode. 745 * @returns { Promise<void> } the promise returned by the function. 746 * @throws { BusinessError } 401 - Parameter error. Possible causes: 747 * <br> 1. Mandatory parameters are left unspecified. 748 * <br> 2. Incorrect parameters types. 749 * <br> 3. Parameter verification failed. 750 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 751 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 752 * @syscap SystemCapability.ArkUI.ArkUI.Lite 753 * @since 9 754 */ 755 /** 756 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 757 * 758 * @param { RouterOptions } options - Options. 759 * @param { RouterMode } mode - RouterMode. 760 * @returns { Promise<void> } the promise returned by the function. 761 * @throws { BusinessError } 401 - Parameter error. Possible causes: 762 * <br> 1. Mandatory parameters are left unspecified. 763 * <br> 2. Incorrect parameters types. 764 * <br> 3. Parameter verification failed. 765 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 766 * @throws { BusinessError } 200002 - Uri error. The URI of the page to be used for replacement is incorrect or does not exist. 767 * @syscap SystemCapability.ArkUI.ArkUI.Lite 768 * @atomicservice 769 * @since 11 770 * @deprecated since 18 771 * @useinstead ohos.arkui.UIContext.Router#replaceUrl 772 */ 773 function replaceUrl(options: RouterOptions, mode: RouterMode): Promise<void>; 774 775 /** 776 * Returns to the previous page or a specified page. 777 * 778 * @param { RouterOptions } options - Options. 779 * @syscap SystemCapability.ArkUI.ArkUI.Full 780 * @since 8 781 */ 782 /** 783 * Returns to the previous page or a specified page. 784 * 785 * @param { RouterOptions } options - Options. 786 * @syscap SystemCapability.ArkUI.ArkUI.Full 787 * @crossplatform 788 * @since 10 789 */ 790 /** 791 * Returns to the previous page or a specified page. 792 * 793 * @param { RouterOptions } options - Options. 794 * @syscap SystemCapability.ArkUI.ArkUI.Full 795 * @crossplatform 796 * @atomicservice 797 * @since 11 798 * @deprecated since 18 799 * @useinstead ohos.arkui.UIContext.Router#back 800 */ 801 function back(options?: RouterOptions): void; 802 803 /** 804 * Returns to the specified page. 805 * 806 * @param { number } index - index of page. 807 * @param { Object } [params] - params of page. 808 * @syscap SystemCapability.ArkUI.ArkUI.Full 809 * @crossplatform 810 * @atomicservice 811 * @since 12 812 * @deprecated since 18 813 * @useinstead ohos.arkui.UIContext.Router#back 814 */ 815 function back(index: number, params?: Object): void; 816 817 /** 818 * Clears all historical pages and retains only the current page at the top of the stack. 819 * 820 * @syscap SystemCapability.ArkUI.ArkUI.Full 821 * @since 8 822 */ 823 /** 824 * Clears all historical pages and retains only the current page at the top of the stack. 825 * 826 * @syscap SystemCapability.ArkUI.ArkUI.Full 827 * @crossplatform 828 * @since 10 829 */ 830 /** 831 * Clears all historical pages and retains only the current page at the top of the stack. 832 * 833 * @syscap SystemCapability.ArkUI.ArkUI.Full 834 * @crossplatform 835 * @atomicservice 836 * @since 11 837 * @deprecated since 18 838 * @useinstead ohos.arkui.UIContext.Router#clear 839 */ 840 function clear(): void; 841 842 /** 843 * Obtains the number of pages in the current stack. 844 * 845 * @returns { string } Number of pages in the stack. The maximum value is 32. 846 * @syscap SystemCapability.ArkUI.ArkUI.Full 847 * @since 8 848 */ 849 /** 850 * Obtains the number of pages in the current stack. 851 * 852 * @returns { string } Number of pages in the stack. The maximum value is 32. 853 * @syscap SystemCapability.ArkUI.ArkUI.Full 854 * @crossplatform 855 * @since 10 856 */ 857 /** 858 * Obtains the number of pages in the current stack. 859 * 860 * @returns { string } Number of pages in the stack. The maximum value is 32. 861 * @syscap SystemCapability.ArkUI.ArkUI.Full 862 * @crossplatform 863 * @atomicservice 864 * @since 11 865 * @deprecated since 18 866 * @useinstead ohos.arkui.UIContext.Router#getLength 867 */ 868 function getLength(): string; 869 870 /** 871 * Obtains information about the current page state. 872 * 873 * @returns { RouterState } Page state. 874 * @syscap SystemCapability.ArkUI.ArkUI.Full 875 * @since 8 876 */ 877 /** 878 * Obtains information about the current page state. 879 * 880 * @returns { RouterState } Page state. 881 * @syscap SystemCapability.ArkUI.ArkUI.Full 882 * @crossplatform 883 * @since 10 884 */ 885 /** 886 * Obtains information about the current page state. 887 * 888 * @returns { RouterState } Page state. 889 * @syscap SystemCapability.ArkUI.ArkUI.Full 890 * @crossplatform 891 * @atomicservice 892 * @since 11 893 * @deprecated since 18 894 * @useinstead ohos.arkui.UIContext.Router#getState 895 */ 896 function getState(): RouterState; 897 898 /** 899 * Obtains page information by index. 900 * 901 * @param { number } index - Index of page. 902 * @returns { RouterState | undefined } Page state. 903 * @syscap SystemCapability.ArkUI.ArkUI.Full 904 * @crossplatform 905 * @atomicservice 906 * @since 12 907 * @deprecated since 18 908 * @useinstead ohos.arkui.UIContext.Router#getStateByIndex 909 */ 910 function getStateByIndex(index: number): RouterState | undefined; 911 912 /** 913 * Obtains page information by url. 914 * 915 * @param { string } url - URL of page. 916 * @returns { Array<RouterState> } Page state. 917 * @syscap SystemCapability.ArkUI.ArkUI.Full 918 * @crossplatform 919 * @atomicservice 920 * @since 12 921 * @deprecated since 18 922 * @useinstead ohos.arkui.UIContext.Router#getStateByUrl 923 */ 924 function getStateByUrl(url: string): Array<RouterState>; 925 926 /** 927 * Pop up dialog to ask whether to back 928 * 929 * @param { EnableAlertOptions } options - Options. 930 * @syscap SystemCapability.ArkUI.ArkUI.Full 931 * @since 8 932 * @deprecated since 9 933 * @useinstead ohos.router.router#showAlertBeforeBackPage 934 */ 935 function enableAlertBeforeBackPage(options: EnableAlertOptions): void; 936 937 /** 938 * Pop up alert dialog to ask whether to back 939 * 940 * @param { EnableAlertOptions } options - Options. 941 * @throws { BusinessError } 401 - Parameter error. Possible causes: 942 * <br> 1. Mandatory parameters are left unspecified. 943 * <br> 2. Incorrect parameters types. 944 * <br> 3. Parameter verification failed. 945 * @throws { BusinessError } 100001 - Internal error. 946 * @syscap SystemCapability.ArkUI.ArkUI.Full 947 * @since 9 948 */ 949 /** 950 * Pop up alert dialog to ask whether to back 951 * 952 * @param { EnableAlertOptions } options - Options. 953 * @throws { BusinessError } 401 - Parameter error. Possible causes: 954 * <br> 1. Mandatory parameters are left unspecified. 955 * <br> 2. Incorrect parameters types. 956 * <br> 3. Parameter verification failed. 957 * @throws { BusinessError } 100001 - Internal error. 958 * @syscap SystemCapability.ArkUI.ArkUI.Full 959 * @crossplatform 960 * @since 10 961 */ 962 /** 963 * Pop up alert dialog to ask whether to back 964 * 965 * @param { EnableAlertOptions } options - Options. 966 * @throws { BusinessError } 401 - Parameter error. Possible causes: 967 * <br> 1. Mandatory parameters are left unspecified. 968 * <br> 2. Incorrect parameters types. 969 * <br> 3. Parameter verification failed. 970 * @throws { BusinessError } 100001 - Internal error. 971 * @syscap SystemCapability.ArkUI.ArkUI.Full 972 * @crossplatform 973 * @atomicservice 974 * @since 11 975 * @deprecated since 18 976 * @useinstead ohos.arkui.UIContext.Router#showAlertBeforeBackPage 977 */ 978 function showAlertBeforeBackPage(options: EnableAlertOptions): void; 979 980 /** 981 * Cancel enableAlertBeforeBackPage 982 * 983 * @syscap SystemCapability.ArkUI.ArkUI.Full 984 * @since 8 985 * @deprecated since 9 986 * @useinstead ohos.router.router#hideAlertBeforeBackPage 987 */ 988 function disableAlertBeforeBackPage(): void; 989 990 /** 991 * Hide alert before back page 992 * 993 * @syscap SystemCapability.ArkUI.ArkUI.Full 994 * @since 9 995 */ 996 /** 997 * Hide alert before back page 998 * 999 * @syscap SystemCapability.ArkUI.ArkUI.Full 1000 * @crossplatform 1001 * @since 10 1002 */ 1003 /** 1004 * Hide alert before back page 1005 * 1006 * @syscap SystemCapability.ArkUI.ArkUI.Full 1007 * @crossplatform 1008 * @atomicservice 1009 * @since 11 1010 * @deprecated since 18 1011 * @useinstead ohos.arkui.UIContext.Router#hideAlertBeforeBackPage 1012 */ 1013 function hideAlertBeforeBackPage(): void; 1014 1015 /** 1016 * Obtains information about the current page params. 1017 * 1018 * @returns { Object } Page params. 1019 * @syscap SystemCapability.ArkUI.ArkUI.Full 1020 * @since 8 1021 */ 1022 /** 1023 * Obtains information about the current page params. 1024 * 1025 * @returns { Object } Page params. 1026 * @syscap SystemCapability.ArkUI.ArkUI.Full 1027 * @crossplatform 1028 * @since 10 1029 */ 1030 /** 1031 * Obtains information about the current page params. 1032 * 1033 * @returns { Object } Page params. 1034 * @syscap SystemCapability.ArkUI.ArkUI.Full 1035 * @crossplatform 1036 * @atomicservice 1037 * @since 11 1038 * @deprecated since 18 1039 * @useinstead ohos.arkui.UIContext.Router#getParams 1040 */ 1041 function getParams(): Object; 1042 1043 /** 1044 * @typedef NamedRouterOptions 1045 * @syscap SystemCapability.ArkUI.ArkUI.Full 1046 * @crossplatform 1047 * @since 10 1048 */ 1049 /** 1050 * @typedef NamedRouterOptions 1051 * @syscap SystemCapability.ArkUI.ArkUI.Full 1052 * @crossplatform 1053 * @atomicservice 1054 * @since arkts {'1.1':'11','1.2':'20'} 1055 * @arkts 1.1&1.2 1056 */ 1057 interface NamedRouterOptions { 1058 /** 1059 * Name of the destination named route. 1060 * 1061 * @type { string } 1062 * @syscap SystemCapability.ArkUI.ArkUI.Full 1063 * @crossplatform 1064 * @since 10 1065 */ 1066 /** 1067 * Name of the destination named route. 1068 * 1069 * @type { string } 1070 * @syscap SystemCapability.ArkUI.ArkUI.Full 1071 * @crossplatform 1072 * @atomicservice 1073 * @since arkts {'1.1':'11','1.2':'20'} 1074 * @arkts 1.1&1.2 1075 */ 1076 name: string; 1077 1078 /** 1079 * Data that needs to be passed to the destination page during navigation. 1080 * 1081 * @type { ?Object } 1082 * @syscap SystemCapability.ArkUI.ArkUI.Full 1083 * @crossplatform 1084 * @since 10 1085 */ 1086 /** 1087 * Data that needs to be passed to the destination page during navigation. 1088 * 1089 * @type { ?Object } 1090 * @syscap SystemCapability.ArkUI.ArkUI.Full 1091 * @crossplatform 1092 * @atomicservice 1093 * @since arkts {'1.1':'11','1.2':'20'} 1094 * @arkts 1.1&1.2 1095 */ 1096 params?: Object; 1097 1098 /** 1099 * Set router page stack can be recovered after application is destroyed. When router page stack is recovered, 1100 * top page will be recovered, other page recovered when it backs. the default value is 'true'. 1101 * 1102 * @type { ?boolean } 1103 * @syscap SystemCapability.ArkUI.ArkUI.Lite 1104 * @since arkts {'1.1':'14','1.2':'20'} 1105 * @arkts 1.1&1.2 1106 */ 1107 recoverable?: boolean; 1108 } 1109 1110 /** 1111 * Navigates to a specified page in the application based on the page URL and parameters. 1112 * 1113 * @param { NamedRouterOptions } options - Options. 1114 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1115 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1116 * <br> 1. Mandatory parameters are left unspecified. 1117 * <br> 2. Incorrect parameters types. 1118 * <br> 3. Parameter verification failed. 1119 * @throws { BusinessError } 100001 - Internal error. 1120 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1121 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1122 * @syscap SystemCapability.ArkUI.ArkUI.Full 1123 * @crossplatform 1124 * @since 10 1125 */ 1126 /** 1127 * Navigates to a specified page in the application based on the page URL and parameters. 1128 * 1129 * @param { NamedRouterOptions } options - Options. 1130 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1131 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1132 * <br> 1. Mandatory parameters are left unspecified. 1133 * <br> 2. Incorrect parameters types. 1134 * <br> 3. Parameter verification failed. 1135 * @throws { BusinessError } 100001 - Internal error. 1136 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1137 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1138 * @syscap SystemCapability.ArkUI.ArkUI.Full 1139 * @crossplatform 1140 * @atomicservice 1141 * @since 11 1142 * @deprecated since 18 1143 * @useinstead ohos.arkui.UIContext.Router#pushNamedRoute 1144 */ 1145 function pushNamedRoute(options: NamedRouterOptions, callback: AsyncCallback<void>): void; 1146 1147 /** 1148 * Navigates to a specified page in the application based on the page URL and parameters. 1149 * 1150 * @param { NamedRouterOptions } options - Options. 1151 * @returns { Promise<void> } the promise returned by the function. 1152 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1153 * <br> 1. Mandatory parameters are left unspecified. 1154 * <br> 2. Incorrect parameters types. 1155 * <br> 3. Parameter verification failed. 1156 * @throws { BusinessError } 100001 - Internal error. 1157 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1158 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1159 * @syscap SystemCapability.ArkUI.ArkUI.Full 1160 * @crossplatform 1161 * @since 10 1162 */ 1163 /** 1164 * Navigates to a specified page in the application based on the page URL and parameters. 1165 * 1166 * @param { NamedRouterOptions } options - Options. 1167 * @returns { Promise<void> } the promise returned by the function. 1168 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1169 * <br> 1. Mandatory parameters are left unspecified. 1170 * <br> 2. Incorrect parameters types. 1171 * <br> 3. Parameter verification failed. 1172 * @throws { BusinessError } 100001 - Internal error. 1173 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1174 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1175 * @syscap SystemCapability.ArkUI.ArkUI.Full 1176 * @crossplatform 1177 * @atomicservice 1178 * @since 11 1179 * @deprecated since 18 1180 * @useinstead ohos.arkui.UIContext.Router#pushNamedRoute 1181 */ 1182 function pushNamedRoute(options: NamedRouterOptions): Promise<void>; 1183 1184 /** 1185 * Navigates to a specified page in the application based on the page URL and parameters. 1186 * 1187 * @param { NamedRouterOptions } options - Options. 1188 * @param { RouterMode } mode - RouterMode. 1189 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1190 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1191 * <br> 1. Mandatory parameters are left unspecified. 1192 * <br> 2. Incorrect parameters types. 1193 * <br> 3. Parameter verification failed. 1194 * @throws { BusinessError } 100001 - Internal error. 1195 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1196 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1197 * @syscap SystemCapability.ArkUI.ArkUI.Full 1198 * @crossplatform 1199 * @since 10 1200 */ 1201 /** 1202 * Navigates to a specified page in the application based on the page URL and parameters. 1203 * 1204 * @param { NamedRouterOptions } options - Options. 1205 * @param { RouterMode } mode - RouterMode. 1206 * @param { AsyncCallback<void> } callback - the callback of pushNamedRoute. 1207 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1208 * <br> 1. Mandatory parameters are left unspecified. 1209 * <br> 2. Incorrect parameters types. 1210 * <br> 3. Parameter verification failed. 1211 * @throws { BusinessError } 100001 - Internal error. 1212 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1213 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1214 * @syscap SystemCapability.ArkUI.ArkUI.Full 1215 * @crossplatform 1216 * @atomicservice 1217 * @since 11 1218 * @deprecated since 18 1219 * @useinstead ohos.arkui.UIContext.Router#pushNamedRoute 1220 */ 1221 function pushNamedRoute(options: NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 1222 1223 /** 1224 * Navigates to a specified page in the application based on the page URL and parameters. 1225 * 1226 * @param { NamedRouterOptions } options - Options. 1227 * @param { RouterMode } mode - RouterMode. 1228 * @returns { Promise<void> } the promise returned by the function. 1229 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1230 * <br> 1. Mandatory parameters are left unspecified. 1231 * <br> 2. Incorrect parameters types. 1232 * <br> 3. Parameter verification failed. 1233 * @throws { BusinessError } 100001 - Internal error. 1234 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1235 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1236 * @syscap SystemCapability.ArkUI.ArkUI.Full 1237 * @crossplatform 1238 * @since 10 1239 */ 1240 /** 1241 * Navigates to a specified page in the application based on the page URL and parameters. 1242 * 1243 * @param { NamedRouterOptions } options - Options. 1244 * @param { RouterMode } mode - RouterMode. 1245 * @returns { Promise<void> } the promise returned by the function. 1246 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1247 * <br> 1. Mandatory parameters are left unspecified. 1248 * <br> 2. Incorrect parameters types. 1249 * <br> 3. Parameter verification failed. 1250 * @throws { BusinessError } 100001 - Internal error. 1251 * @throws { BusinessError } 100003 - Page stack error. Too many pages are pushed. 1252 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1253 * @syscap SystemCapability.ArkUI.ArkUI.Full 1254 * @crossplatform 1255 * @atomicservice 1256 * @since 11 1257 * @deprecated since 18 1258 * @useinstead ohos.arkui.UIContext.Router#pushNamedRoute 1259 */ 1260 function pushNamedRoute(options: NamedRouterOptions, mode: RouterMode): Promise<void>; 1261 1262 /** 1263 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1264 * 1265 * @param { NamedRouterOptions } options - Options. 1266 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1267 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1268 * <br> 1. Mandatory parameters are left unspecified. 1269 * <br> 2. Incorrect parameters types. 1270 * <br> 3. Parameter verification failed. 1271 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1272 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1273 * @syscap SystemCapability.ArkUI.ArkUI.Full 1274 * @crossplatform 1275 * @since 10 1276 */ 1277 /** 1278 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1279 * 1280 * @param { NamedRouterOptions } options - Options. 1281 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1282 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1283 * <br> 1. Mandatory parameters are left unspecified. 1284 * <br> 2. Incorrect parameters types. 1285 * <br> 3. Parameter verification failed. 1286 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1287 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1288 * @syscap SystemCapability.ArkUI.ArkUI.Full 1289 * @crossplatform 1290 * @atomicservice 1291 * @since 11 1292 * @deprecated since 18 1293 * @useinstead ohos.arkui.UIContext.Router#replaceNamedRoute 1294 */ 1295 function replaceNamedRoute(options: NamedRouterOptions, callback: AsyncCallback<void>): void; 1296 1297 /** 1298 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1299 * 1300 * @param { NamedRouterOptions } options - Options. 1301 * @returns { Promise<void> } the promise returned by the function. 1302 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1303 * <br> 1. Mandatory parameters are left unspecified. 1304 * <br> 2. Incorrect parameters types. 1305 * <br> 3. Parameter verification failed. 1306 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1307 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1308 * @syscap SystemCapability.ArkUI.ArkUI.Full 1309 * @crossplatform 1310 * @since 10 1311 */ 1312 /** 1313 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1314 * 1315 * @param { NamedRouterOptions } options - Options. 1316 * @returns { Promise<void> } the promise returned by the function. 1317 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1318 * <br> 1. Mandatory parameters are left unspecified. 1319 * <br> 2. Incorrect parameters types. 1320 * <br> 3. Parameter verification failed. 1321 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1322 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1323 * @syscap SystemCapability.ArkUI.ArkUI.Full 1324 * @crossplatform 1325 * @atomicservice 1326 * @since 11 1327 * @deprecated since 18 1328 * @useinstead ohos.arkui.UIContext.Router#replaceNamedRoute 1329 */ 1330 function replaceNamedRoute(options: NamedRouterOptions): Promise<void>; 1331 1332 /** 1333 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1334 * 1335 * @param { NamedRouterOptions } options - Options. 1336 * @param { RouterMode } mode - RouterMode. 1337 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1338 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1339 * <br> 1. Mandatory parameters are left unspecified. 1340 * <br> 2. Incorrect parameters types. 1341 * <br> 3. Parameter verification failed. 1342 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1343 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1344 * @syscap SystemCapability.ArkUI.ArkUI.Full 1345 * @crossplatform 1346 * @since 10 1347 */ 1348 /** 1349 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1350 * 1351 * @param { NamedRouterOptions } options - Options. 1352 * @param { RouterMode } mode - RouterMode. 1353 * @param { AsyncCallback<void> } callback - the callback of replaceNamedRoute. 1354 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1355 * <br> 1. Mandatory parameters are left unspecified. 1356 * <br> 2. Incorrect parameters types. 1357 * <br> 3. Parameter verification failed. 1358 * @throws { BusinessError } 100001 - The UI execution context is not found. This error code is thrown only in the standard system. 1359 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1360 * @syscap SystemCapability.ArkUI.ArkUI.Full 1361 * @crossplatform 1362 * @atomicservice 1363 * @since 11 1364 * @deprecated since 18 1365 * @useinstead ohos.arkui.UIContext.Router#replaceNamedRoute 1366 */ 1367 function replaceNamedRoute(options: NamedRouterOptions, mode: RouterMode, callback: AsyncCallback<void>): void; 1368 1369 /** 1370 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1371 * 1372 * @param { NamedRouterOptions } options - Options. 1373 * @param { RouterMode } mode - RouterMode. 1374 * @returns { Promise<void> } the promise returned by the function. 1375 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1376 * <br> 1. Mandatory parameters are left unspecified. 1377 * <br> 2. Incorrect parameters types. 1378 * <br> 3. Parameter verification failed. 1379 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 1380 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1381 * @syscap SystemCapability.ArkUI.ArkUI.Full 1382 * @crossplatform 1383 * @since 10 1384 */ 1385 /** 1386 * Replaces the current page with another one in the application. The current page is destroyed after replacement. 1387 * 1388 * @param { NamedRouterOptions } options - Options. 1389 * @param { RouterMode } mode - RouterMode. 1390 * @returns { Promise<void> } the promise returned by the function. 1391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1392 * <br> 1. Mandatory parameters are left unspecified. 1393 * <br> 2. Incorrect parameters types. 1394 * <br> 3. Parameter verification failed. 1395 * @throws { BusinessError } 100001 - Failed to get the delegate. This error code is thrown only in the standard system. 1396 * @throws { BusinessError } 100004 - Named route error. The named route does not exist. 1397 * @syscap SystemCapability.ArkUI.ArkUI.Full 1398 * @crossplatform 1399 * @atomicservice 1400 * @since 11 1401 * @deprecated since 18 1402 * @useinstead ohos.arkui.UIContext.Router#replaceNamedRoute 1403 */ 1404 function replaceNamedRoute(options: NamedRouterOptions, mode: RouterMode): Promise<void>; 1405} 1406 1407export default router; 1408