Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
xianyu-ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhangwenxue
5 years ago
Commit
12e8398395e99ea7ed55d31dcb3fae0fd93d3ff4
1 parent
3f17e35f
商品详情: 使用SSR
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
apps/pages/product/product-detail.vue
apps/pages/product/product-detail.vue
View file @
12e8398
...
...
@@ -200,6 +200,11 @@ export default {
showSizeRequestSheet: 'onSizeRequestHidden',
};
},
asyncData({store, router}) {
const productId = parseInt(router.params.productId, 10);
return store.dispatch('product/fetchProductInfo', {productId});
},
activated() {
this.$refs.pageScroll && this.$refs.pageScroll.scrollTo(0, 0, 0);
this.loadData(this.productId);
...
...
@@ -240,20 +245,9 @@ export default {
},
// 加载商品详情数据
loadData(productId = this.productId, loading) {
loading && loading.show();
loadData(productId = this.productId) {
this.fetchBrandTop({productId});
this.fetchFav({productId});
return this.fetchProductInfo({productId}).then(() => {
loading && loading.hide();
setTimeout(() => {
this.refresh();
}, 200);
}).catch(() => {
loading && loading.hide();
});
},
/**
...
...
Please
register
or
login
to post a comment