<view>
<map
class="map"
:show-location="true"
:markers="markers"
@markertap="fetchShopDetail"
@labeltap="fetchShopDetail2"
@callouttap="fetchShopDetail3"
longitude="116.336590"
latitude="39.941127"
:scale="11"
id="map"
ref="map"
></map>
</view>
export default {
data() {
return {
// 用户当前定位信息
currLoca: {},
// 自定义标记点
// markers: []
markers: [
//貘科动物馆
{
id: 0,
iconPath: "../../static/q.jpg",//标记点图片
latitude: 39.941386,
longitude: 116.336655,
width: 30, //图片显示宽度
height: 30,//图片显示高度
title:'貘科动物馆',
},
//犀鸟馆
{
id: 1,
iconPath: "../../static/q.jpg",
latitude: 39.940826,
longitude: 116.335109,
width: 30,
height: 30,
title:'犀鸟馆'
},
//火烈鸟馆
{
id: 2,
iconPath: "../../static/q.jpg",
latitude: 39.940578,
longitude: 116.335977,
width: 30,
height: 30,
title: '火烈鸟馆'
},
//鹦鹉馆
{
id: 3,
iconPath: "../../static/q.jpg",
latitude: 39.941573,
longitude: 116.335544,
width: 30,
height: 30,
title: '鹦鹉馆'
}]
}
},
methods: {
fetchShopDetail(i){//点击标记点获取标记点id
console.log(i.markerId,'位置id')
},
}
}
uniapp使用,map标记旅游景点
于 2022-09-21 17:43:43 首次发布