wxml
<map id="map" style="height:600rpx;width:100%;" longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}"></map>在app.json中添加一个获取当前gps经纬度位置的授权,如果不获取当前手机位置的话可以直接传经纬度数据。
{
"pages": ["pages/index/index"],
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示" // 高速公路行驶持续后台定位
}
}
}
添加完后小程序运行会弹出提示

onLoad: function (options) {
wx.getLocation({
type:'gcj02',
success:res=>{
this.setData({
longitude: res.longitude,
latitude: res.latitude
})
this.addMark(res);
}
})
},
addMark(res){
var marker=[]
marker.push({
id:1, //标记点 id
width:50,
longitude: res.longitude,
latitude: res.latitude,
label:{
content:'我的位置',
color:'#f00',
fontSize:20
},
callout:{
content:'气泡',
color:"#f00",
fontSize:30
},
iconPath:'/images/center.png'
})
this.setData({
markers:marker
})
},
最终效果
网友回复
有没有不依赖embedding向量的RAG技术?
有没有支持实时打断语音通话并后台帮你执行任何的ai模型?
开源ai大模型文件格式GGUF、MLX、Safetensors、 ONNX 有什么区别?
出海挣钱支付收款PayPal、Wise 、PingPong、Stripe如何选择?
如何实现类似google的图片隐形水印添加和识别技术?
linux上如何运行任意windows程序?
ai能写出比黑客还厉害的零日漏洞等攻击工具攻击任意软件系统工程?
js如何获取浏览器的音频上下文指纹、Canvas指纹、WebGL渲染特征?
为啥ai开始抛弃markdown文本,重新偏好html文本了?
网站有没有办法鉴别访问请求是由ai操控chrome-devtools-mcp发出的?


