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