mixins.js
890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import {createNamespacedHelpers} from 'vuex';
const { mapState, mapActions } = createNamespacedHelpers('product');
export default {
computed: {
...mapState(['products', 'fav', 'topLists']),
productDetail() {
this.ensureProduct({ productId: this.productId });
return this.products[this.productId];
},
imageList() {
return this.productDetail.goods_list[0].image_list;
},
resource() {
return this.productDetail.resource || {};
},
videoResource() {
return this.productDetail.videoResource || {};
},
activity() {
return this.productDetail.activity;
},
isFav() {
return this.fav[this.productId];
},
topList() {
return this.topLists[this.productId];
},
recommend() {
return this.productDetail.recommend;
},
},
methods: {
...mapActions(['ensureProduct']),
},
};