|
|
<template>
|
|
|
<div class="layout">
|
|
|
<LayoutHeader class="layout-header" :show-back="true" :key="productId">
|
|
|
<LayoutHeader class="layout-header" :show-back="true" :title="title" ref="header">
|
|
|
<transition name="fade">
|
|
|
<img-size v-show="headThumbnailVisible" class="title-thumbnail" :src="imageList && imageList[0] && imageList[0].image_url" :width="300" :height="300"/>
|
|
|
</transition>
|
...
|
...
|
@@ -180,9 +180,21 @@ export default { |
|
|
sizeList() {
|
|
|
return get(this.productDetail, 'goods_list[0].size_list', null);
|
|
|
},
|
|
|
title() {
|
|
|
return get(this.productDetail, 'product_name', '商品详情');
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
title: {
|
|
|
handler() {
|
|
|
this.setTitle();
|
|
|
},
|
|
|
immediate: true,
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
|
this.imageHideThreadhold = -window.innerWidth * 0.693;
|
|
|
|
|
|
},
|
|
|
activated() {
|
|
|
if (this.productId !== this.productDetail.product_id) {
|
...
|
...
|
@@ -191,6 +203,15 @@ export default { |
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['fetchProductInfo', 'fetchTop3', 'fetchFav', 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment']),
|
|
|
setTitle() {
|
|
|
if (this.productId === this.productDetail.product_id) {
|
|
|
if (this.$refs.header && this.$refs.header.setTitle) {
|
|
|
this.$refs.header.setTitle(this.title);
|
|
|
} else if (document) {
|
|
|
document.title = this.title;
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
refresh() {
|
|
|
this.$refs.slide.refresh();
|
|
|
this.headThumbnailVisible = false;
|
...
|
...
|
@@ -248,7 +269,7 @@ export default { |
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.toggleFav({ productId: this.productId, isFav }).then(() => {
|
|
|
this.toggleFav({productId: this.productId, isFav}).then(() => {
|
|
|
const txt = isFav ? '收藏成功' : '取消收藏成功';
|
|
|
|
|
|
this.$createToast({
|
...
|
...
|
|