@lambo-design/pro-layout 1.0.0-beta.152 → 1.0.0-beta.153

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@lambo-design/pro-layout",
3
- "version": "1.0.0-beta.152",
3
+ "version": "1.0.0-beta.153",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {},
@@ -2,7 +2,7 @@
2
2
  <div class="pro-layout-logo-wrapper" @click="handleClick">
3
3
  <div class="logo" v-if="systemInfo.systemLogo !='hide'" :style="logoStyle"></div>
4
4
  <div class="divider" v-if="systemInfo.systemLogo !='hide'"></div>
5
- <div class="system-name">{{systemName}}</div>
5
+ <div class="system-name" :style="nameStyle">{{systemName}}</div>
6
6
  </div>
7
7
  </template>
8
8
 
@@ -23,14 +23,68 @@ export default {
23
23
  }
24
24
  },
25
25
  computed:{
26
- logoStyle(){
26
+ logoStyle() {
27
+ let style = '';
27
28
  if (this.systemInfo && this.systemInfo.systemLogo) {
28
- return 'background: url("' + this.systemInfo.systemLogo + '") no-repeat;background-size: 100%;'
29
+ style += `background: url("${this.systemInfo.systemLogo}") no-repeat; background-size: 100%;`;
30
+ // 如果 systemInfo.logoWidth 存在且不为空,则添加到样式
31
+ if (this.systemInfo.logoWidth && this.systemInfo.logoWidth !== '') {
32
+ style += `width: ${this.systemInfo.logoWidth}px;`;
33
+ }
34
+ // 如果 systemInfo.logoTop 存在且不为空,则添加到样式
35
+ if (this.systemInfo.logoTop && this.systemInfo.logoTop !== '') {
36
+ style += `margin-top: ${this.systemInfo.logoTop}px;`;
37
+ }
38
+ style += `text-align-last: justify;`
29
39
  }
30
- return '';
40
+ return style;
41
+ },
42
+
43
+ // nameStyle() {
44
+ // const fontSize = 20; // 固定的字体大小是 20px
45
+ // const lineHeight = 50; // 固定的行高是 50px
46
+ // const nameSize = this.systemInfo.nameSize || 1; // 默认行数为1,如果未指定则使用1
47
+ // console.log('nameSize',nameSize)
48
+ // // 计算总高度
49
+ // const height = lineHeight * nameSize; // 确保至少有一行高度,即使nameSize小于1
50
+ // return {
51
+ // 'font-size': `${fontSize}px`, // 应用固定的字体大小
52
+ // 'line-height': `${lineHeight}px`, // 应用固定的行高
53
+ // 'height': `${height}px`, // 应用计算出的总高度
54
+ // 'overflow': 'hidden', // 确保多余的文本被裁剪
55
+ // 'white-space': 'pre-wrap', // 允许换行
56
+ // 'word-break': 'break-all'
57
+ // };
58
+ // }
59
+
60
+ nameStyle() {
61
+ let style = '';
62
+ if (this.systemInfo && this.systemInfo.nameSize) {
63
+ const lines = this.systemInfo.nameSize; // 行数
64
+ const maxHeight = lineHeight * lines; // 计算最大高度
65
+
66
+ // 动态计算字体大小
67
+ const fontSize = Math.max(20 - (lines - 1) * 2, 12); // 字体大小递减
68
+ const lineHeight = fontSize + 5; // 固定行高
69
+ const width = (this.systemName.length/lines)*fontSize + 10;
70
+
71
+ // 组装样式字符串
72
+ style += `line-height: ${lineHeight}px;`;
73
+ style += `font-size: ${fontSize}px;`;
74
+ style += `max-height: ${maxHeight}px;`; // 设置最大高度限制行数
75
+ style += `width: ${width}px;`; // 设置宽度
76
+ style += `overflow: hidden;`; // 超出部分隐藏
77
+ style += `word-wrap: break-word;`; // 允许单词内换行
78
+ style += `white-space: normal;`; // 默认的换行方式
79
+ style += `text-align-last: justify;`
80
+ style += `text-align: justify;`
81
+ }
82
+ return style;
31
83
  }
84
+
32
85
  },
33
86
  methods: {
87
+
34
88
  handleClick(){
35
89
  this.$emit('clickLogo')
36
90
  },
@@ -85,6 +139,7 @@ export default {
85
139
  font-weight: bold;
86
140
  font-size: 20px;
87
141
  margin-right: 15px;
142
+
88
143
  }
89
144
  }
90
145
  </style>
@@ -10,7 +10,7 @@
10
10
  ...
11
11
  </template>
12
12
  <MenuItem :name="item.appId" v-for="item in otherList" :key="item.appId">
13
- {{item.name}}
13
+ {{item.name}}
14
14
  </MenuItem>
15
15
  </Submenu>
16
16
  </Menu>
@@ -124,13 +124,20 @@ export default {
124
124
  &:hover{
125
125
  background: rgba(255,255,255,0.2);
126
126
  .line{
127
- border-bottom: 2px solid var(--primary-color,@_primary-color);
127
+ border-bottom: 3.35px solid var(--primary-color-tint-5,@_primary-color-tint-5);
128
+ position: absolute;
129
+ left: 0;
130
+ right: 0;
128
131
  }
129
132
  }
130
133
  &.ivu-menu-item-active,&.ivu-menu-item-selected{
131
134
  background: rgba(255,255,255,0.2);
132
135
  .line{
133
- border-bottom: 2px solid var(--primary-color,@_primary-color);
136
+ border-bottom: 3.35px solid var(--primary-color-tint-5,@_primary-color-tint-5 );
137
+ position: absolute;
138
+ left: 0;
139
+ right: 0;
140
+ //bottom: 0;
134
141
  }
135
142
  }
136
143
  }
@@ -1,7 +1,8 @@
1
1
  <template>
2
2
  <Dropdown ref="dropdown" :class="hideTitle ? '' : 'collased-menu-dropdown'" :placement="placement"
3
3
  :transfer="true" @on-click="handleClick">
4
- <a :style="{textAlign: !hideTitle ? 'left' : '',padding: !hideTitle ? '0px' : ''}" class="drop-menu-a" type="text"
4
+ <a :style="{textAlign: !hideTitle ? 'left' : '',padding: !hideTitle ? '0px' : ''}"
5
+ :class="['drop-menu-a', activeItem.indexOf(parentItem.name) >= 0 ? 'selected-parent' : '']" type="text"
5
6
  @mouseover="handleMousemove($event, children)">
6
7
  <ProLayoutSiderIcon :icon-type="parentItem.meta.icon" :icon-size="hideTitle ? 26 : 14"></ProLayoutSiderIcon>
7
8
  <span v-if="!hideTitle" class="menu-title">{{ showTitle(parentItem) }}</span>
@@ -10,7 +11,7 @@
10
11
  <DropdownMenu ref="dropdown" slot="list" style="width: auto">
11
12
  <template v-for="child in children">
12
13
  <ProLayoutSiderCollapsedMenu v-if="showChildren(child)" :key="`drop-${child.name}`"
13
- :parent-item="child">
14
+ :parent-item="child">
14
15
  </ProLayoutSiderCollapsedMenu>
15
16
  <DropdownItem v-else :key="`drop-${child.name}`" :name="child.name">
16
17
  <ProLayoutSiderIcon :icon-type="child.meta.icon"></ProLayoutSiderIcon>
@@ -88,4 +89,4 @@ export default {
88
89
  }
89
90
  }
