图1 为浏览器运行,图2 为手机端运行
{
latitude: 30.67,
longitude: 104.15,
title: '起始点',
iconPath: '../../static/img/localtion.jpg',
width: 50,
height: 50
},
{
latitude: 30.676,
longitude: 104.181,
title: '结束点',
iconPath: '../../static/img/localtion.jpg',
width: 50,
height: 50
}
x***@163.com
- 发布:2019-05-20 15:54
- 更新:2022-12-30 17:34
- 阅读:7081
图片路径改为绝对路径,参考代码
<template>
<view style="flex: 1;">
<button @click="setMarkers">setMarkers</button>
<map style="flex: 1;" :markers="markers"></map>
</view>
</template>
<script>
const testMarkers = [
{
id: 1,
latitude: 39.9086920000,
longitude: 116.3974770000,
title: '天安门',
zIndex: '1',
iconPath: '/static/logo.png',
width: 40,
height: 40,
anchor: {
x: 0.5,
y: 1
},
callout: {
content: '首都北京\n天安门',
color: '#00BFFF',
fontSize: 12,
borderRadius: 2,
borderWidth: 0,
borderColor: '#333300',
bgColor: '#CCFF11',
padding: '1',
display: 'ALWAYS'
}
}
];
export default {
data() {
return {
markers: []
}
},
onReady() {
},
methods: {
setMarkers() {
this.markers = testMarkers
}
}
}
</script>
1213
还是没有效果啊
2020-02-29 16:45
lzzzz
回复 ice: 怎么解决啊
2020-04-04 13:26