当前位置:网站首页>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>
边栏推荐
- GFS distributed file system (it's nice to meet it alone)
- Thesis reading_ Chinese medical model_ eHealth
- Introduction to message queuing (MQ)
- After job hopping at the end of the year, I interviewed more than 30 companies in two weeks and finally landed
- Ffmpeg mix
- Why does I start with =1? How does this code work?
- Learning record of arouter principle
- Handling record of electric skateboard detained by traffic police
- Market status and development prospect prediction of the global fire alarm sensor industry in 2022
- [set theory] binary relationship (definition field | value field | inverse operation | inverse synthesis operation | restriction | image | single root | single value | nature of synthesis operation)
猜你喜欢

Review the old and know the new: Notes on Data Science

Truncated sentences of leetcode simple questions

The programmer went to bed at 12 o'clock in the middle of the night, and the leader angrily scolded: go to bed so early, you are very good at keeping fit

Shuttle + Alluxio 加速内存Shuffle起飞
![[luatos sensor] 1 light sensing bh1750](/img/70/07f29e072c0b8630f92ec837fc12d5.jpg)
[luatos sensor] 1 light sensing bh1750

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

GFS distributed file system (it's nice to meet it alone)

Analysis of proxy usage of ES6 new feature

Mobile terminal - uniapp development record (public request encapsulation)

data2vec! New milestone of unified mode
随机推荐
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
关于开学的准备与专业认知
Human resource management system based on JSP
[set theory] binary relation (example of binary relation operation | example of inverse operation | example of composite operation | example of limiting operation | example of image operation)
Golang -- realize file transfer
2022 tea master (intermediate) examination questions and tea master (intermediate) examination skills
普通本科大学生活避坑指南
2.14 summary
Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
First + only! Alibaba cloud's real-time computing version of Flink passed the stability test of big data products of the Institute of ICT
AWS VPC
并发操作-内存交互操作
【SQL注入】联合查询(最简单的注入方法)
Flutter monitors volume to realize waveform visualization of audio
@RequestMapping
[BMZCTF-pwn] 18-RCTF-2017-Recho
Symbol of array element product of leetcode simple problem
The least operation of leetcode simple problem makes the array increment
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
data2vec! New milestone of unified mode