<template>
	<view class="container">
		<!-- <navbar :config="config" backColor="#999999"></navbar> -->
	</view>
</template>

<script>
	let app = getApp();
	export default {
		data() {
			return {
				RefreshMap: false
			};
		},

		onLoad() {
			
			uni.$on('mapJump', (data) => {
				this.$openPage(data)
			})

			uni.$on('onMapNextPage', res => {
				this.RefreshMap = false;
			});
		},
		onShow() {
			this.openSubNVue()

			if (this.RefreshMap) {
				uni.$emit('initMap', {
					init: true
				})
			}

			this.RefreshMap = true;
		},
		onUnload() {
			uni.$off('initPop')
			uni.$off('mapJump')
			uni.$off('onMapNextPage')

		},
		methods: {
			openSubNVue() {
				const subNVue = uni.getSubNVueById('mapPopup');
				subNVue.setStyle({
					"top": '0',
					'bottom': 0
					// "height": screenHeight - navHeight + 'px'
				})
				subNVue && subNVue.show()
				// this.subNVue && this.subNVue.show('slide-in-left', 300, () => {
				// 	console.log('初始化')

				// })
			},
			onSearch(e) {
				uni.$emit('NextMap', e)
			},
			onSearchKwd(e) {
				uni.$emit('NextMapKwd', e)
			}
		},

		onHide() {
			setTimeout(() => {
				const subNVue = uni.getSubNVueById('mapPopup');
				subNVue && subNVue.hide()
			}, 100)
		}
	};
</script>