zoukankan      html  css  js  c++  java
  • 小程序-地图-定位在我此时的位置

    wxml:

    <map id="mymap" latitude="{{latitude}}" longitude="{{longitude}}" markers="{{markers}}"></map>

    wxss:

     #mymap{100%;height:100vh}

    js:

    Page({

          data:{

               latitude:"",

               longitude:"",

               markers:[]

          },

         onLoad:function(){

                wx.getLoction({

                         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

                                           })

                           }

                })

         }

    })

  • 相关阅读:
    lldb
    错误记录
    越狱后
    c#学习
    26python类
    day01
    第二冲刺阶段第四天
    第二冲刺阶段第三天
    第五周课后作业
    结对作业
  • 原文地址:https://www.cnblogs.com/liuqingxia/p/7699439.html
Copyright © 2011-2022 走看看