<template>
  <el-select
    v-model="value"
    filterable
    clearable
    placeholder="请选择城市"
    @change="_selectChange"
  >
    <el-option v-for="city in getCityList" :key="city.id" :value="city.code" :label="city.cn+'-'+city.code" />
  </el-select>
</template>
<script>
import { sysCity } from '../../api'

export default {
  data() {
    return {
      value: '',
      getCityList: []
    }
  },
  mounted() {
    this._getList()
  },
  methods: {
    _getList: async function() {
      this.getCityList = await sysCity.list()
    },
    _selectChange(data) {
      this.$emit('on-result-change', data)
      this.value = data
    }
  }
}
</script>
