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
<template>
<selector v-model="valueSync" :options="countryList" value-field="tel" key-field="id" :label-field="item => $l(item, 'name') + ' +' + item.tel" filterable clearable :disabled="disabled"></selector>
</template>
<script>
import {getCountryListAll} from '@/api/ecw/country'
import selector from '@/components/Selector'
export default {
components: {selector},
props: {
value: String,
disabled: Boolean
},
data(){
return {
valueSync: '',
countryList:[]
}
},
watch:{
valueSync(){
this.$emit('input', this.valueSync.replace('+', ''))
},
value(){
if(this.value)this.valueSync = this.value
}
},
created(){
if(this.value){
this.valueSync = this.value
}
getCountryListAll().then(res => {
this.countryList = res.data.map(item => {
item.tel = item.tel.replace('+', '')
return item
})
})
},
methods:{
}
}
</script>