paas-component-library 1.0.95 → 1.0.97

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paas-component-library",
3
3
  "private": false,
4
- "version": "1.0.95",
4
+ "version": "1.0.97",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist",
@@ -155,23 +155,30 @@ export default {
155
155
  let matchedItem = null;
156
156
  let currentFromStore = this.current;
157
157
 
158
+ // 优先从 URL 路径匹配
158
159
  if (path && path !== '/') {
159
160
  matchedItem = this.findItemByKey(this.data, path);
160
161
  if (!matchedItem) {
161
162
  matchedItem = this.findItemByPathPrefix(this.data, path);
162
163
  }
163
- }
164
-
165
- if (!matchedItem && currentFromStore) {
166
- matchedItem = this.findItemByKey(this.data, currentFromStore);
167
- }
168
-
169
- if (!matchedItem) {
170
- matchedItem = this.findFirstLeaf(this.data);
164
+ // 如果 URL 路径存在但找不到匹配,保持当前路径不跳转
165
+ if (!matchedItem) {
166
+ return;
167
+ }
168
+ } else {
169
+ // URL 路径为空时,使用 store 中的缓存路径
170
+ if (currentFromStore) {
171
+ matchedItem = this.findItemByKey(this.data, currentFromStore);
172
+ }
173
+ // 如果缓存也没有,使用第一个菜单
174
+ if (!matchedItem) {
175
+ matchedItem = this.findFirstLeaf(this.data);
176
+ }
171
177
  }
172
178
 
173
179
  if (matchedItem) {
174
180
  this.selectAndOpenMenu(matchedItem);
181
+ this.$router.push(matchedItem.key);
175
182
  }
176
183
  },
177
184
 
@@ -207,7 +214,7 @@ export default {
207
214
  findItemByPathPrefix(menuList, path) {
208
215
  if (!menuList || !path) return null;
209
216
  for (const item of menuList) {
210
- if (path.startsWith(item.key + '/') || path === item.key) {
217
+ if (path === item.key) {
211
218
  return item;
212
219
  }
213
220
  if (item.children) {
@@ -327,5 +334,4 @@ export default {
327
334
  .paas-menu-scroll-wrapper::-webkit-scrollbar {
328
335
  display: none;
329
336
  }
330
-
331
337
  </style>
@@ -4,20 +4,19 @@
4
4
  <a-sub-menu v-if="node.children && node.children.length" :key="String(node.value)"
5
5
  @click.stop="toggleOpen(node)">
6
6
  <template #title>
7
- <div class="menu-title clickable">
8
- <a-dropdown trigger="contextmenu">
9
- <template #overlay>
10
- <a-menu>
11
- <a-menu-item @click.stop="onAddChild(node)">添加子级</a-menu-item>
12
- <a-menu-item @click.stop="onEdit(node)">编辑</a-menu-item>
13
- <a-menu-item @click.stop="onDelete(node)">删除</a-menu-item>
14
- </a-menu>
15
- </template>
16
-
17
- <div class="menu-title-wrapper" @click.stop="toggleOpen(node)">
7
+ <div class="menu-title clickable" @click.stop="toggleOpen(node)">
8
+ <span class="menu-title-wrapper">
9
+ <a-dropdown trigger="contextmenu">
10
+ <template #overlay>
11
+ <a-menu>
12
+ <a-menu-item @click.stop="onAddChild(node)">添加子级</a-menu-item>
13
+ <a-menu-item @click.stop="onEdit(node)">编辑</a-menu-item>
14
+ <a-menu-item @click.stop="onDelete(node)">删除</a-menu-item>
15
+ </a-menu>
16
+ </template>
18
17
  <span class="menu-title-text">{{ node.label }}</span>
19
- </div>
20
- </a-dropdown>
18
+ </a-dropdown>
19
+ </span>
21
20
  </div>
22
21
  </template>
23
22
 
@@ -30,19 +29,18 @@
30
29
  <!-- 没有子节点的菜单项 -->
31
30
  <a-menu-item v-else :key="node.value">
32
31
  <div class="menu-item clickable" @click.stop="onSelectNode(node)">
33
- <a-dropdown trigger="contextmenu">
34
- <template #overlay>
35
- <a-menu>
36
- <a-menu-item @click.stop="onAddChild(node)">添加子级</a-menu-item>
37
- <a-menu-item @click.stop="onEdit(node)">编辑</a-menu-item>
38
- <a-menu-item @click.stop="onDelete(node)">删除</a-menu-item>
39
- </a-menu>
40
- </template>
41
-
42
- <div class="menu-title-wrapper">
32
+ <span class="menu-title-wrapper">
33
+ <a-dropdown trigger="contextmenu">
34
+ <template #overlay>
35
+ <a-menu>
36
+ <a-menu-item @click.stop="onAddChild(node)">添加子级</a-menu-item>
37
+ <a-menu-item @click.stop="onEdit(node)">编辑</a-menu-item>
38
+ <a-menu-item @click.stop="onDelete(node)">删除</a-menu-item>
39
+ </a-menu>
40
+ </template>
43
41
  <span class="ellipsis" :title="node.label">{{ node.label }}</span>
44
- </div>
45
- </a-dropdown>
42
+ </a-dropdown>
43
+ </span>
46
44
  </div>
47
45
  </a-menu-item>
48
46
  </div>
@@ -75,7 +73,6 @@ export default {
75
73
  .menu-item {
76
74
  display: flex;
77
75
  align-items: center;
78
- justify-content: space-between;
79
76
  width: 100%;
80
77
  padding: 4px 0;
81
78
  }
@@ -85,10 +82,15 @@ export default {
85
82
  transition: background-color 0.2s;
86
83
  }
87
84
 
88
- .ellipsis {
85
+ .menu-title-wrapper {
89
86
  flex: 1;
90
87
  overflow: hidden;
91
- padding: 6px 0;
88
+ }
89
+
90
+ .menu-title-text,
91
+ .ellipsis {
92
+ display: block;
93
+ overflow: hidden;
92
94
  white-space: nowrap;
93
95
  text-overflow: ellipsis;
94
96
  min-width: 0;
@@ -6,10 +6,11 @@
6
6
  @edit="openEditGroup" @delete="confirmDeleteGroup" @add-child="openAddChildOf" />
7
7
  </a-menu>
8
8
 
9
- <a-button type="dashed" block @click.stop="openAddGroup(node)" style="margin: 0 0 10px 10px;">
10
- <template #icon>
11
- </template>添加根级
12
- </a-button>
9
+ <div style="text-align: center;">
10
+ <a-button type="link" @click.stop="openAddGroup(node)" style="margin: 0 10px 10px 10px;">
11
+ 添加根级
12
+ </a-button>
13
+ </div>
13
14
 
14
15
  <a-modal v-model:open="groupModalVisible" :closable="true" :maskClosable="true" :draggable="true"
15
16
  :title="groupInfo.isChild ? '添加子级' : '添加根级'">