ConsumerSelect.vue
1.23 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
<template>
<div class="goods-select">
<RemoteSelect
ref="remoteSelect"
v-model="currentValue"
select-type="consumer"
option-func-name="options"
:remote="true"
:filterable="true"
:config="config"
:placeholder="placeholder"
remote-search-key="realName"
@input="handleInput"
/>
</div>
</template>
<script>
import RemoteSelect from '@/views/components/RemoteSelect'
export default {
components: {
RemoteSelect
},
props: {
value: {
type: [String, Number],
default: () => null
},
placeholder: {
type: String,
default: '请选择'
},
config: {
type: Object,
default: () => {
return {
key: 'userid',
label: 'realname',
value: 'realname'
}
}
}
},
data() {
return {
currentValue: null
}
},
watch: {
value: {
immediate: true,
handler(val) {
this.currentValue = val
this.handleInput()
}
}
},
methods: {
handleInput() {
this.$emit('input', this.currentValue)
}
}
}
</script>
<style scoped lang="scss">
.goods-select {
display: flex;
.add-button {
margin-left: 10px;
}
}
</style>