Popup.vue
1.96 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
<template>
<uni-popup
ref="popup"
:type="position"
:is-mask-click="maskClick"
:animation="animation"
>
<view :class="['popup-box',{'right-box':position=='right'}]">
<slot></slot>
<view class="popup-footer flex">
<view
class="popup-btn popup-cancel"
@click="cancel"
>{{cancelText}}</view>
<view
class="popup-btn popup-confirm"
@click="confirm"
>{{confirmText}}</view>
</view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'Popup',
props: {
animation: {
type: Boolean,
default: true
},
maskClick: {
type: Boolean,
default: false
},
position:{
type: String,
default: 'bottom'
},
cancelText: {
type: String,
default: '取消'
},
confirmText:{
type: String,
default: '确定'
}
},
data () {
return {
}
},
computed: {
},
mounted () {
},
methods: {
open () {
this.$refs.popup.open()
},
cancel () {
this.$emit('onCancel')
},
close () {
this.$refs.popup.close()
this.$emit('close')
},
confirm () {
this.$emit('onConfirm')
},
}
}
</script>
<style scoped lang='scss'>
.popup-box {
border-radius: 32rpx 32rpx 0 0;
background: #ffffff;
height: 70vh;
.popup-footer {
padding: 64rpx 0;
justify-content: center;
gap: 0 32rpx;
.popup-btn {
display: flex;
align-items: center;
justify-content: center;
width: 720rpx;
height: 80rpx;
border-radius: 64rpx;
background: #f0f1f5;
color: #333333;
font-size: 32rpx;
font-weight: 500;
}
.popup-confirm {
color: #fff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
}
}
}
.right-box {
width: 46vw;
height: 100vh;
border-radius: 32rpx 0 0 32rpx;
.popup-footer {
margin: 0 48rpx;
}
}
</style>