MCPcopy
hub / github.com/coderwhy/HYMiniMall / _getProductData

Function _getProductData

pages/home/home.js:120–139  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

118 })
119 },
120 _getProductData(type) {
121 // 1.获取数据对应的页码
122 const page = this.data.goods[type].page;
123
124 // 2.请求数据
125 getProduct(type, page).then(res => {
126 // 1.取出数据
127 const list = res.data.list;
128
129 // 2.将数据临时获取
130 const goods = this.data.goods;
131 goods[type].list.push(...list)
132 goods[type].page += 1;
133
134 // 3.最新的goods设置到goods中
135 this.setData({
136 goods: goods
137 })
138 })
139 }
140})

Callers

nothing calls this directly

Calls 1

getProductFunction · 0.90

Tested by

no test coverage detected