@tarojs/router

  • Version 3.6.34
  • Published
  • 265 kB
  • 6 dependencies
  • MIT license

Install

npm i @tarojs/router
yarn add @tarojs/router
pnpm add @tarojs/router

Overview

Taro-router

Index

Variables

variable history

let history: History;

    variable routesAlias

    const routesAlias: RoutesAlias;

      Functions

      function createMpaHistory

      createMpaHistory: (_?: HashHistoryOptions | BrowserHistoryOptions) => MpaHistory;

        function createMultiRouter

        createMultiRouter: (
        history: History,
        app: AppInstance,
        config: MpaRouterConfig$0,
        framework?: string
        ) => Promise<void>;
        • Note: 关于多页面应用 - 需要配置路由映射(根目录跳转、404 页面……) - app.onPageNotFound 事件不支持 - 应用生命周期可能多次触发 - TabBar 会多次加载 - 不支持路由动画

        function createRouter

        createRouter: (
        history: History,
        app: AppInstance,
        config: SpaRouterConfig$0,
        framework?: string
        ) => () => void;

          function getCurrentPages

          getCurrentPages: () => Taro.Page[];

            function handleAppMount

            handleAppMount: (
            config: SpaRouterConfig | MpaRouterConfig,
            _: History,
            appId?: string
            ) => void;

              function handleAppMountWithTabbar

              handleAppMountWithTabbar: (
              config: SpaRouterConfig | MpaRouterConfig,
              history: History,
              appId?: string
              ) => void;

                function isDingTalk

                isDingTalk: () => boolean;

                  function isWeixin

                  isWeixin: () => boolean;
                    navigateBack: (
                    option?: Taro.navigateBack.Option
                    ) => ReturnType<typeof Taro.navigateBack>;
                      navigateTo: (
                      option: Taro.navigateTo.Option
                      ) => ReturnType<typeof Taro.navigateTo>;

                        function prependBasename

                        prependBasename: (url?: string) => string;

                          function redirectTo

                          redirectTo: (
                          option: Taro.redirectTo.Option
                          ) => ReturnType<typeof Taro.redirectTo>;

                            function reLaunch

                            reLaunch: (option: Taro.reLaunch.Option) => ReturnType<typeof Taro.reLaunch>;

                              function setHistory

                              setHistory: (h: History, base?: string) => void;

                                function setHistoryMode

                                setHistoryMode: (mode?: IH5RouterConfig, base?: string) => void;

                                  function setMpaTitle

                                  setMpaTitle: (title: string) => void;

                                    function setNavigationBarLoading

                                    setNavigationBarLoading: (loading: boolean) => void;

                                      function setNavigationBarStyle

                                      setNavigationBarStyle: (option: {
                                      backgroundColor: string;
                                      frontColor: string;
                                      }) => void;

                                        function setTitle

                                        setTitle: (title: string) => void;

                                          function switchTab

                                          switchTab: (option: Taro.switchTab.Option) => ReturnType<typeof Taro.switchTab>;

                                            Namespaces

                                            namespace @tarojs/components/dist/components

                                            module '@tarojs/components/dist/components' {}
                                            • Note: @tarojs/router 不能依赖 @tarojs/components, 因为 @tarojs/components 依赖 @tarojs/router, 且仅通过 peerDependencies 引用依赖会在 pnpm publish 时抛出错误

                                            function defineCustomElementTaroTabbar

                                            defineCustomElementTaroTabbar: () => void;

                                              Package Files (2)

                                              Dependencies (6)

                                              Dev Dependencies (16)

                                              Peer Dependencies (3)

                                              Badge

                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@tarojs/router.

                                              • Markdown
                                                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@tarojs/router)
                                              • HTML
                                                <a href="https://www.jsdocs.io/package/@tarojs/router"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>