@ditari/bsui 1.0.70 → 1.0.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("pinia"),r=require("../types.cjs.js"),h=l.defineStore(r.NAV_TAB_ID,{state:()=>({list:[],activeKey:""}),getters:{getList:t=>t.list,getActiveKey:t=>t.activeKey},actions:{setActiveKey(t){this.activeKey=t},save(t){var i;if(!((i=t.meta)!=null&&i.title))return;if(this.list.some(e=>e.path===t.path)){this.list.forEach(e=>{e.path===t.path&&(e.query=t.query,e.params=t.params,e.meta=t.meta,e.name=t.name||"")});return}const a={path:t.path,fullPath:t.fullPath,query:t.query,params:t.params,meta:t.meta,name:t.name||""};this.list.push(a)},deleteTabs(t){this.list.splice(this.list.findIndex(s=>s.fullPath===t),1)},setNavTitle(t,s){for(let a=0;a<this.list.length;a++)if(this.list[a].fullPath===s){this.list[a].meta.title=t;break}}},persist:!0});exports.useNavTabsStore=h;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineStore as
|
|
2
|
-
import { NAV_TAB_ID as
|
|
3
|
-
const f =
|
|
1
|
+
import { defineStore as l } from "pinia";
|
|
2
|
+
import { NAV_TAB_ID as h } from "../types.esm.js";
|
|
3
|
+
const f = l(h, {
|
|
4
4
|
state: () => ({
|
|
5
5
|
// 多标签列表
|
|
6
6
|
list: [],
|
|
@@ -24,8 +24,15 @@ const f = a(l, {
|
|
|
24
24
|
* @param route
|
|
25
25
|
*/
|
|
26
26
|
save(t) {
|
|
27
|
-
|
|
27
|
+
var i;
|
|
28
|
+
if (!((i = t.meta) != null && i.title))
|
|
28
29
|
return;
|
|
30
|
+
if (this.list.some((a) => a.path === t.path)) {
|
|
31
|
+
this.list.forEach((a) => {
|
|
32
|
+
a.path === t.path && (a.query = t.query, a.params = t.params, a.meta = t.meta, a.name = t.name || "");
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
29
36
|
const e = {
|
|
30
37
|
path: t.path,
|
|
31
38
|
fullPath: t.fullPath,
|
|
@@ -42,7 +49,7 @@ const f = a(l, {
|
|
|
42
49
|
*/
|
|
43
50
|
deleteTabs(t) {
|
|
44
51
|
this.list.splice(
|
|
45
|
-
this.list.findIndex((
|
|
52
|
+
this.list.findIndex((s) => s.fullPath === t),
|
|
46
53
|
1
|
|
47
54
|
);
|
|
48
55
|
},
|
|
@@ -51,9 +58,9 @@ const f = a(l, {
|
|
|
51
58
|
* @param title 标题
|
|
52
59
|
* @param path url
|
|
53
60
|
*/
|
|
54
|
-
setNavTitle(t,
|
|
61
|
+
setNavTitle(t, s) {
|
|
55
62
|
for (let e = 0; e < this.list.length; e++)
|
|
56
|
-
if (this.list[e].fullPath ===
|
|
63
|
+
if (this.list[e].fullPath === s) {
|
|
57
64
|
this.list[e].meta.title = t;
|
|
58
65
|
break;
|
|
59
66
|
}
|
package/package.json
CHANGED
package/src/hooks/route/index.ts
CHANGED
|
@@ -50,14 +50,21 @@ export const useNavTabsStore = defineStore(NAV_TAB_ID, {
|
|
|
50
50
|
* @param route
|
|
51
51
|
*/
|
|
52
52
|
save(route: RouteLocationNormalized) {
|
|
53
|
-
if (!route.meta
|
|
53
|
+
if (!route.meta?.title) {
|
|
54
54
|
// 没有设置title,则不进入缓存
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
const flag = this.list.some(
|
|
58
|
-
(item: INavTab) => item.fullPath === route.fullPath
|
|
59
|
-
);
|
|
57
|
+
const flag = this.list.some((item: INavTab) => item.path === route.path);
|
|
60
58
|
if (flag) {
|
|
59
|
+
// 如果有相同的路由变化,更新对应的参数信息
|
|
60
|
+
this.list.forEach((item: INavTab) => {
|
|
61
|
+
if (item.path === route.path) {
|
|
62
|
+
item.query = route.query;
|
|
63
|
+
item.params = route.params;
|
|
64
|
+
item.meta = route.meta;
|
|
65
|
+
item.name = <string>route.name || "";
|
|
66
|
+
}
|
|
67
|
+
});
|
|
61
68
|
return;
|
|
62
69
|
}
|
|
63
70
|
const data: INavTab = {
|