vitarx-router 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,6 +61,7 @@ export declare type BeforeEnterCallback = (this: Router, to: ReadonlyRouteLocati
61
61
  *
62
62
  * @param {RouterOptions} options - 配置
63
63
  * @return {RouterMemory} - `RouterMemory`内存路由器实例
64
+ * @see https://vitarx.cn/router/basis/threshold.html#%E5%88%9B%E5%BB%BA%E8%B7%AF%E7%94%B1%E5%99%A8%E5%AE%9E%E4%BE%8B 创建路由器实例
64
65
  */
65
66
  export declare function createRouter(options: MakeRequired<RouterOptions<'memory'>, 'mode'>): MemoryRouter;
66
67
 
@@ -96,6 +97,7 @@ export declare function createRouter(options: MakeRequired<RouterOptions<'memory
96
97
  *
97
98
  * @param {RouterOptions} options - 路由配置
98
99
  * @return {RouterHistory} - `RouterHistory`路由器实例
100
+ * @see https://vitarx.cn/router/basis/threshold.html#%E5%88%9B%E5%BB%BA%E8%B7%AF%E7%94%B1%E5%99%A8%E5%AE%9E%E4%BE%8B 创建路由器实例
99
101
  */
100
102
  export declare function createRouter(options: MakeRequired<RouterOptions<'path'>, 'mode'>): HistoryRouter;
101
103
 
@@ -106,8 +108,31 @@ export declare function createRouter(options: MakeRequired<RouterOptions<'path'>
106
108
  *
107
109
  * @param {RouterOptions} options - 路由配置
108
110
  * @return {RouterHistory} - `RouterHistory`路由器实例
111
+ * @see https://vitarx.cn/router/basis/threshold.html#%E5%88%9B%E5%BB%BA%E8%B7%AF%E7%94%B1%E5%99%A8%E5%AE%9E%E4%BE%8B 创建路由器实例
109
112
  */
110
- export declare function createRouter(options: RouterOptions<'hash'>): HistoryRouter;
113
+ export declare function createRouter(options: MakeRequired<RouterOptions<'hash'>, 'mode'>): HistoryRouter;
114
+
115
+ /**
116
+ * 创建history路由器,默认hash模式
117
+ *
118
+ * 基于History API实现路由功能,支持浏览器前进后退、刷新等操作。
119
+ *
120
+ * @param {RouterOptions} options - 路由配置
121
+ * @return {RouterHistory} - `RouterHistory`路由器实例
122
+ * @see https://vitarx.cn/router/basis/threshold.html#%E5%88%9B%E5%BB%BA%E8%B7%AF%E7%94%B1%E5%99%A8%E5%AE%9E%E4%BE%8B 创建路由器实例
123
+ */
124
+ export declare function createRouter(options: Omit<RouterOptions, 'mode'>): HistoryRouter;
125
+
126
+ /**
127
+ * 创建history路由器,默认hash模式
128
+ *
129
+ * 基于History API实现路由功能,支持浏览器前进后退、刷新等操作。
130
+ *
131
+ * @param {RouterOptions} options - 路由配置
132
+ * @return {RouterHistory|RouterMemory} - 返回对应的路由器实例
133
+ * @see https://vitarx.cn/router/basis/threshold.html#%E5%88%9B%E5%BB%BA%E8%B7%AF%E7%94%B1%E5%99%A8%E5%AE%9E%E4%BE%8B 创建路由器实例
134
+ */
135
+ export declare function createRouter(options: RouterOptions): HistoryRouter | MemoryRouter;
111
136
 
112
137
  /**
113
138
  * 定义路由
@@ -115,6 +140,7 @@ export declare function createRouter(options: RouterOptions<'hash'>): HistoryRou
115
140
  * 使用defineRoute定义路由可以获得更好的代码提示。
116
141
  *
117
142
  * @param {Route} route - 路由配置
143
+ * @return {Route} - 路由配置
118
144
  */
119
145
  export declare function defineRoute(route: Route): Route;
120
146
 
@@ -124,6 +150,8 @@ export declare function defineRoute(route: Route): Route;
124
150
  * 使用defineRoutes定义路由表可以获得更好的代码提示。
125
151
  *
126
152
  * @param {Route[]} routes - 路由配置表
153
+ * @return {Route[]} - 路由配置表
154
+ * @see https://vitarx.cn/router/basis/route.html 定义路由
127
155
  */
128
156
  export declare function defineRoutes(...routes: Route[]): Route[];
129
157
 
@@ -909,6 +937,8 @@ export declare abstract class Router extends RouterRegistry implements AppObject
909
937
  *
910
938
  * 它只是简单的实现了一个a标签,点击后跳转到目标路由,
911
939
  * 如果有更高级的定制需求,往往你可以项目中自行编写一个小部件来实现任何你想要的效果。
940
+ *
941
+ * @see https://vitarx.cn/router/basis/navigation.html 文档
912
942
  */
913
943
  export declare class RouterLink extends Widget<RouterLinkProps> {
914
944
  /**
@@ -1266,6 +1296,8 @@ declare abstract class RouterRegistry {
1266
1296
  * 用于渲染路由线路配置的`widget`,可以在子组件中嵌套`RouterView`,但应用内只能存在一个根视图。
1267
1297
  *
1268
1298
  * 如需实现页面缓存等功能,可以重写该类的{@link build}方法。
1299
+ *
1300
+ * @see https://vitarx.cn/router/advanced/router-view.html 文档
1269
1301
  */
1270
1302
  export declare class RouterView extends Widget<RouteOptions> {
1271
1303
  private readonly _$index;
@@ -1439,6 +1471,7 @@ export declare interface _ScrollToOptions {
1439
1471
  * ```
1440
1472
  *
1441
1473
  * @return {ReadonlyRouteLocation} - 只读的`RouteLocation`对象
1474
+ * @see https://vitarx.cn/router/basis/threshold.html#%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E8%B7%AF%E7%94%B1 获取当前路由位置对象
1442
1475
  */
1443
1476
  export declare function useRoute(): ReadonlyRouteLocation;
1444
1477
 
@@ -1448,7 +1481,8 @@ export declare function useRoute(): ReadonlyRouteLocation;
1448
1481
  * 与使用`Router.instance`静态属性获取是一致的效果。
1449
1482
  *
1450
1483
  * @return {RouterCore} - 路由器实例
1451
- * @throws {Error} - 如果路由器实例未初始化,则抛出异常
1484
+ * @throws {Error} - 如果未创建路由器实例,则会抛出异常
1485
+ * @see https://vitarx.cn/router/basis/threshold.html#%E8%AE%BF%E9%97%AE%E8%B7%AF%E7%94%B1%E5%99%A8 访问路由器实例
1452
1486
  */
1453
1487
  export declare function useRouter<T extends Router>(): T;
1454
1488
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vitarx-router",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Vitarx前端框架的配套路由器",
5
5
  "author": "ZhuChongLin <8210856@qq.com>",
6
6
  "license": "MIT",