@lambo-design/pro-layout 1.0.0-beta.431 → 1.0.0-beta.433

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.431",
3
+ "version": "1.0.0-beta.433",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -10,8 +10,8 @@
10
10
  "registry": "https://registry.npmjs.org/"
11
11
  },
12
12
  "devDependencies": {
13
- "@lambo-design/shared": "^1.0.0-beta.351",
14
- "@lambo-design/core": "^4.7.1-beta.176"
13
+ "@lambo-design/core": "^4.7.1-beta.176",
14
+ "@lambo-design/shared": "^1.0.0-beta.352"
15
15
  },
16
16
  "scripts": {
17
17
  "release-pro-layout": "pnpm release-beta && git push --follow-tags && pnpm re-publish",
@@ -3,7 +3,7 @@
3
3
  <ul class="top-menu" :style="layoutSize === 'default' ? {height: '64px'} : {height: '50px'}" ref="topNav">
4
4
  <template v-for="(item,index) in topMenList" >
5
5
  <li class="top-menu-item"
6
- :class="{ 'active': notHomeIndex ? activeName === item.appId : 'backHome' === item.appId}"
6
+ :class="{ 'active': getIsActive(item) }"
7
7
  :key="item.appId"
8
8
  @click="selectApp(item.appId)">
9
9
  <div class="menu-item" :style="layoutSize === 'default' ? {paddingTop: '10px'} : {paddingTop: '2px'}">
@@ -20,6 +20,7 @@
20
20
  import Bus from '@lambo-design/shared/utils/bus'
21
21
  import { deepCopy } from '@lambo-design/shared/utils/assist'
22
22
  import _ from "lodash";
23
+ import {getSessionStorage} from "@lambo-design/shared/utils/n";
23
24
 
24
25
  export default {
25
26
  props: {
@@ -266,6 +267,29 @@ export default {
266
267
  item.style.display = 'block';
267
268
  }
268
269
  });
270
+ },
271
+ getIsActive(item) {
272
+ // 如果不是首页模式,直接比较 appId
273
+ if (this.notHomeIndex) {
274
+ return this.activeName === item.appId;
275
+ }
276
+
277
+ // 如果是首页模式,检查当前 activeName 对应的应用是否隐藏了左侧菜单
278
+ const appList = getSessionStorage('appList');
279
+ if (appList && Array.isArray(appList) && appList.length > 0) {
280
+ // 查找当前 activeName 对应的应用
281
+ const currentApp = appList.find(app => app.appId === this.activeName);
282
+ // 如果找到应用且隐藏了左侧菜单,该应用应该保持激活状态
283
+ if (currentApp) {
284
+ const isHideLeftMenu = currentApp.extendProps?.is_hide_left_menu || currentApp.setting?.is_hide_left_menu;
285
+ if ((isHideLeftMenu === '1' || isHideLeftMenu === 1) && this.activeName === item.appId) {
286
+ return true;
287
+ }
288
+ }
289
+ }
290
+
291
+ // 否则只有 backHome 项应该是激活的
292
+ return 'backHome' === item.appId;
269
293
  }
270
294
  },
271
295
  watch: {
@@ -4,7 +4,7 @@
4
4
  ref="topNav"
5
5
  mode="horizontal"
6
6
  theme="dark"
7
- :active-name="notHomeIndex ? activeName : 'backHome'"
7
+ :active-name="getActiveName()"
8
8
  @on-select="selectApp"
9
9
  >
10
10
  <template v-for="item in topMenList">
@@ -63,6 +63,7 @@ import Bus from "@lambo-design/shared/utils/bus";
63
63
  import { deepCopy } from "@lambo-design/shared/utils/assist";
64
64
  import { arraysEqual } from "@lambo-design/shared/utils/platform";
65
65
  import _ from "lodash";
66
+ import {getSessionStorage} from "@lambo-design/shared/utils/n";
66
67
 
67
68
  export default {
68
69
  name: "pro-layout-nav",
@@ -434,6 +435,29 @@ export default {
434
435
  return {
435
436
  type:item.icon
436
437
  }
438
+ },
439
+ getActiveName() {
440
+ // 如果不是首页模式,直接返回 activeName
441
+ if (this.notHomeIndex) {
442
+ return this.activeName;
443
+ }
444
+
445
+ // 如果是首页模式,检查当前 activeName 对应的应用是否隐藏了左侧菜单
446
+ const appList = getSessionStorage('appList');
447
+ if (appList && Array.isArray(appList) && appList.length > 0) {
448
+ // 查找当前 activeName 对应的应用
449
+ const currentApp = appList.find(app => app.appId === this.activeName);
450
+ // 如果找到应用且隐藏了左侧菜单,返回 activeName
451
+ if (currentApp) {
452
+ const isHideLeftMenu = currentApp.extendProps?.is_hide_left_menu;
453
+ if (isHideLeftMenu === '1' || isHideLeftMenu === 1) {
454
+ return this.activeName;
455
+ }
456
+ }
457
+ }
458
+
459
+ // 否则返回首页
460
+ return 'backHome';
437
461
  }
438
462
  },
439
463
  watch: {
package/src/index.vue CHANGED
@@ -341,12 +341,13 @@ export default {
341
341
  if(appInfo && appInfo.setting){
342
342
  appConfig=JSON.parse(appInfo.setting)
343
343
  }
344
- // 优先使用传入的 showLeftMenu prop,其次使用 appConfig,最后使用默认值
345
- if (this.showLeftMenu !== null) {
346
- this.isHideLeftMenu = this.showLeftMenu;
347
- } else if (appConfig && appConfig.is_hide_left_menu){
344
+
345
+ // 优先使用 appConfig,其次使用传入的 showLeftMenu prop,最后使用默认值
346
+ if (appConfig && appConfig.is_hide_left_menu){
348
347
  this.isHideLeftMenu=appConfig.is_hide_left_menu!='1'
349
- }else{
348
+ } else if (this.showLeftMenu !== null) {
349
+ this.isHideLeftMenu = this.showLeftMenu;
350
+ } else{
350
351
  this.isHideLeftMenu=true
351
352
  }
352
353