wx.getLocation无法正确执行回调,估计是作用域的原因

wx.getLocation({

    type: 'wgs84', 

    success: function (res) {

      alert("=======" + res.latitude);

      coords.latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90

      coords.longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。

      alert("com here===" + coords.longitude);

      getShopList();

    },

    cancel: function (res) {

      getShopList();

    },

    fail: function (res) {

      getShopList();

    }

  });

  

  

  上面是我写的调用方法,能进success方法,并且执行了第一个alert,但是下面的不能执行了。我怀疑是js不识别coords和getShopList方法,这我都在外层定义的,我怀疑是作用域的问题。但是不知道怎么解决


慕无忌1623718
浏览 3202回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript