public_selector.vue
1.3 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
<template>
<view>
<view class="public_selector" @click="show = true">
<input type="text" :value="value[keyName]" class="public_selector-input" disabled :placeholder="placeholder" placeholder-class="placeholderClass" />
<u-icon name="arrow-down-fill" size="12" ></u-icon>
</view>
<u-picker :keyName="keyName" :show="show" :columns="columns" @confirm="confirm" @cancel="show = false"></u-picker>
</view>
</template>
<script>
export default {
name:"public_selector",
props: {
placeholder: {
type: String,
default: ''
},
keyName: {
type: String,
default: ''
},
value: {
type: Object,
default: () => {
return {}
}
},
columns: {
type: [Array],
default: () => []
}
},
data() {
return {
show: false
};
},
methods: {
confirm(e) {
console.log(e)
this.show = false
this.$emit('change', e)
}
}
}
</script>
<style lang="scss" scoped>
.public_selector{
background: #FFFFFF;
border-radius: 10rpx;
padding: 0 30rpx;
height: 76rpx;
box-shadow: 7rpx 0rpx 24rpx 0rpx rgba(153,153,153,0.22);
display: flex;
justify-content: space-between;
align-items: center;
.public_selector-input{
font-size: 28rpx;
}
.placeholderClass{
color: #505050;
}
}
</style>