feature-selector.vue
2.59 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<style src="./css/feature-selector.css"></style>
<template>
<div class="feature-selector" v-bind:class="{ 'slide-in': isVisible }">
<div class="header">
<div class="image-box">
<img src=""/>
</div>
<div class="text-box">
<h3>{{title}}</h3>
<h4>¥{{price}}</h4>
</div>
</div>
<hr>
<div>
<section>
<h4>颜色</h4>
<feature-options :options="colors"></feature-options>
</section>
<section>
<h4>尺码</h4>
<feature-options :options="sizes"></feature-options>
</section>
<button v-on:click="addToCart(product.id)" class="button button-solid add-to-cart">加入购物袋</button>
</div>
</div>
</template>
<script>
module.exports = {
init() {
},
props: {
isVisible: Boolean
},
watch: {
isVisible() {
const self = this;
if (this.isVisible) {
this.overlay = $.overlay({
onClose: function() {
self.isVisible = false;
}
});
this.overlay.show();
} else {
this.overlay.hide();
this.$parent.$emit('featureselector.close');
}
}
},
data() {
return {
title: 'Supreme经典夹克Supreme经典夹克Supreme经典夹克Supreme经典夹克',
price: '1289.00',
colors: [
{
text: '炫酷黑',
value: '#333333'
},
{
text: '象牙白',
value: '#EFEFEF'
},
{
text: '深海蓝',
value: '#330000'
}
],
sizes: [
{
text: 'S',
value: 'S'
},
{
text: 'M',
value: 'M'
},
{
text: 'L',
value: 'L'
}
]
};
},
components: {
'feature-options': require('./feature-options.vue')
}
};
</script>