Showing
1 changed file
with
22 additions
and
16 deletions
@@ -246,28 +246,34 @@ export default { | @@ -246,28 +246,34 @@ export default { | ||
246 | delete searchParams[key]; | 246 | delete searchParams[key]; |
247 | } | 247 | } |
248 | } | 248 | } |
249 | - let result = await this.fetchProductList({ | ||
250 | - ...searchParams, | ||
251 | - page, | ||
252 | - pageSize | ||
253 | - }); | ||
254 | - let {data} = result; | 249 | + try{ |
250 | + let result = await this.fetchProductList({ | ||
251 | + ...searchParams, | ||
252 | + page, | ||
253 | + pageSize | ||
254 | + }); | ||
255 | + | ||
256 | + let {data} = result; | ||
255 | 257 | ||
256 | - if (result.code === 200) { | 258 | + if (result.code === 200) { |
257 | 259 | ||
258 | - data.endReached = (data.page === data.page_total) && (data.page_size !== 1) || !data.page_total; | 260 | + data.endReached = (data.page === data.page_total) && (data.page_size !== 1) || !data.page_total; |
259 | 261 | ||
260 | - } | 262 | + } |
261 | 263 | ||
262 | - if (typeof data === 'object' && Object.keys(data).length) { | ||
263 | - for (let key in data) { | ||
264 | - if (key === 'product_list') { | ||
265 | - list.list = data.page > 1 ? list.list.concat(data.product_list) : data.product_list; | ||
266 | - } else { | ||
267 | - list[key] = data[key]; | 264 | + if (typeof data === 'object' && Object.keys(data).length) { |
265 | + for (let key in data) { | ||
266 | + if (key === 'product_list') { | ||
267 | + list.list = data.page > 1 ? list.list.concat(data.product_list) : data.product_list; | ||
268 | + } else { | ||
269 | + list[key] = data[key]; | ||
270 | + } | ||
268 | } | 271 | } |
272 | + this.productList = list; | ||
269 | } | 273 | } |
270 | - this.productList = list; | 274 | + }catch(e) { |
275 | + console.log(e); | ||
276 | + this.productList.list = []; | ||
271 | } | 277 | } |
272 | }, | 278 | }, |
273 | 279 |
-
Please register or login to post a comment