<template>
  <a-cascader
    :options="cityList"
    placeholder="请选择"
    :field-names="{
      label: 'name',
      value: 'id',
      children: 'cityList',
    }"
    @change="change"
    style="width: 60%"
  ></a-cascader>
</template>

<script>
import store from "@/store";
import { allCity } from "@/api/public"
export default {
	data(){
		return{
			cityList:[]
		}
	},
	methods: {
		change(data){
			this.$emit('onchange',data)
		}
	},
	mounted() {
		if(store.getters.getCity.length===0){
			allCity().then(res=>{
				this.cityList = res.data
			})
		}
	}
};
</script>

<style>
</style>