90
91
  }
91
- </style>
92
+ </style>
@@ -7,21 +7,21 @@
7
7
  <template v-for="item in menuList">
8
8
  <template v-if="item.children && item.children.length === 1">
9
9
  <ProLayoutSiderMenuItem v-if="showChildren(item)"
10
- :key="`menu-${item.name}`"
11
- :parent-item="item" :server-context="serverContext">
10
+ :key="`menu-${item.name}`"
11
+ :parent-item="item" :server-context="serverContext">
12
12
  </ProLayoutSiderMenuItem>
13
13
  <MenuItem v-else :key="`menu-${item.children[0].name}`"
14
- :name="getNameOrHref(item, true)">
14
+ :name="getNameOrHref(item, true)">
15
15
  <ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
16
16
  <span>{{ showTitle(item.children[0]) }}</span>
17
17
  </MenuItem>
18
18
  </template>
19
19
  <template v-else>
20
20
  <ProLayoutSiderMenuItem v-if="showChildren(item)" :key="`menu-${item.name}`"
21
- :parent-item="item" :server-context="serverContext">
21
+ :parent-item="item" :server-context="serverContext">
22
22
  </ProLayoutSiderMenuItem>
23
23
  <MenuItem v-else :key="`menu-${item.name}`"
24
- :name="getNameOrHref(item)">
24
+ :name="getNameOrHref(item)">
25
25
  <ProLayoutSiderIcon :icon-type="item.meta.icon"></ProLayoutSiderIcon>
26
26
  <span>{{ showTitle(item) }}</span>
27
27
  </MenuItem>
@@ -30,18 +30,23 @@
30
30
  </Menu>
31
31
  <ProLayoutOtherMenu :collapsed="collapsed" @on-select="selectHandle" :server-context="serverContext"></ProLayoutOtherMenu>
32
32
 
33
- <div v-show="collapsed" :list="menuList" class="menu-collapsed">
33
+ <div v-show="collapsed" :list="menuList" class="menu-collapsed" >
34
34
  <template v-for="item in menuList">
35
35
  <ProLayoutSiderCollapsedMenu v-if="item.children && item.children.length > 1" :key="`drop-menu-${item.name}`"
