当前位置:网站首页>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
边栏推荐
- uniapp调用地图,进行位置查询,标记定位
- Oracle database 12C parameter files (SPFILE and pfile)
- CTF CRYPTO RSA入门刷题
- From catf1ag two-hour AK match pwn/attack killing, summarize the common command guide of emergency response
- XSS simple summary
- Oracle database enables archive log mode and archive log deletion and generation frequency
- C Programming Language (2nd Edition)--读书笔记--1.5.3
- 数组操作——判断、去重、合并、展开
- Use bat to automatically execute CMD commands (multiple commands or a single command)
- Day14 view set and route
猜你喜欢

cmake的基本使用

Summary of XML external entity injection (xxE target recurrence)

How to modify the color of a line of text in the elemtnui table (elemtnui table modifies the color of a line of text)

uni-app微信小程序——商城(8)——订单详情

Codeforces round #664C

Quine injection of SQL injection

1. Internet foundation

JS string to object JS object to string JS string to object

小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId

Oracle automatic storage management 18C step-by-step installation -1
随机推荐
cmake的基本使用
STM32F10x--C语言-1
Record once easy_ SQL Stack Injection
Day12 Association serialization processing
About foreign key references, cross domain headers, and ref usage
小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId
uni 阻止按钮多次点击 按钮多次点击
“我的”Bug大全(转载)
网站如何统计访问人数?51LA如何安装使用?
tp-watermark.js网页添加水印插件
Oracle database 12C parameter files (SPFILE and pfile)
JS get the suffix format of a file name
Eye of depth III - (7, 8)] mathematics: matrix diagonalization and quadratic form 2.3
uni-app微信公众号(4)——地址管理页面
Summary of XML external entity injection (xxE target recurrence)
The C Programming Language (2nd)--笔记--1.7
Cve-2022-34265 Django extract & TRUNC SQL injection vulnerability recurrence
(六)test命令
Collection and summary of penetration test information
Gateway Kong route adding instructions