Showing
1 changed file
with
6 additions
and
12 deletions
@@ -200,6 +200,11 @@ export default { | @@ -200,6 +200,11 @@ export default { | ||
200 | showSizeRequestSheet: 'onSizeRequestHidden', | 200 | showSizeRequestSheet: 'onSizeRequestHidden', |
201 | }; | 201 | }; |
202 | }, | 202 | }, |
203 | + asyncData({store, router}) { | ||
204 | + const productId = parseInt(router.params.productId, 10); | ||
205 | + | ||
206 | + return store.dispatch('product/fetchProductInfo', {productId}); | ||
207 | + }, | ||
203 | activated() { | 208 | activated() { |
204 | this.$refs.pageScroll && this.$refs.pageScroll.scrollTo(0, 0, 0); | 209 | this.$refs.pageScroll && this.$refs.pageScroll.scrollTo(0, 0, 0); |
205 | this.loadData(this.productId); | 210 | this.loadData(this.productId); |
@@ -240,20 +245,9 @@ export default { | @@ -240,20 +245,9 @@ export default { | ||
240 | }, | 245 | }, |
241 | 246 | ||
242 | // 加载商品详情数据 | 247 | // 加载商品详情数据 |
243 | - loadData(productId = this.productId, loading) { | ||
244 | - loading && loading.show(); | ||
245 | - | 248 | + loadData(productId = this.productId) { |
246 | this.fetchBrandTop({productId}); | 249 | this.fetchBrandTop({productId}); |
247 | this.fetchFav({productId}); | 250 | this.fetchFav({productId}); |
248 | - | ||
249 | - return this.fetchProductInfo({productId}).then(() => { | ||
250 | - loading && loading.hide(); | ||
251 | - setTimeout(() => { | ||
252 | - this.refresh(); | ||
253 | - }, 200); | ||
254 | - }).catch(() => { | ||
255 | - loading && loading.hide(); | ||
256 | - }); | ||
257 | }, | 251 | }, |
258 | 252 | ||
259 | /** | 253 | /** |
-
Please register or login to post a comment