lw-cdp-ui 1.0.54 → 1.0.55

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.
@@ -7,7 +7,7 @@
7
7
  @contextmenu.prevent="openContextMenu($event, tag)">
8
8
  <router-link :to="tag">
9
9
  <span>{{ tag.meta.title }}</span>
10
- <el-icon v-if="!tag.meta.affix && tagList.length > 1"
10
+ <el-icon v-if="!tag.meta.affix"
11
11
  @click.prevent.stop='closeSelectedTag(tag)'><el-icon-close /></el-icon>
12
12
  </router-link>
13
13
  </li>
@@ -103,24 +103,18 @@ export default {
103
103
  methods: {
104
104
  // 初始化
105
105
  init() {
106
- var dashboardRoute = this.treeFind(this.menu, node => node.path == this.$config.DASHBOARD_URL)
107
- if (dashboardRoute) {
108
- dashboardRoute.fullPath = dashboardRoute.path
106
+ let tags = this.$tool.data.get('RouteTags') || []
107
+ if (tags.length > 0) {
109
108
 
110
- let tags = this.$tool.data.get('RouteTags') || []
111
- tags.forEach(tag => {
109
+ tags.forEach((tag, index) => {
112
110
  var isRoute = this.treeFind(this.menu, node => node.path == tag.path)
113
111
  if (isRoute) {
114
112
  this.addViewTags(tag)
115
113
  }
116
-
117
114
  })
118
- if (tags.length === 0) {
119
- this.addViewTags(dashboardRoute)
120
- this.addViewTags(this.$route)
121
- }
122
-
123
115
  }
116
+ this.addViewTags(this.$route)
117
+
124
118
  },
125
119
  //查找树
126
120
  treeFind(tree, func) {
@@ -157,12 +151,19 @@ export default {
157
151
  },
158
152
  //关闭tag
159
153
  closeSelectedTag(tag, autoPushLatestView = true) {
154
+ let item = this.menu[0]
155
+ if (item.children) {
156
+ item = item.children[0]
157
+ }
158
+ if (this.tagList.length == 1 && item.path == this.$route.fullPath) {
159
+ return false
160
+ }
160
161
  this.$store.commit("removeViewTags", tag)
161
162
  this.$store.commit("removeIframeList", tag)
162
163
  this.$store.commit("removeKeepLive", tag.name)
164
+ this.$tool.data.set('RouteTags', this.$store.state.viewTags.viewTags)
163
165
  if (autoPushLatestView && this.isActive(tag)) {
164
166
  const latestView = this.tagList.slice(-1)[0]
165
- this.$tool.data.set('RouteTags', this.$store.state.viewTags.viewTags)
166
167
  if (latestView) {
167
168
  this.$router.push(latestView)
168
169
  } else {
@@ -407,15 +407,11 @@ const Topbar = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$
407
407
  methods: {
408
408
  // 初始化
409
409
  init() {
410
- var o = this.treeFind(this.menu, (a) => a.path == this.$config.DASHBOARD_URL);
411
- if (o) {
412
- o.fullPath = o.path;
413
- let a = this.$tool.data.get("RouteTags") || [];
414
- a.forEach((s) => {
415
- var g = this.treeFind(this.menu, (d) => d.path == s.path);
416
- g && this.addViewTags(s);
417
- }), a.length === 0 && (this.addViewTags(o), this.addViewTags(this.$route));
418
- }
410
+ let o = this.$tool.data.get("RouteTags") || [];
411
+ o.length > 0 && o.forEach((a, s) => {
412
+ var g = this.treeFind(this.menu, (d) => d.path == a.path);
413
+ g && this.addViewTags(a);
414
+ }), this.addViewTags(this.$route);
419
415
  },
420
416
  //查找树
421
417
  treeFind(o, a) {
@@ -446,9 +442,12 @@ const Topbar = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$
446
442
  },
447
443
  //关闭tag
448
444
  closeSelectedTag(o, a = !0) {
449
- if (this.$store.commit("removeViewTags", o), this.$store.commit("removeIframeList", o), this.$store.commit("removeKeepLive", o.name), a && this.isActive(o)) {
450
- const s = this.tagList.slice(-1)[0];
451
- this.$tool.data.set("RouteTags", this.$store.state.viewTags.viewTags), s ? this.$router.push(s) : this.$router.push("/");
445
+ let s = this.menu[0];
446
+ if (s.children && (s = s.children[0]), this.tagList.length == 1 && s.path == this.$route.fullPath)
447
+ return !1;
448
+ if (this.$store.commit("removeViewTags", o), this.$store.commit("removeIframeList", o), this.$store.commit("removeKeepLive", o.name), this.$tool.data.set("RouteTags", this.$store.state.viewTags.viewTags), a && this.isActive(o)) {
449
+ const g = this.tagList.slice(-1)[0];
450
+ g ? this.$router.push(g) : this.$router.push("/");
452
451
  }
453
452
  },
454
453
  //tag右键
@@ -532,7 +531,7 @@ function _sfc_render$j(o, a, s, g, d, h) {
532
531
  createVNode(N, { to: M }, {
533
532
  default: withCtx(() => [
534
533
  createElementVNode("span", null, toDisplayString(M.meta.title), 1),
535
- !M.meta.affix && h.tagList.length > 1 ? (openBlock(), createBlock(f, {
534
+ M.meta.affix ? createCommentVNode("", !0) : (openBlock(), createBlock(f, {
536
535
  key: 0,
537
536
  onClick: withModifiers(($) => h.closeSelectedTag(M), ["prevent", "stop"])
538
537
  }, {
@@ -540,7 +539,7 @@ function _sfc_render$j(o, a, s, g, d, h) {
540
539
  createVNode(S)
541
540
  ]),
542
541
  _: 2
543
- }, 1032, ["onClick"])) : createCommentVNode("", !0)
542
+ }, 1032, ["onClick"]))
544
543
  ]),
545
544
  _: 2
546
545
  }, 1032, ["to"])