定位

2019-04-11  本文已影响0人  web小哥MrYang

js

var QQMapWX = require('../../wxParse/qqmap-wx-jssdk.js');

var qqmapsdk;

//定位

  zhiding: function() {

    var that = this

    var demo = new QQMapWX({

      key: 'DHXBZ-IJQLI-BY3G6-5X2JA-63WHH-QUBPR' // 必填

    });

    wx.getLocation({

      type: 'wgs84',

      success: function(res) {

        demo.reverseGeocoder({

          location: {

            latitude: res.latitude,

            longitude: res.longitude

          },

          success: function(res) {

            that.setData({

              detail_info: res.result.address

            })

          },

          fail: function(res) {},

          complete: function(res) {}

        });

        app.information.location = {

          latitude: res.latitude,

          longitude: res.longitude

        }

      }

    })

  },

上一篇 下一篇

猜你喜欢

热点阅读