address-act.vue
4.38 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<template>
<div class="address-select-component" v-show="show">
<div class="address-select-box">
<div class="component-title"><span class="title">所在地区</span><span class="iconfont close" @click="closeAddBox">X</span></div>
<ul class="head-address-ul">
<li class="head-address-li">请选择</li>
<li></li>
<li></li>
<li></li>
</ul>
<div class="address-container">
<div class="address-content">
<ul class="address-ul">
<li v-for="address in addresses" @click="getAddress(address.id)">{{address.caption}}</li>
</ul>
</div>
</div>
</div>
</div>
</template>
<style>
.address-select-component {
position: fixed;
top: 0;
left: 0;
width: 100%;
background: rgba(0, 0, 0, 0.5);
.address-select-box {
margin-top: 400px;
background: #fff;
.component-title {
text-align: center;
line-height: 80px;
font-size: 32px;
color: #ccc;
padding: 0 30px;
.close {
float: right;
}
}
.head-address-ul {
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
background-color: white;
font-size: 24px;
color: #444;
li {
display: block;
float: left;
height: 40px;
line-height: 40px;
position: relative;
padding-left: 30px;
}
.head-address-li {
color: #f23030;
}
.head-address-li:after {
width: 70%;
height: 1px;
border-bottom: 2px solid #f23030;
position: absolute;
bottom: 1px;
left: 50%;
content: '';
margin-left: -20px;
}
}
.head-address-ul:after {
content: '';
width: 100%;
height: 1px;
position: absolute;
border-bottom: 1px solid #e3e5e9;
left: 0px;
bottom: 0px;
transform: scaleY(0.5);
-webkit-transform: scaleY(0.5);
}
.address-container {
margin: -1px 0 0 0;
overflow: hidden;
height: 100%;
width: 100%;
border-top: solid 1px #ccc;
.address-content {
transform: translate(0px, 0px) translateZ(0px);
height: 620px;
.address-ul {
padding: 0;
margin: 0;
list-style: none;
height: 100%;
overflow: auto;
font-size: 24px;
color: #232326;
li {
height: 80px;
line-height: 80px;
padding-left: 30px;
position: relative;
overflow: hidden;
}
li:after {
content: '';
width: 100%;
height: 1px;
position: absolute;
left: 0px;
bottom: 0px;
transform: scaleY(0.5);
-webkit-transform: scaleY(0.5);
}
}
}
}
}
}
</style>
<script>
require('../../../scss/home/_address.css');
module.exports = {
data() {
return {
addresses:[],
show: false
};
},
methods: {
/* 获取地址数据 */
getAddress(id) {
console.log(id);
$.get('/home/getaddress.json', {
id: id
}, resultData => {
this.addresses = resultData;
});
},
/* 关闭地址选择组件 */
closeAddBox() {
this.show = false;
}
},
created: function() {
this.getAddress();
}
};
</script>