当前位置:网站首页>Uniapp calls the map to query the location and mark the location
Uniapp calls the map to query the location and mark the location
2022-07-19 01:30:00 【Pengzai studio】
This week's meeting adds another small function , You need to pass the ID number / Check the mobile phone number on the map ( The background returns longitude and latitude ), Mark position , It's troublesome to think , When doing it, I found that there was no technology , Share with you .

<map class="map" :longitude="longitude" :latitude="latitude" scale="16" :markers="markers" show-location="true"></map>data() {
return {
longitude: "", // Current position longitude
latitude: "", // Current position latitude
markers: [], // Get the tag information of the location
}
}methods: {
searchBtn(){
let then = this;
uni.getLocation({
type: 'wgs84',
geocode: true, // Set the parameter to true The longitude, latitude and city information can be obtained directly
success: function (res) {
// res It will return the current longitude and latitude information , If you want to show the current location by default , The following longitude and latitude can be used directly res Value , If the default display location , Then customize the longitude and latitude ;
then.longitude = '116.407526';
then.latitude = '39.904030';
then.markers = [
{
title: '',
latitude: then.longitude,
longitude: then.latitude,
height: 100,
width: 100,
iconPath: 'http://cdn.duanqinghua.com/duanqinghua/img/55.jpg'
}
]
}
});
}
}Then every time you query , Through the background interface , Get the corresponding longitude and latitude , Assign a value to longitude and latitude, Then the map will show the corresponding latitude and longitude area , If you want to show the positioning icon at the same time , Then give it in the way above markers assignment , Multiple positions can be marked .
( After getting the data , You'd better not give it directly to markers assignment , First let Define a random assignment , then let Defined assignment markers, Otherwise, the marked points will not be displayed )
Look at the address uniapp Call up the map , Conduct location query , Mark positioning
边栏推荐
- Summary of Applied Cryptography
- win10解压文件时,出错:不能创建符号链接 你可能需要以管理员权限运行Winrar 客户端没有所需的特权
- 深度之眼三——(3)】 数学:矩阵特征值与特征向量1
- uni scroll-view 下拉刷新
- 1. Internet foundation
- Cve-2022-34265 Django extract & TRUNC SQL injection vulnerability recurrence
- 解决小程序自定义底部菜单切换闪动
- Understand PHP from [Fifth space 2021] easycleanup_ session
- Vue project deployment, cleaning cache
- Eye of depth III - (6)] mathematics: matrix diagonalization and quadratic form 1
猜你喜欢

Codeforces round #664C

JSX 语法

The C Programming Language (2nd)--笔记--1.6
![Eye of depth III - (6)] mathematics: matrix diagonalization and quadratic form 1](/img/6f/079f9d39b560a31fe3a0b57e0ff5aa.png)
Eye of depth III - (6)] mathematics: matrix diagonalization and quadratic form 1

Day06-ORM字段及操作
![Eye of depth III - (4, 5)] mathematics: matrix eigenvalues and eigenvectors 2](/img/fc/7a4bffc642d82fcfaf3be80bcc39fc.png)
Eye of depth III - (4, 5)] mathematics: matrix eigenvalues and eigenvectors 2

gtest与gmock的安装与使用

uni-app微信公众号(5)——新增、修改地址

使用bat自动执行cmd命令(多个命令或单个命令)

Win10 vscode 代码格式化设置与远程断点调试
随机推荐
js获取一个文件名的后缀格式
深度之眼三——(7)】数学:svd分解的应用
Day12 Association serialization processing
服务器如何安装宝塔面板?(宝塔面板安装教程)
【ElenmentUI el-date-picker日期选择器,结束时间不得早于开始时间,且只能选择距开始时间指定天数的日期】
From catf1ag two-hour AK match pwn/attack killing, summarize the common command guide of emergency response
Cve-2022-34265 Django extract & TRUNC SQL injection vulnerability recurrence
Day10 front back continuous adjustment
MoveIt2——4.机器人模型和机器人状态
学习STM32F103时涉及的C语言知识汇总(仅链接)
JSX compilation
鼠标右键菜单添加快速打开选项遇见的错误:
Eye of depth III - (7)] mathematics: application of SVD decomposition
JS get the suffix format of a file name
解决小程序自定义底部菜单切换闪动
Day05-Cookie,Session,Csrf
Day13 mixed view base class
mmap的 Bus error问题及解决
The C Programing Language--(2nd)--笔记--4.11.2
Day05-Cookie,Session,Csrf