Home > WeChat Applet > Mini Program Development > How does the mini program obtain latitude and longitude information to implement positioning function?

How does the mini program obtain latitude and longitude information to implement positioning function?

王林
Release: 2021-01-08 09:44:45
forward
2912 people have browsed it

How does the mini program obtain latitude and longitude information to implement positioning function?

Purpose: Use WeChat applet to obtain longitude and latitude information to achieve simple positioning function.

(Learning video sharing: Programming video)

Create a single page under pages such as local

local.js is as follows

How does the mini program obtain latitude and longitude information to implement positioning function?

local.wxml is as follows

<view class="page-body">
<view class="page-body-form">
    <text class="page-body-form-key">经度:</text>
    <input class="page-body-form-value" type="text" 
    value="{{longitude}}" name="longitude"></input>
    <text class="page-body-form-key">纬度:</text>
    <input class="page-body-form-value" type="text" 
    value="{{latitude}}" name="latitude"></input>  
    <view class="page-body-buttons">
    <button class="page-body-button" type="primary" 
    bindtap="getLocation">获取位置</button>
    </view>
</view>
</view>
Copy after login

In app.json

How does the mini program obtain latitude and longitude information to implement positioning function?

##Related recommendations:

Mini program development tutorial

The above is the detailed content of How does the mini program obtain latitude and longitude information to implement positioning function?. For more information, please follow other related articles on the PHP Chinese website!

source:csdn.net
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