<template>
	<view class="">
		<map style="width: 100%; height: 100vh;" :latitude="latitude" :longitude="longitude" :markers="covers"
			@tap="clickMap">
			<cover-view class="address_box">点击地图选择位置</cover-view>
			
		</map>
		<cover-view class="sure" @click="surePosi">确定</cover-view>
	</view>


</template>

<script>
	export default {
		data() {
			return {
				latitude: 39.909,
				longitude: 116.39742,
				covers: [{
					latitude: 39.909,
					longitude: 116.39742,
				}]
			}
		},
		onLoad(options) {
			console.log(options)
			this.latitude = options.lat
			this.longitude = options.lng
			this.covers = [{
				latitude: options.lat,
				longitude: options.lng,
			}]
		},
		methods: {
			clickMap(e) {
				console.log(e, 'ppp')
				this.covers = [{
					latitude: e.detail.latitude,
					longitude: e.detail.longitude,
				}]
				this.latitude = e.detail.latitude
				this.longitude = e.detail.longitude
			},
			surePosi() {
				console.log('ppppppppppppppppp')
				uni.reLaunch({
					url:'./index?lat=' + this.latitude + '&lng=' + this.longitude
				})
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	.address_box {
		height: 35px;
		line-height: 35px;
		padding-left: 15px;
		color: #fff;
		background-color: #ff6a14;
	}

	.sure {
		height: 35px;
		width: 30%;
		text-align: center;
		line-height: 35px;
		bottom: 40px;
		border-radius: 8px;
		left: 35%;
		position: fixed;
		color: #fff;
		z-index: 9999;
		background-color: #ff6a14;
	}
</style>
