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
| <template>
| <view class="ActionSheet">
| <uni-popup ref="ActionSheet" class="ActionSheet-popup" type="bottom">
| <view class="list">
| <block v-for="(item,index) of list" :key="index">
| <button class="button" @click="handle(item,index)">{{item}}</button>
| </block>
| <button class="button close" @click="close">取消</button>
| </view>
| </uni-popup>
| </view>
| </template>
|
| <script>
| export default {
| name:"ActionSheet",
| props:{
|
| },
| data() {
| return {
| list:[],
| changeHandle:null,
| closeHandle:null
| };
| },
| methods:{
| open(list = [],change,close){
| this.changeHandle = change;
| this.closeHandle = close;
| this.list = list
| this.$refs.ActionSheet.open()
| },
| handle(item,index){
| this.changeHandle && this.changeHandle({text:item,tapIndex:index})
| this.$refs.ActionSheet.close()
| },
| close(){
| this.closeHandle && this.closeHandle()
| this.$refs.ActionSheet.close()
| }
| }
| }
| </script>
|
| <style lang="scss" scoped>
| .ActionSheet{
| .ActionSheet-popup{
| .list{
| display: flex;
| flex-direction: column;
| align-items: center;
| .button{
| width: 694rpx;
| height: 100rpx;
| background: #FFFFFF;
| border-radius: 8rpx;
| font-family: PingFangSC, PingFang SC;
| font-size: 27rpx;
| color: #000000;
| line-height: 38rpx;
| border: 2rpx solid #CCCCCC;
| font-weight: bold;
| }
| .close{
| color: rgba(0, 0, 0, .4);
| margin-top: 20rpx;
| }
| }
| }
| }
| </style>
|
|