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

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.430",
3
+ "version": "1.0.0-beta.431",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "lambo",
@@ -19,6 +19,7 @@
19
19
  <script>
20
20
  import Bus from '@lambo-design/shared/utils/bus'
21
21
  import { deepCopy } from '@lambo-design/shared/utils/assist'
22
+ import _ from "lodash";
22
23
 
23
24
  export default {
24
25
  props: {
@@ -89,13 +90,27 @@ export default {
89
90
  }
90
91
  },
91
92
  initNav(data) {
92
- if (data.toString() === this.navList.toString() && this.topMenuNum === this.lastTopMenuNum) {
93
+ // 过滤掉首页项,获取真实的业务数据
94
+ const realData = data.filter(item => item.appId !== 'backHome');
95
+ if (realData.toString() === this.navList.toString() && this.topMenuNum === this.lastTopMenuNum) {
93
96
  return
94
97
  }
95
- this.navList = data
98
+ this.navList = realData
96
99
  this.lastTopMenuNum = this.topMenuNum
97
100
 
98
- this.topMenList = data
101
+ let dataClone = _.cloneDeep(realData);
102
+ // 如果配置了显示首页且显示样式是应用式,在列表最前面添加首页项
103
+ if (dataClone && dataClone.length > 0 && this.systemInfo.backToHome && this.systemInfo.backToHomeStyle === "app") {
104
+ const homeItem = {
105
+ appId: 'backHome',
106
+ name: this.systemInfo.backToHomeText || '首页',
107
+ icon: 'ios-home',
108
+ selected: false
109
+ };
110
+ dataClone.unshift(homeItem);
111
+ }
112
+
113
+ this.topMenList = dataClone
99
114
  this.$emit('topMen-list', this.topMenList);
100
115
 
101
116
  // 计算可以显示的菜单数量
@@ -103,6 +118,9 @@ export default {
103
118
 
104
119
  if (this.topMenList.length > 0) {
105
120
  let appId = this.topMenList[0].appId
121
+ if (this.systemInfo.backToHome && this.systemInfo.backToHomeStyle === "app") {
122
+ appId = this.topMenList[1].appId;
123
+ }
106
124
  for (let i = 0; i < this.topMenList.length; i++) {
107
125
  if (this.topMenList[i].selected == true) {
108
126
  appId = this.topMenList[i].appId
@@ -145,7 +163,7 @@ export default {
145
163
  let accumulatedWidth = 0;
146
164
  const reservedWidth = 40; // 预留一些边距
147
165
 
148
- this.navList.forEach((item, index) => {
166
+ this.topMenList.forEach((item, index) => {
149
167
  const estimatedWidth = this.estimateMenuItemWidth(item);
150
168
  if (accumulatedWidth + estimatedWidth <= this.availableWidth - reservedWidth) {
151
169
  accumulatedWidth += estimatedWidth;
@@ -208,6 +226,13 @@ export default {
208
226
 
209
227
  selectApp(appId) {
210
228
  if (appId) {
229
+ if (appId === 'backHome') {
230
+ Bus.$emit("change-app", {
231
+ appId,
232
+ appInfo: {}
233
+ });
234
+ return;
235
+ }
211
236
  this.activeName = appId
212
237
  let res = this.navList.filter(app => app.appId == appId)
213
238
  Bus.$emit('change-app', { appId, appInfo: res[0] })