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
<template>
<el-select v-if="options" v-model="selectVal" placeholder="请选择">
<el-option
v-for="item in options"
:key="item[valueKey]"
:label="item[labelKey]"
:value="parseInt(item[valueKey])">
</el-option>
</el-select>
</template>
<script>
export default {
name: "customSelectorsDictionary",
props:{
options:{
type:Array,
default:()=>[]
},
value:[String , Number],
labelKey:{
type:String,
default:'label'
},
valueKey:{
type:String,
default: 'value',
},
},
data(){
return{
selectVal:''
}
},
mounted() {
this.selectVal = this.value;
},
watch:{
selectVal(val){
this.$emit('input',val)
},
value(val){
this.selectVal = val;
}
}
}
</script>
<style scoped lang="scss">
</style>