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 }) } } } })