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
| <template>
| <view>
| <view class="mask_area" @click="handleMaskClick" v-if="show">
| <view class="content_area" @click.stop>
| <view class="search_area">
| <input class="" inputmode="search" type="text" placeholder="请输入关键字" @confirm="handleSearch" />
| </view>
| <scroll-view class="list_area" scroll-y="true">
| <view>
| <view class="list_item" v-for="item,index in dataList" :key="index" @click="handleSelect(item)">
| {{item.name}}
| </view>
| </view>
| </scroll-view>
| </view>
| </view>
| </view>
| </template>
|
| <script>
| export default {
| props: {
| show: {
| type: Boolean,
| default: false,
| },
| dataList: {
| type: Array,
| default: function() {
| return []
| }
| }
| },
| name: "yty-data-picker",
| data() {
| return {
|
| };
| },
| methods: {
| handleMaskClick() {
| this.$emit('close')
| },
| handleSelect(item) {
| this.$emit('select', item)
| },
| handleSearch(event) {
| this.$emit('search', event.detail.value)
| }
| }
| }
| </script>
|
| <style scoped>
| .mask_area {
| position: fixed;
| top: 0;
| left: 0;
| z-index: 999;
| width: 100%;
| height: 100vh;
| background: rgba(0, 0, 0, 0.6);
| }
|
| .content_area {
| position: fixed;
| bottom: 0;
| left: 0;
| z-index: 1000;
| width: 100%;
| height: 60vh;
| background: #fff;
| display: flex;
| flex-direction: column;
| align-items: center;
| animation: dialog-fade-in 0.3s;
| }
|
| .search_area {
| display: flex;
| align-items: center;
| width: 100%;
| height: 80rpx;
| background-color: #f9f9f9;
| border-radius: 40rpx;
| margin-top: 20rpx;
| padding: 0 30rpx;
| box-sizing: border-box;
| }
|
| .search_icon {
| width: 40rpx;
| height: 40rpx;
| margin: 0 15rpx 0 10rpx;
| }
|
| .list_area {
| width: 95%;
| height: 80%;
| margin-top: 20rpx;
| }
|
| .list_item {
| padding: 20rpx;
| border-bottom: 1px solid #f5f5f5
| }
|
| @keyframes dialog-fade-in {
| 0% {
| transform: translate3d(0, 100%, 0);
| }
|
| 100% {
| transform: translate3d(0, 0, 0);
| }
| }
| </style>
|
|