xto-fronted 0.4.88 → 0.4.89

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.
@@ -2,6 +2,9 @@ import { RouteRecordRaw, Router } from 'vue-router';
2
2
  interface LayoutRouteOptions {
3
3
  indexPath?: string;
4
4
  }
5
+ interface CreateRouterOptions {
6
+ base?: string;
7
+ }
5
8
  /**
6
9
  * 创建布局路由
7
10
  * @param children 子路由配置
@@ -12,7 +15,8 @@ export declare function createLayoutRoute(children: RouteRecordRaw[], options?:
12
15
  /**
13
16
  * 创建路由实例
14
17
  * @param routes 路由配置数组
18
+ * @param options 配置选项
15
19
  * @returns 路由实例
16
20
  */
17
- export declare function createRouter(routes: RouteRecordRaw[]): Router;
21
+ export declare function createRouter(routes: RouteRecordRaw[], options?: CreateRouterOptions): Router;
18
22
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xto-fronted",
3
- "version": "0.4.88",
3
+ "version": "0.4.89",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "XTO 前端应用框架",
@@ -10,6 +10,10 @@ interface LayoutRouteOptions {
10
10
  indexPath?: string
11
11
  }
12
12
 
13
+ interface CreateRouterOptions {
14
+ base?: string
15
+ }
16
+
13
17
  /**
14
18
  * 创建布局路由
15
19
  * @param children 子路由配置
@@ -44,11 +48,12 @@ export function createLayoutRoute(
44
48
  /**
45
49
  * 创建路由实例
46
50
  * @param routes 路由配置数组
51
+ * @param options 配置选项
47
52
  * @returns 路由实例
48
53
  */
49
- export function createRouter(routes: RouteRecordRaw[]): Router {
54
+ export function createRouter(routes: RouteRecordRaw[], options: CreateRouterOptions = {}): Router {
50
55
  return vueCreateRouter({
51
- history: createWebHistory(),
56
+ history: createWebHistory(options.base),
52
57
  routes,
53
58
  scrollBehavior: () => ({ left: 0, top: 0 })
54
59
  })