wujingjing
2024-08-09 fc3906e080b2204648ee83ee9a1db1584f818f4e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { getSectionByAllList } from "@/api/chat";
 
 
// pages/scene.ts
Component({
 
  /**
   * 页面的初始数据
   */
  data: {
    sectionList: [],
    iconList: ['bengzhan1', 'sanweiditu', 'jiankong']
  },
  lifetimes: {
 
    async attached() {
      const res = await getSectionByAllList();
      if(!res?.json_ok)return;
      this.setData({
        sectionList: res?.sections?.map(item => {
          item.childrenChunkList = wx.$_.chunk(item.children, 3);
          Reflect.deleteProperty(item, 'children');
          return item;
        })
      })
    }
  },
  pageLifetimes: {
    show() {
 
      if (typeof this.getTabBar === 'function' &&
        this.getTabBar()) {
        this.getTabBar().setData({
          selected: 1
        })
      }
    }
  }
})