当前位置:网站首页>Wechat applet distance and map
Wechat applet distance and map
2022-07-03 04:49:00 【Xiafei997】
js:
// Map
wx.request({
url: 'http://www.day.com/index.php/map',
method:"GET",
data:{list_id:id},
header:{
"token":token
},
success(res){
// console.log(res.data.data)
var latitude=res.data.data.latitude
var longitude=res.data.data.longitude
_this.setData({
latitude:latitude,
longitude:longitude
})
// console.log(latitude)
wx.getLocation({
type: 'wgs84',
success (res) {
// console.log(res)
var la=res.latitude
var lo=res.longitude
// console.log(la)
var s=_this.distance(latitude,longitude,la,lo)
_this.setData({s})
}
})
let map=res.data.data
// // Render data
_this.setData({map})
}
})
Jump to map page :
map(){
var latitude=this.data.latitude;
var longitude=this.data.longitude;
// console.log(latitude)
wx.redirectTo({
url: '/pages/map/map?latitude='+latitude+'&&longitude='+longitude,
})
},
Map :
data: {
markers:[]
},
/**
* Life cycle function -- Monitor page loading
*/
onLoad: function (options) {
// console.log(options.latitude)
var markers=[{
latitude:options.latitude,
longitude:options.longitude
}]
this.setData({markers})
},
page :
<map markers="{ {markers}}" latitude="{ {markers[0]['latitude']}}"
longitude="{ {markers[0]['longitude']}}"></map>
边栏推荐
- Market status and development prospect forecast of global button dropper industry in 2022
- Market status and development prospects of the global IOT active infrared sensor industry in 2022
- Market status and development prospect prediction of the global forward fluorescent microscope industry in 2022
- Keepalived热备与HAProxy
- Ffmpeg mix
- Blog building tool recommendation (text book delivery)
- Market status and development prospect prediction of global fermentation acid industry in 2022
- C primre plus Chapter 10 question 6 inverted array
- 带有注意力RPN和多关系检测器的小样本目标检测网络(提供源码和数据及下载)...
- Career planning of counter attacking College Students
猜你喜欢

Leetcode simple problem delete an element to strictly increment the array

Learning practice: comprehensive application of cycle and branch structure (I)

《牛客刷verilog》Part II Verilog进阶挑战
![[luatos sensor] 2 air pressure bmp180](/img/88/2a6caa5fec95e54e3fb09c74ba8ae6.jpg)
[luatos sensor] 2 air pressure bmp180

有道云笔记

Introduction to message queuing (MQ)

Internationalization and localization, dark mode and dark mode in compose

M1 Pro install redis

ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation

Prepare for 2022 and welcome the "golden three silver four". The "summary of Android intermediate and advanced interview questions in 2022" is fresh, so that your big factory interview can go smoothly
随机推荐
消息队列(MQ)介绍
Mobile terminal - uniapp development record (public request encapsulation)
The usage of micro service project swagger aggregation document shows all micro service addresses in the form of swagger grouping
Why should programmers learn microservice architecture if they want to enter a large factory?
Blog building tool recommendation (text book delivery)
Market status and development prospects of the global IOT active infrared sensor industry in 2022
带有注意力RPN和多关系检测器的小样本目标检测网络(提供源码和数据及下载)...
[set theory] binary relation (example of binary relation on a | binary relation on a)
Thesis reading_ Chinese NLP_ ELECTRA
Preparation for school and professional cognition
GFS distributed file system (it's nice to meet it alone)
Market status and development prospect prediction of the global fire alarm sensor industry in 2022
Thesis reading_ Chinese medical model_ eHealth
Priv-app permission异常
ZABBIX monitoring of lamp architecture (3): zabbix+mysql (to be continued)
Hire cashier (differential constraint)
Current market situation and development prospect forecast of the global fire boots industry in 2022
Crazy scientist
SSM based campus part-time platform for College Students
第十九届浙江省 I. Barbecue