当前位置:网站首页>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>
边栏推荐
- 联发科技2023届提前批IC笔试(题目)
- [PHP vulnerability weak type] basic knowledge, PHP weak equality, error reporting and bypassing
- LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)
- Integration of Android high-frequency interview questions (including reference answers)
- 消息队列(MQ)介绍
- 2.14 summary
- Ffmpeg mix
- 第十九届浙江省 I. Barbecue
- 普通本科大学生活避坑指南
- Pyqt control part (II)
猜你喜欢

Flutter monitors volume to realize waveform visualization of audio

Symbol of array element product of leetcode simple problem

I've been in software testing for 8 years and worked as a test leader for 3 years. I can also be a programmer if I'm not a professional

MC Layer Target

2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank

LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)

"Niuke brush Verilog" part II Verilog advanced challenge

On typescript and grammar

Pyqt control part (II)

Small sample target detection network with attention RPN and multi relationship detector (provide source code, data and download)
随机推荐
Thesis reading_ Tsinghua Ernie
ZABBIX monitoring of lamp architecture (2): ZABBIX basic operation
《牛客刷verilog》Part II Verilog进阶挑战
Sdl2 + OpenGL glsl practice (Continued)
Flutter monitors volume to realize waveform visualization of audio
Small sample target detection network with attention RPN and multi relationship detector (provide source code, data and download)
论文阅读_清华ERNIE
消息队列(MQ)介绍
Reptile exercise 03
JVM原理简介
2022 chemical automation control instrument examination summary and chemical automation control instrument certificate examination
After reviewing MySQL for a month, I was stunned when the interviewer of Alibaba asked me
2.14 summary
AWS VPC
C primre plus Chapter 10 question 6 inverted array
MediaTek 2023 IC written examination approved in advance (topic)
【XSS绕过-防护策略】理解防护策略,更好的绕过
移动端——uniapp开发记录(公共请求request封装)
Market status and development prospects of the global autonomous marine glider industry in 2022
逆袭大学生的职业规划