WeChat applet obtains location latitude and longitude

First, you need to go to Baidu or Gaode official website to apply for ak.

wx.getLocation(OBJECT)

Get current latitude and longitude

wx.chooseLocation(Object object)

Open map and select location

wx.getLocation({
    type: "wgs84",
    success(res) {
        wx.chooseLocation({
            latitude: res.latitude,
            longitude: res.longitude,
            success: function(data){
		console.log(data)
	    }
        })
    }
})

See the original text here: Address link

Guess you like

Origin blog.csdn.net/cwb_2120/article/details/130236209