(type)
| 51 | }) |
| 52 | }, |
| 53 | _getGoodsData(type) { |
| 54 | // 1.获取页码 |
| 55 | const page = this.data.goods[type].page + 1; |
| 56 | |
| 57 | // 2.发送网络请求 |
| 58 | getGoodsData(type, page).then(res => { |
| 59 | // console.log(res) |
| 60 | // 2.1.取出数据 |
| 61 | const list = res.data.data.list; |
| 62 | |
| 63 | // 2.2.将数据设置到对应type的list中 |
| 64 | const oldList = this.data.goods[type].list; |
| 65 | oldList.push(...list) |
| 66 | |
| 67 | // 2.3.将数据设置到data中的goods中 |
| 68 | const typeKey = `goods.${type}.list`; |
| 69 | const pageKey = `goods.${type}.page`; |
| 70 | this.setData({ |
| 71 | [typeKey]: oldList, |
| 72 | [pageKey]: page |
| 73 | }) |
| 74 | }) |
| 75 | }, |
| 76 | |
| 77 | // ------------------- 事件监听函数 ------------------------- |
| 78 | handleTabClick(event) { |
nothing calls this directly
no test coverage detected