Authored by 毕凯

侧边栏支持分割符

@@ -52,7 +52,10 @@ const getLeftNav = (guangChoosed) => { @@ -52,7 +52,10 @@ const getLeftNav = (guangChoosed) => {
52 result = JSON.parse(result); 52 result = JSON.parse(result);
53 53
54 if (result.code === 200) { 54 if (result.code === 200) {
55 - _.forEach(result.data, (item) => { 55 + let formatData = [];
  56 + let offset = 0; // 分割数组用到的游标
  57 +
  58 + _.forEach(result.data, (item, i) => {
56 _.forEach(Object.keys(item), (k) => { 59 _.forEach(Object.keys(item), (k) => {
57 item[_.camelCase(k)] = item[k]; // 下划线变量名转换为驼峰 60 item[_.camelCase(k)] = item[k]; // 下划线变量名转换为驼峰
58 }); 61 });
@@ -70,8 +73,17 @@ const getLeftNav = (guangChoosed) => { @@ -70,8 +73,17 @@ const getLeftNav = (guangChoosed) => {
70 73
71 item.sub = sub; 74 item.sub = sub;
72 } 75 }
  76 +
  77 + // 如果有分隔符,分割数组
  78 + if (item.separativeSign === 'Y') {
  79 + formatData.push(result.data.slice(offset, i));
  80 + offset = i;
  81 + }
73 }); 82 });
74 - return result.data; 83 +
  84 + // 数组被分割剩余的部分
  85 + formatData.push(result.data.slice(offset));
  86 + return formatData;
75 } else { 87 } else {
76 return result; 88 return result;
77 } 89 }