基本信息
源码名称:地图定位 小程序源码
源码大小:0.54M
文件格式:.zip
开发语言:js
更新时间:2018-08-17
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
//location.js
//获取应用实例
var app = getApp()
Page( {
data: {
point:{
latitude: 23.114155,
longitude: 113.318977
},
markers: []
},
onLoad: function() {
console.log( '地图定位接口getLocation还不能正常获取用户位置!' )
var that = this;
wx.getLocation( {
type: 'wgs84',
success: function( res ) {
//我这里测试获取的数据一直是一样的(TIT创意园),官方接口没真正开放,还是没发布的原因
var latitude = res.latitude
var longitude = res.longitude
var speed = res.speed
var accuracy = res.accuracy;
var point={
latitude: latitude,
longitude: longitude
}
var markers = [ {
latitude: latitude,
longitude: longitude,
name: '地图定位',
desc: '我现在的位置'
}];
that.setData( markers );
that.setData( point );
}
})
}
})