How to obtain the latitude and longitude coordinates of your location through the WeChat applet

不言
Release: 2018-06-23 13:55:27
Original
3637 people have browsed it

This article mainly introduces the function of WeChat applet to obtain the longitude and latitude coordinates of your location, and involves the related operation skills of WeChat applet map function to obtain longitude and latitude information. Friends in need can refer to this article

The example describes a WeChat applet that implements the function of obtaining the longitude and latitude coordinates of your location. Share it with everyone for your reference, the details are as follows:

1. Effect display

2. Key code

index.wxml layout file Code

纬度:{{latitude}}
经度:{{longitude}}
Copy after login

index.js logic file code

Page({
 data: {
  latitude:'',
  longitude:''
 },
 onLoad: function () {
  var that=this;
  wx.getLocation({
   type: 'wgs84',
   success: function(res) {
    that.setData({
     latitude:res.latitude,
     longitude:res.longitude
    })
   }
  })
 }
})
Copy after login

The above is all of this article Content, I hope it will be helpful to everyone’s learning. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to use the three-level linkage selector in the WeChat applet

How to obtain it through the WeChat applet User mobile number

The above is the detailed content of How to obtain the latitude and longitude coordinates of your location through the WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!