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