微信小程序 地圖map實(shí)例詳解
更新時(shí)間:2017年06月07日 16:22:00 作者:yuzeng84
這篇文章主要介紹了微信小程序 地圖map實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下
微信小程序 地圖map實(shí)例詳解
wxml:
class="button" bindtap="getlocation" style="margin-top:30px" markers="{{markers}}">定位 longitude="{{longitude}}" latitude="{{latitude}}" markers="{{markers}}" covers="{{covers}}" style="width: 100%; height: 300px;margin-top:30px">
js:
//獲取應(yīng)用實(shí)例 var app = getApp() Page({ data: { latitude: 0,//緯度 longitude: 0,//經(jīng)度 speed: 0,//速度 accuracy: 16,//位置精準(zhǔn)度 markers: [], covers: [], }, onLoad: function () { }, getlocation: function () { var markers = [{ latitude: 28.211400, longitude: 112.914250, name: '喜地大廈', desc: '我的位置' }] var covers = [{ latitude: 28.211400, longitude: 112.914250, iconPath: '/image/ic_position.png', rotate: 0 }] this.setData({ longitude: 112.914250, latitude: 28.211400, markers: markers, covers: covers, }) wx.getLocation({ type: 'gcj02', success: function (res) { var latitude = res.latitude var longitude = res.longitude var speed = res.speed var accuracy = res.accuracy console.log("latitude:" + latitude) console.log("longitude:" + longitude) console.log("speed:" + speed) console.log("accuracy:" + accuracy) wx.openLocation({ latitude: latitude, longitude: longitude, scale: 28 }) } }) } })
效果圖:
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
一文詳解typeScript的extends關(guān)鍵字
這篇文章主要為大家介紹了typeScript的extends關(guān)鍵字使用示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-03-03微信小程序 wx.uploadFile在安卓手機(jī)上面the same task is working問題解決
這篇文章主要介紹了微信小程序 wx.uploadFile在安卓手機(jī)上面the same task is working問題解決的相關(guān)資料,需要的朋友可以參考下2016-12-12微信小程序上滑加載下拉刷新(onscrollLower)分批加載數(shù)據(jù)(二)
這篇文章主要介紹了微信小程序上滑加載下拉刷新(onscrollLower)分批加載數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下2017-05-05