Nationality.vue
2.0 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
<template>
<div>
<el-select v-model="nationality"
filterable
@click.native="getCountry"
@change="selectChange"
default-first-option
:loading="loading" placeholder="请选择"
style="text-transform:uppercase">
<el-option
v-for="item in countryOptions"
:key="item.countryid"
:label="item.countryid+'-'+item.countrydescchn"
:value="item.countryid">
<span style="float: left">{{ item.countryid }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.countrydescchn }}</span>
</el-option>
</el-select>
</div>
</template>
<script>
import {selectCountry} from '../../api/transport'
export default {
name: 'Nationality',
props: {
},
data() {
return {
nationality: '',
loading:false,
countryOptions:[],
countryid:'',
}
},
// computed: {
// },
// created() {
// },
methods: {
/*获取国籍*/
getCountry:function(query){
this.countryOptions=[];
let params={countryid:query};
this.loading = true;
selectCountry(params).then(res =>{
if (res!=null) {
console.log(res.data.data)
setTimeout(() => {
this.loading = false;
this.countryOptions=res.data.data;
}, 200);
} else {
this.countryOptions = [];
}
});
},
selectChange:function(val){
console.log(val)
this.$emit('tellFarther',val);
}
}
}
</script>
<style scoped>
</style>