36
- :parent-item="item" theme="dark" hide-title
37
- @on-click="handleSelect">
36
+ :parent-item="item" theme="dark" hide-title
37
+ @on-click="handleSelect" :active-item="openedNames">
38
38
  </ProLayoutSiderCollapsedMenu>
39
39
  <Tooltip v-else :key="`drop-menu-${item.name}`" :content="showTitle(item.children && item.children[0] ? item.children[0] : item)"
40
40
  placement="right" transfer>
41
- <a :style="{textAlign: 'center'}" class="drop-menu-a"
42
- @click="handleSelect(getNameOrHref(item, true))">
43
- <ProLayoutSiderIcon :icon-type="item.meta.icon" icon-size="26"></ProLayoutSiderIcon>
44
- </a>
41
+ <template v-slot:default="{ active }">
42
+ <a :style="{textAlign: 'center'}"
43
+ :class="['drop-menu-a', item.name === selectedTopParent ? 'selected-parent' : '']"
44
+ @click="handleSelect(getNameOrHref(item, true))">
45
+ <!-- <i :class="[item.meta.icon, selectedIconType === item.meta.icon ? 'selected-icon' : '']"></i>-->
46
+ <ProLayoutSiderIcon :icon-type="item.meta.icon" icon-size="26" :class="{ 'selected-icon': item.name === selectedTopParent && collapsed }"
47
+ ></ProLayoutSiderIcon>
48
+ </a>
49
+ </template>
45
50
  </Tooltip>
46
51
  </template>
47
52
  </div>
@@ -83,10 +88,18 @@ export default {
83
88
  originMenuList:[],
84
89
  menuList: [],
85
90
  appId: '',
91
+ primaryColor: '#ff0000',
86
92
  collapsed: false,
87
93
  accordion: true,
88
94
  activeName: '',
89
95
  openedNames: [],
96
+ activeMenu: null,
97
+ selectedMenuParent: null,
98
+ activeMenuItem: null,
99
+ openedSubMenu: null,
100
+ currentMenuItem: null,
101
+ selectedTopParent: '',
102
+ activeIcon: null,
90
103
  tagValue: '',
91
104
  tagList: []
92
105
  }
@@ -168,7 +181,32 @@ export default {
168
181
  }
169
182
  Bus.$emit('tag-list', tagList, menu.name)
170
183
  }
184
+ if (menu.meta && Array.isArray(menu.meta.crumbs)) {
185
+ let parentMenu = menu.meta.crumbs[0]
186
+ //console.log('parentMenu',parentMenu)
187
+ this.$set(this, 'selectedTopParent', parentMenu.name);
188
+ } else {
189
+ // 处理没有父菜单的情况
190
+ this.$set(this, 'selectedTopParent', menu.name);
191
+ }
192
+ // console.log('this.selectedTopParent',this.selectedTopParent)
193
+ // console.log('this.menuList',this.menuList)
194
+ // console.log('this.activiname',this.activeName)
195
+ // console.log('this.openedNames',this.openedNames)
196
+ },
197
+ getTopParent(menu) {
198
+ // console.log('getTopParent')
199
+ return menu.parent ? this.getTopParent(menu.parent) : menu.name;
200
+ // console.log('menu.parent',menu.name)
171
201
  },
202
+ activeIconBackground(item) {
203
+ // console.log('activeBack')
204
+ // 如果当前菜单项是激活的,返回一个颜色值,否则返回空
205
+ return this.selectedMenuParent=== item.parent ? '#ff0000' : '';
206
+ },
207
+
208
+
209
+
172
210
  triggerChange(data){
173
211
  this.collapsed = data;
174
212
  },
@@ -231,6 +269,7 @@ export default {
231
269
 
232
270
  <style scoped lang="less">
233
271
  @import "@lambo-design/core/src/styles/default";
272
+
234
273
  .pro-layout-sider-wrapper{
235
274
  margin-bottom: 50px;
236
275
  /deep/.ivu-menu-submenu{
@@ -250,6 +289,10 @@ export default {
250
289
  &:hover{
251
290
  color: var(--heading-color-dark, @_heading-color-dark);
252
291
  }
292
+ &.selected-parent{
293
+ // color: #ffffff !important;
294
+ background: #306BE3 !important;
295
+ }
253
296
  }
254
297
  }
255
298
  }
@@ -15,7 +15,7 @@
15
15
 
16
16
  &:hover {
17
17
  color: #ffffff;
18
- background: #061629;
18
+ // background: #061629;
19
19
  }
20
20
 
21
21
  .ivu-tooltip {
@@ -5,6 +5,12 @@ export default {
5
5
  default: () => {
6
6
  }
7
7
  },
8
+ activeItem: {
9
+ type: Array,
10
+ default: () => {
11
+ return [];
12
+ }
13
+ },
8
14
  isShow: {
9
15
  type: Boolean,
10
16
  default: true