map组件 模态框,真机不显示被地图挡住,编辑器可以
发布于 5 年前 作者 qianxiuying 7392 次浏览 来自 问答

2 回复

你好,地图组件从基础库v2.7.0 起支持同层渲染可以先检查一下样式。

帮忙看一下,地图遮挡问题很久了,样式z-index,无效,真机还是被挡住了。下面这个是一个页面的部分案例,我抽取出来了,搜索框和地址,是需要浮动在map组件之上的

<template>

&lt;view class="content"&gt;

	&lt;view class="main"&gt;

		&lt;view class="map\_container"&gt;

			&lt;map class="map" id="map" style="width: 100%; height: 100%" :longitude="longitude" :latitude="latitude" :markers="markers"

			 bindmarkertap="makertap" :show-location="isshowlocation"&gt;

			&lt;/map&gt;

			&lt;!-- 地址显示 --&gt;

			&lt;view class="adress-view"&gt;

				北京市海淀区西三环路,玉渊潭桥

			&lt;/view&gt;

		&lt;/view&gt;

	&lt;/view&gt;

	&lt;!-- 搜索 --&gt;

	&lt;view class="search-top"&gt;

		&lt;view class="image-search"&gt;

			&lt;!-- &lt;cover-image src="../../static/main/Search.png" alt=""&gt;&lt;/cover-image&gt; --&gt;

		&lt;/view&gt;

		&lt;input type="text" value="" placeholder="请输入搜索位置" placeholder-style="color:\#9E9E9E;font-size:14px;"/&gt;

	&lt;/view&gt;

 

&lt;/view&gt;

</template>

<script>

export default {

	data() {

		return {

			latitude: 39.915,

			longitude: 116.404,

			markers: \[\], //气泡

			isshowlocation: true, //默认显示我的位置

			ispolice:false,//默认隐藏

		}

	},

	onLoad() {

	},

	methods: {

 

	}

}

</script>

<style lang=‘scss’ scoped>

.show{

	display:block!important;

}

.hide{

	display:none!important;

}

.main {

	display: flex;

	flex: 1;

	flex-direction: column;

}

.content {

&nbsp; &nbsp;padding: 0px;

&nbsp; &nbsp;position:relative;

}

.map\_container{

&nbsp; height: 100%;

&nbsp; width: 100%;

&nbsp; position: relative;

&nbsp; .mapB-one{

	width:100%;

	height:100%;

&nbsp; }

}

/\* 搜索框 \*/

.search-top{

	position:fixed;

	top:16upx;

	left: 32upx;

	right: 32upx;

	z-index: 9999;

	background: \#fff;

	height: 80upx;

	display: flex;

	border-radius: 4upx;

	box-shadow:0px 0px 4px 0px rgba(204,204,204,0.5);

	.image-search{

		text-align: center;

		line-height: 95upx;

		margin-left: 32upx;

		margin-right: 16upx;

		cover-image{

			width: 40upx;

			height: 40upx;

			display: inline-block;

		}

	}

	input{

		width: 80%;

		height: 100%;

	}

}

/\* 地址模态框 \*/

.adress-view{

	width: 100%;

	line-height: 88upx;

	background:rgba(0,0,0,0.3);

	position: absolute;

	bottom: 0;

	text-align: center;

	font-size:14px;

	color: \#FFFFFF;

	z-index: 9999;

}

 

</style>

回到顶部