<template>
	<picker @change="townPickerChange" @columnchange="columnchange" :range="array" range-key="name" :value="value" mode="multiSelector">
		<slot></slot>
	</picker>
</template>

<script>
	const { data, province, city, area, town } = require('province-city-china/data');
	export default {
		data() {
			return{
				value: [0],
				array: {},
				c: {},
			}
		},
		props: ["arry"],
		mounted() {
			this.townList()
		},
		methods: {
			//接到信息
			townList() {
				this.array={}
				this.array.town = []
				for (let i = 0 ; i<this.arry.length	 ;i++) {
					this.array.town.push({
						name: this.arry[i].name
					})
				}
			},
			// 地址控件改变控件
			columnchange(d) {
				this.townList()
			},
			
			//传街道信息
			townPickerChange(e) {
				this.$emit('onTwonClick', this.array.town[this.value].name)
			},
			columnchange(d) {
				this.value = d.detail.value
			}
		},
	}
</script>

<style>
</style>
