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