@jnrs/vue-core 1.2.45 → 1.2.47

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/AGENTS.md CHANGED
@@ -303,14 +303,14 @@ const router = createVueRouter({
303
303
 
304
304
  ##### handleRouter
305
305
 
306
- 路由跳转或替换
306
+ 路由跳转、替换或新开标签页
307
307
 
308
308
  **参数:**
309
309
 
310
- | 参数名 | 类型 | 必填 | 说明 |
311
- | ------ | --------------------- | ---- | --------------------- |
312
- | to | `RouteLocationRaw` | ✓ | 路由跳转参数 |
313
- | type | `'push' \| 'replace'` | - | 跳转方式,默认 'push' |
310
+ | 参数名 | 类型 | 必填 | 说明 |
311
+ | ------ | --------------------------- | ---- | --------------------------------------- |
312
+ | to | `RouteLocationRaw` | ✓ | 路由跳转参数 |
313
+ | type | `'push' \| 'replace' \| '_blank'` | - | 跳转方式,默认 'push';'_blank' 新开标签页 |
314
314
 
315
315
  **返回值:** `Promise<boolean \| void>`
316
316
 
@@ -324,12 +324,15 @@ await handleRouter({ name: 'dashboard' })
324
324
 
325
325
  // replace 跳转
326
326
  await handleRouter({ path: '/user/profile' }, 'replace')
327
+
328
+ // 新开标签页打开(解析出完整 URL 后 window.open)
329
+ await handleRouter({ path: '/lingshuSmart/previewPage' }, '_blank')
327
330
  ```
328
331
 
329
332
  **特性:**
330
333
 
331
334
  - 自动捕获路由跳转错误
332
- - 失败时跳转到 404 页面
335
+ - push / replace 失败时跳转到 404 页面;`_blank` 模式不处理 404,仅输出警告日志
333
336
  - 输出警告日志
334
337
 
335
338
  ##### getRoutes
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # 发版日志
2
2
 
3
+ ## [1.2.47] - 2026-08-15 【latest】
4
+
5
+ ### Features
6
+
7
+ - `handleRouter` 支持 `_blank` 新开标签页:通过 `router.resolve` 解析完整 URL 后 `window.open(href, '_blank', 'noopener,noreferrer')` 打开,`_blank` 模式不跳转 404
8
+
9
+ ## [1.2.46] - 2026-08-15 【latest】
10
+
11
+ ### Chore
12
+
13
+ - 版本同步更新
14
+
15
+ ## [1.2.45] - 2026-08-13 【latest】
16
+
17
+ ### Chore
18
+
19
+ - 版本同步更新
20
+
3
21
  ## [1.2.44] - 2026-08-06 【latest】
4
22
 
5
23
  ### ⚠️ Breaking Changes
@@ -2,7 +2,7 @@
2
2
  import { defineComponent as q, ref as V, createBlock as F, openBlock as d, unref as l, withCtx as p, createElementVNode as j, createVNode as E, toDisplayString as C, isRef as ta, createElementBlock as k, Fragment as J, renderList as Z, createTextVNode as H, computed as X, normalizeClass as te, normalizeStyle as ke, createCommentVNode as T, renderSlot as fe, withDirectives as Xe, vShow as aa, nextTick as se, withModifiers as He, watch as de, onMounted as jt, mergeProps as na } from "vue";
3
3
  import { storeToRefs as la } from "pinia";
4
4
  import { ElDrawer as ia, ElSwitch as oa, ElRadioGroup as Ue, ElRadio as ze, ElImage as ra, ElIcon as G, ElButton as R, ElDialog as Tt, ElUpload as sa, vLoading as Oe, ElMessage as Y, ElForm as Ut, ElFormItem as ua, ElMessageBox as lt, ElLoading as Fe, ElPagination as zt, ElTable as Ft, ElTableColumn as Ie, ElSelect as Lt, ElOption as Vt, ElCheckbox as ca, ElButtonGroup as da, ElDatePicker as Aa } from "element-plus";
5
- import { u as fa, a as ga, L as ma, M as va, C as ha } from "../index-qf5rNcN2.js";
5
+ import { u as fa, a as ga, L as ma, M as va, C as ha } from "../index-Ca5AgDYs.js";
6
6
  import { Back as ya, Right as pa, DArrowRight as ba, ZoomOut as Ia, ZoomIn as Ca, Switch as Ea, RefreshLeft as wa, Refresh as Sa, Download as Ne, View as ka, Delete as it, Upload as Qa, ArrowLeft as Da, ArrowRight as Ba } from "@element-plus/icons-vue";
7
7
  import { downloadByUrl as xt, downloadByBlob as ot, objectToFormData as Pa } from "@jnrs/shared";
8
8
  import { useI18n as he } from "vue-i18n";
@@ -1,35 +1,40 @@
1
1
  import { createWebHistory as p, createRouter as d } from "vue-router";
2
- const h = {
2
+ const f = {
3
3
  history: p(),
4
4
  routes: []
5
5
  };
6
- let a, s, i, m;
7
- const f = ({ options: o, fileModules: t, layoutName: e, globalComponent: n, handleBeforeEach: r }) => (s = t, e && (i = e), n && (m = n), a = d({ ...h, ...o }), a.beforeEach(
8
- async (c, l) => r?.(c, l)
9
- ), a), g = async (o, t = "push") => {
6
+ let n, s, i, m;
7
+ const h = ({ options: o, fileModules: t, layoutName: e, globalComponent: a, handleBeforeEach: r }) => (s = t, e && (i = e), a && (m = a), n = d({ ...f, ...o }), n.beforeEach(
8
+ async (c, u) => r?.(c, u)
9
+ ), n), g = async (o, t = "push") => {
10
10
  try {
11
- return await a[t](o);
11
+ if (t === "_blank") {
12
+ const { href: a } = n.resolve(o);
13
+ window.open(a, "_blank", "noopener,noreferrer");
14
+ return;
15
+ }
16
+ return await n[t](o);
12
17
  } catch (e) {
13
- a[t]({ name: "404" }), console.warn(`router.${t} 失败`, {
18
+ t !== "_blank" && n[t]({ name: "404" }), console.warn(`router.${t} 失败`, {
14
19
  code: "ROUTER_NOT_MATCH",
15
20
  message: "未匹配到有效路由",
16
21
  error: o || e,
17
22
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
18
23
  });
19
24
  }
20
- }, _ = (o) => s[`/src/views${o}.vue`], u = async (o, t) => {
25
+ }, _ = (o) => s[`/src/views${o}.vue`], l = async (o, t) => {
21
26
  for (const e of o) {
22
27
  if (e.meta.fullPathTitle = t ? t.meta.fullPathTitle + "," + e.meta.title : e.meta.title, !e.component) {
23
- e.redirect && a.addRoute({
28
+ e.redirect && n.addRoute({
24
29
  path: e.path,
25
30
  name: e.name,
26
31
  meta: e.meta,
27
32
  redirect: e.redirect
28
- }), e.children && e.children.length > 0 && await u(e.children, e);
33
+ }), e.children && e.children.length > 0 && await l(e.children, e);
29
34
  continue;
30
35
  }
31
- const n = e.component.replace(/[^a-zA-Z0-9/._-]/g, "");
32
- if (!n.startsWith("/") || n.includes("..")) {
36
+ const a = e.component.replace(/[^a-zA-Z0-9/._-]/g, "");
37
+ if (!a.startsWith("/") || a.includes("..")) {
33
38
  console.warn("[Router] 组件加载失败", {
34
39
  code: "INVALID_COMPONENT_PATH",
35
40
  message: "组件路径拼写不符合规则,应以 '/' 开头且不能包含 '..',请检查 component 字段是否配置正确",
@@ -42,7 +47,7 @@ const f = ({ options: o, fileModules: t, layoutName: e, globalComponent: n, hand
42
47
  });
43
48
  continue;
44
49
  }
45
- const r = _(n);
50
+ const r = _(a);
46
51
  if (!r) {
47
52
  console.warn("[Router] 组件加载失败", {
48
53
  code: "COMPONENT_NOT_FOUND",
@@ -77,21 +82,21 @@ const f = ({ options: o, fileModules: t, layoutName: e, globalComponent: n, hand
77
82
  component: () => r()
78
83
  }
79
84
  ]
80
- }), a.addRoute(c)) : a.addRoute(i, c);
85
+ }), n.addRoute(c)) : n.addRoute(i, c);
81
86
  }
82
87
  }, O = () => {
83
88
  const o = [];
84
- for (const t of a.getRoutes())
89
+ for (const t of n.getRoutes())
85
90
  o.push({
86
91
  name: t.name,
87
92
  path: t.path,
88
93
  meta: t.meta
89
94
  });
90
95
  return o;
91
- }, T = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
96
+ }, b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
92
97
  __proto__: null,
93
- asyncGenerateRoute: u,
94
- createVueRouter: f,
98
+ asyncGenerateRoute: l,
99
+ createVueRouter: h,
95
100
  getRoutes: O,
96
101
  handleRouter: g
97
102
  }, Symbol.toStringTag, { value: "Module" }));
@@ -100,9 +105,9 @@ console.log(
100
105
  'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
101
106
  );
102
107
  export {
103
- u as a,
104
- f as b,
105
- T as c,
108
+ l as a,
109
+ h as b,
110
+ b as c,
106
111
  O as g,
107
112
  g as h
108
113
  };
@@ -3,7 +3,7 @@ import { defineStore as m } from "pinia";
3
3
  import { ref as i, computed as b, watch as h } from "vue";
4
4
  import { Fullscreen as S } from "@jnrs/shared";
5
5
  import { usePreferredDark as f } from "@vueuse/core";
6
- import { a as k } from "./index-GnfhAnhF.js";
6
+ import { a as k } from "./index-B3d_yqVP.js";
7
7
  const O = m(
8
8
  "@jnrs/vue-core/pinia:mock",
9
9
  () => ({ useMockServe: i(!1) }),
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { c as r } from "./index-GnfhAnhF.js";
2
- import { i } from "./index-qf5rNcN2.js";
1
+ import { c as r } from "./index-B3d_yqVP.js";
2
+ import { i } from "./index-Ca5AgDYs.js";
3
3
  console.log(
4
4
  "%c✨ 欢迎使用 @jnrs/vue-core",
5
5
  'background: #42B883; color: #39495C; font-weight: bold; padding: 4px 8px; border-radius: 4px; font-family: "Helvetica Neue", sans-serif;'
@@ -1,5 +1,5 @@
1
1
  import "pinia-plugin-persistedstate";
2
- import { b as r, u as t, a as u } from "../index-qf5rNcN2.js";
2
+ import { b as r, u as t, a as u } from "../index-Ca5AgDYs.js";
3
3
  export {
4
4
  r as useMenuStore,
5
5
  t as useMockStore,
@@ -12,12 +12,12 @@ import { CreateVueRouter } from './types';
12
12
  */
13
13
  declare const createVueRouter: ({ options, fileModules, layoutName, globalComponent, handleBeforeEach }: CreateVueRouter) => Router;
14
14
  /**
15
- * 路由跳转或替换
15
+ * 路由跳转、替换或新开标签页
16
16
  * @param to 路由跳转参数
17
- * @param type 默认为push, push | replace
17
+ * @param type 默认为push, push | replace | blank
18
18
  * @returns Promise<boolean | void>
19
19
  */
20
- declare const handleRouter: (to: RouteLocationRaw, type?: "push" | "replace") => Promise<void | import('vue-router').NavigationFailure>;
20
+ declare const handleRouter: (to: RouteLocationRaw, type?: "push" | "replace" | "_blank") => Promise<void | import('vue-router').NavigationFailure>;
21
21
  /**
22
22
  * 设置动态路由,生成路由记录
23
23
  * @param menus 菜单项
@@ -1,5 +1,5 @@
1
1
  import { useRoute as o, useRouter as a } from "vue-router";
2
- import { a as u, b as s, g as R, h as n } from "../index-GnfhAnhF.js";
2
+ import { a as u, b as s, g as R, h as n } from "../index-B3d_yqVP.js";
3
3
  export {
4
4
  u as asyncGenerateRoute,
5
5
  s as createVueRouter,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jnrs/vue-core",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "巨能(JNRS)前端工程化开发,Vue 专用核心功能包。",
5
5
  "keywords": [
6
6
  "jnrs",
@@ -60,7 +60,7 @@
60
60
  "vue": "^3.5.22",
61
61
  "vue-i18n": "^11.2.8",
62
62
  "vue-router": "^4.5.1",
63
- "@jnrs/shared": "1.1.36"
63
+ "@jnrs/shared": "1.1.38"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@vitejs/plugin-vue": "^6.0.1",