<template>
	<view class="index">
		<chose-city @selectCity="selectCity" v-if="showCity" @closeModal="closeModal"></chose-city>
	</view>
</template>
<script>
	import choseCity from "@/components/chose-city/chose-city"
	export default {

		data() {
			return {
				showCity: true // 默弹窗显示
			}
		},
		components: {
			choseCity
		},
		methods: {
			selectCity(item) {
				console.log('-您选择的城市-', JSON.stringify(item))
				console.log('-lat-', item.lat)
				console.log('lng', item.lon)

				// let data = {
				// 	"name": item.name,
				// 	"location": {
				// 		"lat": item.location.lat,
				// 		"lng": item.location.lng
				// 	}
				// }
				
				
				this.$queue.setData('latitude', item.lat);
				this.$queue.setData('longitude', item.lon);
				this.$queue.setData('city', item.name);
				this.$queue.setData('localCampus', item.name);
				uni.navigateBack();
			},
			closeModal() {
				this.showCity = false
			},
		},
		onLoad() {

		},
		onUnload() {

		}
	}
</script>
<style scoped>

</style>
