@shwfed/nuxt 0.1.69 → 0.1.71

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.
package/dist/module.d.mts CHANGED
@@ -15,6 +15,9 @@ interface ModuleOptions {
15
15
  *
16
16
  * 这个表达式可以访问到 `token` 变量,其通过 `token` 配置的表达式计算得到。
17
17
  *
18
+ * 仅当 `token` 与 `headers` 都配置为字符串时才会执行该表达式;
19
+ * 若 `token` 表达式结果不是字符串或表达式执行失败,则不会注入任何请求头。
20
+ *
18
21
  * @type DSL
19
22
  */
20
23
  headers?: string;
@@ -30,6 +33,8 @@ interface ModuleOptions {
30
33
  * DSL 应当返回一个布尔值,表示是否需要重定向到登陆页。该表达式可以访问到**每一个 API 响应**的响应数据,
31
34
  * 可以通过 `response` 变量访问。
32
35
  *
36
+ * 仅当 `expired` 与 `logoutUri` 都配置为字符串时才会执行该表达式。
37
+ *
33
38
  * @type DSL
34
39
  */
35
40
  expired?: string;
@@ -54,21 +59,27 @@ interface ModuleOptions {
54
59
  /**
55
60
  * 侧边栏的菜单
56
61
  *
57
- * DSL 应当返回一个数组,每个元素是一个对象,对象的结构如下:
62
+ * DSL 应当返回一个数组,每个元素是一个分组或路由项:
58
63
  *
59
64
  * ```ts
60
- * type Item = {
61
- * id: string
65
+ * type RouteItem = {
66
+ * id: string | number
62
67
  * title: string
63
- * path: string
64
- * disabled?: string
65
- * hidden?: string
68
+ * route: string
66
69
  * icon?: string
67
70
  * keywords?: string[]
68
- * children?: Item[]
71
+ * }
72
+ *
73
+ * type GroupItem = {
74
+ * id: string | number
75
+ * title: string
76
+ * icon?: string
77
+ * children: RouteItem[]
69
78
  * }
70
79
  * ```
71
80
  *
81
+ * `RouteItem` 不支持 `hidden` / `disabled`,且 `children` 仅支持一层(`GroupItem -> RouteItem[]`)。
82
+ *
72
83
  * @type DSL
73
84
  */
74
85
  menus?: string;
@@ -108,6 +119,8 @@ interface ModuleOptions {
108
119
  * - 清理缓存:`{ type: 'request', url: '/cache/clear', method: 'POST', body: { scope: 'all' } }`
109
120
  * - 重建索引:`{ type: 'request', url: '/search/reindex', method: 'POST', query: { async: true }, headers: { 'X-Command-Source': 'palette' } }`
110
121
  *
122
+ * 当前模块实现会将 `commands: null` 规范化为 `undefined`,等价于不配置。
123
+ *
111
124
  * @type DSL
112
125
  */
113
126
  commands?: string | null;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
3
  "configKey": "shwfed",
4
- "version": "0.1.69",
4
+ "version": "0.1.71",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -96,6 +96,14 @@ const getTabLabel = (tab) => {
96
96
  }
97
97
  return normalizedTab;
98
98
  };
99
+ const activeTabLabel = computed(() => {
100
+ if (active.value === void 0)
101
+ return void 0;
102
+ return getTabLabel(active.value);
103
+ });
104
+ useHead(() => ({
105
+ title: activeTabLabel.value
106
+ }));
99
107
  const profileName = computed(() => {
100
108
  if (config.profile.name === void 0)
101
109
  return t("profile");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shwfed/nuxt",
3
- "version": "0.1.69",
3
+ "version": "0.1.71",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "type": "module",