uni-popup-share.vue
3.61 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<template>
<view class="uni-popup-share">
<!-- <view class="uni-share-title"><text class="uni-share-title-text">{{title}}</text></view> -->
<view class="uni-share-content">
<view class="uni-share-content-box">
<button
class="uni-share-content-item"
v-for="(item,index) in bottomData"
:key="index"
:open-type="item.name === 'friend' ? 'share': ''"
@click.stop="select(item,index)"
>
<image
class="uni-share-image"
:src="item.icon"
mode="aspectFill"
></image>
<view class="uni-share-text">{{item.text}}</view>
</button>
</view>
</view>
<view
@tap="close"
class="uni-share-button-box"
>
取消
</view>
</view>
</template>
<script>
export default {
name: 'UniPopupShare',
props: {
title: {
type: String,
default: '分享到',
},
},
inject: ['popup'],
data() {
return {
bottomData: [{
text: '推荐到好物圈',
icon: '/static/img/share/recommend.png',
name: 'recommend',
}, {
text: '转发给朋友/群',
icon: '/static/img/share/friend.png',
name: 'friend',
}, {
text: '生成海报',
icon: '/static/img/share/poster.png',
name: 'poster',
},
],
}
},
created() {},
methods: {
/**
* 选择内容
*/
select(item, index) {
this.$emit('select', {
item,
index,
}, () => {
this.popup.close()
})
},
/**
* 关闭窗口
*/
close() {
this.popup.close()
},
},
}
</script>
<style lang="scss" scoped>
.uni-popup-share {
background-color: #fff;
border-radius: 8px 8px 0px 0px;
}
.uni-share-title {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
justify-content: center;
height: 40px;
}
.uni-share-title-text {
font-size: 14px;
color: #666;
}
.uni-share-content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 10px;
}
.uni-share-content-box {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: space-between;
width: 360px;
}
.uni-share-content-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
flex-wrap: wrap;
padding: 10px 0;
align-items: center;
border-bottom: 1px solid #f2f2f2;
background-color: #fff;
font-family: PingFangSC-Regular;
font-size: 16px;
color: #333333;
letter-spacing: -0.3px;
margin: 0;
&::after {
border: 0;
}
}
.uni-share-content-item:active {
background-color: #f5f5f5;
}
.uni-share-image {
width: 84rpx;
height: 84rpx;
vertical-align: middle;
margin-left: 40rpx;
}
.uni-share-text {
font-family: PingFangSC-Regular;
font-size: 16px;
color: #3b4144;
margin-left: 20rpx;
}
// .share_button {
// border: none;
// }
.uni-share-button-box {
/* #ifndef APP-NVUE */
// display: flex;
/* #endif */
// flex-direction: row;
// padding: 10px 15px;
height: 100rpx;
font-family: PingFangSC-Regular;
font-size: 16px;
color: #333333;
letter-spacing: -0.3px;
text-align: center;
line-height: 100rpx;
}
.uni-share-button {
flex: 1;
border-radius: 50px;
color: #666;
font-size: 16px;
}
.uni-share-button::after {
border-radius: 50px;
}
</style>