- 发布:2023-12-15 14:29
- 更新:2024-06-28 14:27
- 阅读:2389
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 12
HBuilderX类型: 正式
HBuilderX版本号: 3.98
手机系统: 全部
页面类型: nvue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
示例代码:
<template>
<view class="content">
<map name="" :markers="markers" style="flex: 1;width: 750rpx;" :longitude="130.3786716" :latitude="33.5578242"
scale="12">
<cover-view slot="callout">
<!-- <cover-view v-for="(item,index) in markers" :markerId="item.id" class="map-place-sort">
<text class="map-place-sort-text">{{item.id}}</text>
</cover-view> -->
</cover-view>
</map>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
markers: [{
"id": 0,
"latitude": "33.5578242",
"longitude": "130.3786716",
"iconPath": "/static/images/route/origin.png",
"width": 32,
"height": 32
},
{
"id": 1,
"latitude": "33.586746399999996",
"longitude": "130.3951692",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 2,
"latitude": "33.588864",
"longitude": "130.3973069",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 3,
"latitude": "33.5898421",
"longitude": "130.3969132",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 4,
"latitude": "33.5898091",
"longitude": "130.3969127",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 5,
"latitude": "33.5924675",
"longitude": "130.3967209",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 6,
"latitude": "33.5928107",
"longitude": "130.39942109999998",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 7,
"latitude": "33.5899297",
"longitude": "130.4134065",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 8,
"latitude": "33.58981",
"longitude": "130.4204315",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 9,
"latitude": "33.5891896",
"longitude": "130.4261859",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 10,
"latitude": "33.5741951",
"longitude": "130.4396956",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 11,
"latitude": "33.5683485",
"longitude": "130.4457766",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 12,
"latitude": "33.5643579",
"longitude": "130.4433976",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 13,
"latitude": "33.5532389",
"longitude": "130.4552463",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 14,
"latitude": "33.5606627",
"longitude": "130.3883943",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 15,
"latitude": "33.5588609",
"longitude": "130.382712",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 16,
"latitude": "33.5619144",
"longitude": "130.37892979999998",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
}
],
}
},
}
</script>
<style>
.content {
flex: 1;
}
.map-place-sort {
border-radius: 999rpx;
border: 4rpx solid #fff;
width: 52rpx;
height: 52rpx;
background-color: #333;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.map-place-sort-text {
font-size: 28rpx;
color: #fff;
font-weight: bold;
text-align: center;
}
.map-place-default {}
</style>
<template>
<view class="content">
<map name="" :markers="markers" style="flex: 1;width: 750rpx;" :longitude="130.3786716" :latitude="33.5578242"
scale="12">
<cover-view slot="callout">
<!-- <cover-view v-for="(item,index) in markers" :markerId="item.id" class="map-place-sort">
<text class="map-place-sort-text">{{item.id}}</text>
</cover-view> -->
</cover-view>
</map>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello',
markers: [{
"id": 0,
"latitude": "33.5578242",
"longitude": "130.3786716",
"iconPath": "/static/images/route/origin.png",
"width": 32,
"height": 32
},
{
"id": 1,
"latitude": "33.586746399999996",
"longitude": "130.3951692",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 2,
"latitude": "33.588864",
"longitude": "130.3973069",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 3,
"latitude": "33.5898421",
"longitude": "130.3969132",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 4,
"latitude": "33.5898091",
"longitude": "130.3969127",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 5,
"latitude": "33.5924675",
"longitude": "130.3967209",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 6,
"latitude": "33.5928107",
"longitude": "130.39942109999998",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 7,
"latitude": "33.5899297",
"longitude": "130.4134065",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 8,
"latitude": "33.58981",
"longitude": "130.4204315",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 9,
"latitude": "33.5891896",
"longitude": "130.4261859",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 10,
"latitude": "33.5741951",
"longitude": "130.4396956",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 11,
"latitude": "33.5683485",
"longitude": "130.4457766",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 12,
"latitude": "33.5643579",
"longitude": "130.4433976",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 13,
"latitude": "33.5532389",
"longitude": "130.4552463",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 14,
"latitude": "33.5606627",
"longitude": "130.3883943",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 15,
"latitude": "33.5588609",
"longitude": "130.382712",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
},
{
"id": 16,
"latitude": "33.5619144",
"longitude": "130.37892979999998",
"iconPath": "/static/images/route/via.png",
"width": 22,
"height": 22,
"customCallout": {
"anchorY": 20,
"anchorX": 0,
"display": "ALWAYS"
}
}
],
}
},
}
</script>
<style>
.content {
flex: 1;
}
.map-place-sort {
border-radius: 999rpx;
border: 4rpx solid #fff;
width: 52rpx;
height: 52rpx;
background-color: #333;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.map-place-sort-text {
font-size: 28rpx;
color: #fff;
font-weight: bold;
text-align: center;
}
.map-place-default {}
</style>
操作步骤:
将注释代码取消注释并运行则直接闪退
将注释代码取消注释并运行则直接闪退
预期结果:
正常展示气泡
正常展示气泡
实际结果:
闪退
闪退
bug描述:
在谷歌地图内编写自定义气泡窗口,ios打开闪退
最佳回复